I’m new to Panda3D (and 3D graphics programming in general) – but I’m attempting modify clcheung’s vertex texture fetching example (watervtfdemo1_new.py) to add some islands to an “ocean”. However, when I add an island there is a very strange reflection artifact – basically the “underside” of the island (the view of the island from beneath the water) is reflected over the entire waterplane (see attached images below).
I read the whitepaper from NVIDIA on which this demo was based and they mention using a technique to reflect/refract objects that are above the plane by computing view of the objects from below the plane and mapping that onto the water plane. This seems to work very well for objects that are on the periphery of the waterplane and for things like skyboxes which are high above the plane. But when I add an object close to the surface (e.g. an island) it creates a massively distorted view of those objects which fills large parts (or all) of the waterplane.
I was curious if anyone has a simple solution to this. Is there a way to make a NodePath or GeoMipTerrain object (i.e. the island) invisible from a certain viewing angle?
I thought that perhaps if I could make only the island be “invisible” from beneath the water, then it won’t be reflected by the water at all. Also I only want to clip the island (i.e. make it transparent from the viewpoint of beneath the water) but need to preserve the view of the sky and mountains, etc so they are reflected by the water.
You should use a clipping plane by adding a ClipPlaneAttrib to your reflection camera to make sure that all content below the water plane is clipped from the reflection. Search for water examples around the forums, many of them include code to do that.
find this line
File “s:\tmp\demomaster-0.8\demomain.py”, line 272, in ActivateGUI
self.fMouseDisabled = (base.mouse2cam.getParent() == base.dataUnused)
change from
self.fMouseDisabled = (base.mouse2cam.getParent() == base.dataUnused)
with
self.fMouseDisabled = (base.mouse2cam.getParent() == True)
This does not work without hacking, I also deleted the WX. When I finish, I’ll let you know. And I think I can only share with the condition for review.
Okay, thank you.
It would be necessary to find the author of these codes, if he wants to share these codes with the community he could add a license.
it could help in this discussion: