Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Emil, posted on March 01, 2001

Image Description, by Emil

Here are a few screenshots from my latest project, an underwater screensaver, rendered in realtime using OpenGL. This is one of my first attempts with 3D graphics, so I have kind of added more features while learning. I think the result is pretty cool, though it requires a Geforce or something similar by now (About 25 FPS on a Geforce256).

The lightmaps are procedurally generated and animated. (I'm really running out of texture units) (The light is refracted by a simple wave simulation to generate the typical light-patterns on the bottom.) In the shot with the can you can see a soft shadow at the bottom, which gets sharper as the can moves closer to the bottom. (It looks better when animated. Also, notice the darkened shadow volume) The rocks seen in one of the pics have some precalculated bump-maps. The schools of smaller fish uses a simple flocking simulation. They also avoid the rocks, and tries to escape the hunting dolphin. The dolphin, which is programmed to hunt the smaller fishes, is animated by deforming it's object space with a suitable continious function. The seaweed is animated to give the illusion of streaming water. Most of the geometry is procedurally generated.

That's all.

I'll try to make it available for download soon.
Look for it at:


Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

March 01, 2001, 02:41 AM

Looks pretty sweet, i'll have to get it when it comes out.

Navreet Gill

March 01, 2001, 03:13 AM

That's really awesome for one of your "first attempts at 3d graphics"!!!


March 01, 2001, 04:10 AM

If the dolphin swims thru the seaweed, does the water rush affect the seaweed?

Looks very nice, but in the top left image, the visibility cuts out very crisply, you dont usually see that underwater. The other images dont seem to have that problem however.

Saad Faisal

March 01, 2001, 04:26 AM

This is one big load, shit!!!! this is BEAUTIFUL. I mean pardon my language but i think under water simulation is always my sensitive areas. This is just too sweeeeeeet.


March 01, 2001, 05:18 AM

Nice work, it looks really nice.
I especially like the volumetric shadow effect in the top-left screenshot.
Just a few tips tough, you might want to use projective textures for the "light reflecting on the bottom of the water effect" (that way you'll see it on everything, including the seaweed) and you might want to use several layers which are on top of eachother, each with different sizes and each animating/moving at a different speed (it looks to repetitive as it is now)



March 01, 2001, 06:38 AM

Gimmethatshit! :)

Stefan Karlsson

March 01, 2001, 07:45 AM

Well, 25 fps is not really impressive... Probably would be faster with JAVA written Raytrace than making anything with triangles with OPENGL

Brebion flavien

March 01, 2001, 08:02 AM

> Well, 25 fps is not really impressive...

How can you say that ? You don't even know how many triangles are displayed each frame.
Very nice shots in my opinion !

Peter Mackay

March 01, 2001, 08:51 AM

I would imagine there's a fair bit of computation going on there, so I reckon 25fps is good.

Also, it looks like he's obeying one of the golden rules. Get it working, then get it fast. It's a lot easier to bug hunt in readable code compared to lightning fast assembly.

Very nice IOTD. It looks great.

- Peter


March 01, 2001, 09:53 AM

This is so nice, I wished I had made something similar...
And this is remembering me I should also think about underwater scenes in my 3d engine :)

About the frame rate... 30fps on TNT2 or better card should be perfect, 25fps on a GeForce is ok.


March 01, 2001, 09:54 AM

>Well, 25 fps is not really impressive... Probably would be faster
>with JAVA written Raytrace than making anything with triangles with OPENGL

Either this guy is joking or he's just plain stupid :)
I guess the first, 'cause I don't think anyone would be *that* stupid :)


March 01, 2001, 10:14 AM

Yeah, but how many FPS on a GeeForce 3? :-)

Very pretty shots. There aren't too many high-quality screensavers out there, I'm glad you're helping to change that. The shadowed water between the oil drum and the ground is an especially nice effect.

Stefan Karlsson

March 01, 2001, 10:36 AM

Hoho... Damn No humor folks? ;))

anyways... my experience is that opengl is mad slow ;)

D3d usually runs 10x faster ;)

So well well...


March 01, 2001, 10:53 AM

25 fps, is too slow.
If it is for a screen saver it is not important to have a lot of polygon.
But he want to use her engine for a game, it can be good.

Peter Mackay

March 01, 2001, 11:15 AM

If you tell a joke, and it annoys people, then that says something about your sense of humour...

