Originally posted by dorbie:
[b]Lighting is essential, for this to work correctly. If you illuminate the model from above and have no ambient then it look correct.

If you still want ambient illumination, or additional lights from other directions then you make sure that they are not modulated by the caustic texture. Only the direct illumination term from above should be modulated by the caustic texture.[/b]

thanx for your quick answer Mr Dorbie, you were the one i’d wanted to talk to :slight_smile:
If i illuminate my scene from above with a black ambient, with (GL_ZERO, GL_SRC_COLOR)
blending parameters, then the caustics effect looks right, if i am near of an object. But as i use blue fog to fake underwater depth cueing, with those blending parameters the second pass
doesn’t fade in the fog, and i end with a silhouette of my sub in the ambient color.
is there a trick to have both the depth cueing and the caustic on the top faces?

I’d recommend either performing the caustic modulation using multitexture instead of multipass so it happens before the fog is applied and it’ll be a lot faster on modern hardware. If you can’t do this (or if you need a low end single texture code path) then you need a final fogging pass drawn after everything else and you wouldn’t fog any of the earlier passes. That seems a bit extreme but your hardware might require it.

In fact i cannot use multitexture because i use a high level API (Vega), so i don’t have an easy access to the geometry and its rendering.
3 pass seems a big cost, i guess i’ll use depth cueing in the abysses and caustic near the water surface.
I’ve looked nutty’s underwater demo, but for now it’s still far above my level(Vertex programs are too low-level for my current understanding)

Vega doesn’t stop you using multitexture. Simply put the second texture calls in a callback. I’m surprised that they don’t support multitexture natively by now, you must be mistaken (?).