Glass in the lovely new Water Shader

Started by cyphyr, May 02, 2008, 10:05:49 AM

Previous topic - Next topic

cyphyr

Love the new water shader, I've been playing about with trying to get it to simulate glass, doable but very dependant to the individual scene. Effectively the glass/water shader has no back face to reset its effect. The transparent effect will carry on untill it hits an object, the back of the room, the nearest line of sight mountain or  the background object. If I look through a piece of real glass it has a depth at which its not glass any more, ie the light rays have passed through the glass object and out the other side. Looks like the water shader has no "other side". Indeed if a glass plane object is imported with only a single polygon and made double sided it refracts the image behind it twice. If a real world glass pain object is imported (ie it has a thickness of say 5mm) then the light is refracted a total of four times. There make for some interesting images but not very usefull.

I think the issue here is partly due to the fact that I'm trying to cheat a shader into doing something it was'nt designed for and partly due the fact that within Terragens implementation of obj's single sided that side is always facing the camera, therefore there is no way for terragen to streighten out a refracted ray.

I have also noticed that every time I stack more than two layers of glass over eachother the program freezes or crashes, easily repeatable.

Also notice how in the image below the grid llines are not refracted but the object is and the refraction seems to have a magnification effect.

Happy rendering

Richard
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

joshbakr

Interesting find, thanks for sharing this info.

rcallicotte

It looks like we'll just need transparency as a seperate shader function other than the water shader.
So this is Disney World.  Can we live here?

Mr_Lamppost

Interesting, I made some very quick tests using objects and got the preliminary impression that the water shader would work for glass if the Make Double Sided flag was NOT set under the object properties.  I was testing with displacement (Waves) and less than perfect objects so was not sure of the source of the render errors I was getting without making better tests. 

I have just made a window similar to yours, applied a default water shader to the glass; the only modification to the glass is that the roughness has been reduced to zero.  With the Make Double Sided flag set for the objects I was getting  single sided  glass however with the double sided check box cleared the glass is working fine; the refraction looks to be working correctly.  The only problem I can see is the noise seen on the frame of the second window when viewed through the glass in the first (Front) window.

I have attached the .tgd and the window .tgo (Zipped).

Just as a comparison I created a similar scene using POV-Ray and have included the result and POV scene file.  I have had to change the file extension to .txt so that I can upload this.  Change this back to .pov in order to use the scene file.
Smoke me a kipper I'll be back for breakfast.


rcallicotte

So this is Disney World.  Can we live here?

Mandrake

I just had to throw a light source between these two windows so I finally got a chance to break out the gaudy lamp. ;)
But why is there no light reflected off the 2'nd window>
Kidding, I didn't touch the reflection settings, that's a 2'nd lamp on the other side of the 2'nd window.

Mr_Lamppost

I am curious that everyone wants to put lights in that tower.  If I could get a master pattern from a 3D print I'd be quids in selling tea-light holders. ;D

This last image is still showing refraction into an infinite depth, assuming all the normals on your window object are pointing out did you remember to un-select make double sided?
Smoke me a kipper I'll be back for breakfast.

Mandrake

I did not change any of your settings, I just threw the lamp between the window as I had to see how the light source looked. The thought of having to throw light sources behind every window on say a star ship. argh..

Mr_Lamppost

When you opened the .tgd did the window objects open right away or did you have to re-load the files?  Just a though but I wonder if reloading reset the double sided flag.

I tried a similar scene with the following results:  First with double sided disabled, renders correctly.  Then with double sided enabled, the glass appears infinitely thick and took more than twice as long to render.

I have also included the new .tgd  if you need the Gaudi Tower it is available over at Ashundar.

http://www.ashundar.com/index.php?action=tpmod;dl=item325
Smoke me a kipper I'll be back for breakfast.

sonshine777

Quote from: Mandrake on May 03, 2008, 07:02:39 PM
I did not change any of your settings, I just threw the lamp between the window as I had to see how the light source looked. The thought of having to throw light sources behind every window on say a star ship. argh..

I know this is off the transparency subject, but have you thought of using a color shader that is luminous? They are usually so small anyway that all you want is a point of light. And unless you plan on a closeup fly-by you don't need to see inside. 

Mandrake

Yes, thanks sonshine, I have done that in the past and it works just fine.

Mr_Lamppost

Smoke me a kipper I'll be back for breakfast.