Game Development Community

fun with O3D

by Orion Elenzil · 04/23/2009 (2:33 pm) · 5 comments

as you know, this week google released an open-source 3D engine browser plugin which takes full advantage of modern graphics cards & pipelines. Ben Garney has a great technical overview of it on his blog.

in this blog i talk about a little graphical toy written in flash.

here is the same toy, more or less, written in O3D.

i'm a bit puzzled at the performance, i have to admit.
the CPU is still fairly high, although it's independent of window size.
for some reason rotating 400 squares is more expensive than rotating 400 teapots, or even 1000 teapots. so clearly there's something i don't understand yet.

the little rotating squares are not raw polygons as in the flash version, but actually just textures of screencaps of the flash squares.

elenzil.com/gg/images/o3d_4.png
elenzil.com/gg/images/o3d_2.png

#1
04/23/2009 (9:56 pm)
I didnt knew of O3D. Awesome toys!
#2
04/24/2009 (5:27 am)
The Utah teapot is a graphics primitive, just like triangles, while squares are unnatural - that's why they're slow!

Only half-serious. Could it be because it's a beta, like most Google stuff? Textures might be trickier than the teapot - the teapot is actually a primitive in OpenGL'd libglu.
#3
04/24/2009 (7:50 am)
hah!

i'm not sure that explains things in this case tho - whether it's a primitive or not (in this case it's not, it's coming from a file) it still needs to be rendered, plus the teapot is environment-mapped with bump-mapping, which involved two textures. i wonder if it has to do with the teapot using shaders and the images not.
#4
04/25/2009 (1:43 pm)
@Orion

Yep that's actually it. For some reason (well technically this is the case on any modern graphics card) using shaders is faster by a large margin than using fallback texturing techniques. Change the square to a textured polygon and simply rotate that and all will be well.
#5
04/25/2009 (2:04 pm)
Hey peter, thanks for the reply.
the little squares actually are already just textured quads, however.
i can even prove it; here's the texture:
elenzil.com/o3d/4/assets/bluTile.png
.. which nicely illustrates one of the things i love about O3D: the ease of importing online content: there is no equivelant of a .swf file for O3D; no baking assets into a blob, no build step, etc - it's just javascript.

so i'm still puzzled over the speed difference but haven't really investigated/experimented too deeply yet.