Underwater sun is "always on top"

nargil

27-03-2009 17:48:39


Is there something I can do to hide the sun when there is an object in front of it ?

DanielSefton

30-03-2009 22:56:36

No. It has no way of knowing when it is behind something.

But the general solution for this (I'm not sure how it translates to Hydrax) is to perform a raycast from the sun to the camera. When this is intersected, the sun is hidden. I don't do this for Hydrax yet, but for my sky sun, I use my collidable bounding boxes as a guide for the ray. So, for example, that allows the sun to be in front of leaves that the character can simply walk through, yet it hides behind the tree trunk. Obviously you leave some leeway, so that the sun can 'overlap' the objects for a nice effect. Again though, not sure how this could be implemented for the god rays.

superflanker

01-04-2009 19:48:55

Use the z-buffer

nargil

02-04-2009 09:06:57

Use the force Luke... Maybe you could tell more ? ;) I've never used the z-buffer.