Aquarium effects

I blend a texture on a transparent card to make the rays instead:

I’ve also created a low polygon rock. However, I am not able to cast the water caustics on it. I am able to do it on other nodes, but not the rock. The pseudo code is like this:

        rock = loader.loadModel("models/rock10-2")
        rock.reparentTo(render)
        rock.setPos(0,0,0)
        rock.setScale(5,4,3)
        rock.setHpr(20,0,0)
        rock.setShaderOff()
        self.waterts = TextureStage('water')
        #self.waterts.setMode(TextureStage.MAdd)
        self.waterts.setMode(TextureStage.MBlend)
        self.waterts.setColor(Vec4(0.9, 0.9, 0.9, 1))

        rock.setTexture(self.waterts , texCaustics)

Any ideas ? Thank you !

Use TexGen or projected textures.
This link explains a nice tex gen way:
opengl.org/resources/code/sa … /caustics/

For objects obscuring the caustics, you’ll also want to do a depth render from top with ARB_shadow enabled, that is multiplied by the caustic stage.

Mind you this is beyond me-

Couldn’t you have a translucent overlay over the whole image? And use 2d sprites for shadows under the fish?

That way your fish and the rock both have the light effects? That’s how I would do it in 2d animation and I think a similar approach should work in 3d.

But I am just guessing.

JB Skaggs

Yes, but how to create the translucent overlay ? Do you mean a flat plane ? The emulated rays in the picture above is a flat plane. But on the ground…I am not sure if the effect is good or not…let me try it out.

Do you mean calling setTexGen with TexGenAttrib.MWorldPosition ?

I add:
texturestage.setSort
rock.setTexGen
rock.setTexScale

I get the caustics now. I want to share the water caustics texture but it is too bright on a rock. I am using TextureStage.MBlend / TextureStage.MAdd to blend the caustics to the ground and rock. Without writing a shader, it looks like I can’t control too much the blending result…I have to modify the caustics texture for the rock to get a more acceptable appearance.

But wouldn’t the light be brighter on the rock because it is a darker color? On the other hand lava rock would also make the light appear fuzzy or more diffuse, with less defined edges.

Sometimes the effect may not look correct but in reality it may match what we see in nature more closely.

BTW have you been to Nvidia’s examples on caustics and shaders?

JB Skaggs

I believe a dark object will not become white even if a strong light is cast on it. A rock is less reflective than the sand ground, so a simple blending on top looks strange.

I have only tried “Nalu” demo. Do you know other good water caustics demos ?

If you want more control, try CMInterpolate combine mode.

Otherwise, I think MModulate will make the most sense - then just adjust the range of the greyscale values in the texture with GIMP or so.

I didnt know it turned white! I thought you meant it wasn’t diffusing properly.

JB Skaggs

Some rocks and a plant added !

Now need some other animals…sea horses, jelly fish, more plants…and a shader to move the plants.

wow. that’s looking great already!

Looking better every time I visit this thread, but you’re still missing the most important thing of underwater scenes - fog.

I’ve actually tried the fog effect that come with panda. I can’t make it look interesting and handsome… Any idea ?

Really, not when you have an exponential fog with the right color? Have a screenshot?

May be it is the problem of the color of the fog. I sync the background color with the fog color in this screen.

Change the density. Or use a linear fog.

I don’t see any problem, I think it looks better with the fog. For starters, without the fog the colors in the scene are too vibrant and crisp, whereas the fog has a nice de-saturating effect that results in a realistic muted look.

shiny cool - to me is really a beauty
just misses bubbles and is almost perfect

Linear fog seems better. I like to see a very clear front side.

it cuts 10fps though and plus in an small home aquarium you don’t have a linear fog perception cos the depth of the water is too small to perceive it and usually the glass tend to colorize a little so i guess the former shot was more realistic. This setup is perfect in a sea environment I guess.