Anyway, OpenGL is only mad slow when used wrongly. Quake 3 is a testiment to that. As is Doom 3, judging by recent footage.


March 01, 2001, 12:20 PM

If your D3D is 10x faster then your OpenGL, either your drivers are fucked, or your code is :)

Jukka Liimatta

March 01, 2001, 12:55 PM

I hate "optimizing" GL code. You never know if the optimizations will work on more than one or two vendor's HW.

NV_VERTEX_ARRAY_RANGE ( sp? ) -- the NV_ prefix does disturb me in great lengths. Are we supposed to program with OpenGL API or OpenNV API?

Grrrr. So I tend to write a lot of 100% "pure" OpenGL code, which is far from being optimal.

With DX8, I write code using IDirect3DVertexBuffer8 -- that works with all vendors hardware, and does usually even choose the fastest rendering path w/o me actually writing the different paths. I consider that a BIG PLUS.

I hate extensions. They are proprietary for much too long period of time, and slow in turning up in other vendors drivers even if they do.

There is one firm, which can write code using anything they find in GL, and all vendors run up and implement the features. Do I need to tell the firm's name. I didn't think so.



March 01, 2001, 01:09 PM

yes the extensions system just sux, you're right ...

anyway there are several easy ways of optimising OpenGL ...

for example, doing as less state changes as possible, using display lists and/or vertex arrays, putting all your triangles in lists sorted by rendering states, and then do one big loop between one pair of glBegin/glEnd for each rendering state, etc etc ...

this is API optimising, and lots of optimisation can be done only by taking some time to think of what you want to do, what are the best structures and algorithms to do these things, etc ...


PS: btw, OpenGL can't be 10x slower than D3D ... just because D3D is object oriented, this involves lots of indirections ...

Ashley D Henstock

March 01, 2001, 01:22 PM

haha wonder how long before they latch onto the pattern stefan
Good work emil, I like the volumetric effects you have got going on, reminds me a bit of the underwater scene on the plate in OpenGL Redbook 1.2 version. Anyhow, nice work!


March 01, 2001, 02:23 PM

If this is your first attempt, you've got a pretty bright future ahead.

How did you do the soft shadow on the can? What about the "light rayus" visible in all images?



March 01, 2001, 02:28 PM

I don't think some indirections will ruin the rendering speed at all. Whatsoever. Unless you're using one call per poly, ofcourse, but if you're doing that you should be pointed at and publicly ridiculed.


March 01, 2001, 02:37 PM

hey sagacity, jij komt hier ook maar even gezellig posten =)


March 01, 2001, 02:42 PM

mmmh ... ok i said that thing about the indirections just because i dont like DX :)

but anyway, no one can say that DX is 10x faster than OGL ...


March 01, 2001, 03:12 PM

Yes, agreed, no argument there :)


March 01, 2001, 03:42 PM

I love it! I too would like to know how you did the can... ( going to be foolin' with shadow volumes soon... )

Speaking of the can, how's about making it a bottle with a letter in it or something... the can makes the water look POLLUTED! ;)

You should consider making a game, Those shots look great.


March 01, 2001, 04:05 PM

Great idea! I never thought about that. Maybe I'll add this effect later.


March 01, 2001, 04:08 PM

Actually, I am using projective textures, but using the lightmap on the seaweed look kind of wierd, so I removed it.
I would use layers if I had any triangles left to consume.
Thanks for the tip though.


March 01, 2001, 04:21 PM

The shadow volume is just made of flat triangles facing the camera.
Once you get the triangles in the right place this is really fast.
I know this is kind of cheating, but who cares if it looks real :)
(tried to use real volumes and stencil buffer tricks, but the result was too slooooooow (maybe it just needs some more work))



March 01, 2001, 04:45 PM

first attempt ? ... i must do something wrong - however cool shot beside the fact that these are a bit too high requirements for a screensaver :)

keep on good work, under-water simulations rock ;)



March 01, 2001, 05:32 PM

Why would you say that? It's been my experience too that D3D is faster than openGL, especially on a D3D enhanced card, but that card was not "fucked" as you put it. Besides being easier to implement (this is my opinion) I do believe that D3D is more optimized than OpenGl. This comes primarily from the lack of "extension" technology that drives openGL. If you have that many new features, perhaps it is time to rewrite from the ground up.

And Flure, get a clue.

This thread contains 38 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.