Planetside Software Forums

General => Terragen Discussion => Topic started by: Mandrake on July 03, 2008, 08:45:34 AM

Title: Transparency question
Post by: Mandrake on July 03, 2008, 08:45:34 AM
I guess for Mat or Jo

I've pretty much exhausted combinations to using the water shader as a transparency, without much success. I run C4D and then wash it through Poseray to generate the mtl file.. I know that all the normals are pointing in the right direction. I always get the same result, and it still looks better then other materials but it's not transparent. If I make a very large bubble and put a tree in it with a bright light source behind it, I can get a transparency, to a point. I uncheck the double sided option.

This mini-wip's window, has a water shader hooked to the color function, in the internal N.W.N. Is this water shader still on the drawing board for improvement or is there something else I can do to improve it?

The new build is great by the way.. :)

Title: Re: Transparency question
Post by: cyphyr on July 03, 2008, 01:04:08 PM
I'm sure (hope so) that there is room for improvement in the water shader to make it more generally useful.
However a couple of things to remember about the water shader, firstly that the transparency has no end point or thickness. ie you can not have a piece of glass 5mm thick or a foot thick for example. The ray from the camera will be deflected each time it passes through a water/transparent polygon. This means that it will be deflected twice per polygon if you have double sided switched on. Your depth will need to be something huge, beyond the distance to the surrounding background sphere. anything less and the transparent surface will be opaque when viewed against the sky.
Think of it like this. If you hold a piece of glass up in front of you, perpendicular at eye level out doors you can see through it to both near foreground, a couple of meters away and the distance horizon and beyond, several thousand or hundreds of thousands of meters away. In Terragen this is not properly implemented at the moment. The transparency is intended only for shore lines and water edge effects where in almost every case the observer is above the water surface looking down to see a surface beneath the water. Therefore the light ray only gets refracted the once and then comes to a hard stop.
I understand how this works but its a little hard to communicate.
Remember to take all the wave variables to zero and set the transparency to something pretty high like 99%+ and the depth to something HUGE.
Hope this helps
Richard
Title: Re: Transparency question
Post by: Mandrake on July 03, 2008, 03:39:15 PM
Yes, thanks!! That doesn't do squat.. I appreciate your explanation though. :)
Title: Re: Transparency question
Post by: Matt on July 03, 2008, 09:50:19 PM
If you have a piece of geometry that has another face on the other side of the glass, to give it some finite thickness, it will behave more realistically. If there is no face on the other side then it assumes there is water/glass all the way until the ray hits something behind it.

More general transparency effects will be implemented in future, but probably not before the final 2.0 release.

Matt
Title: Re: Transparency question
Post by: Mandrake on July 05, 2008, 09:42:20 AM
Thanks Matt! :)
Title: Re: Transparency question
Post by: Mr_Lamppost on July 06, 2008, 08:40:26 PM
Remember that thread with the windows from a few weeks ago?
http://forums.planetside.co.uk/index.php?topic=3977.0

In order to get transparent windows in your care to work you will need to model them as a separate object.  You will also need to model them with both the outside and inside surfaces, give your windows physical thickness.  Make sure that Double Sided Surface option IS NOT selected for the window object.  Apply the Water Shader to the window object ,remembering to reduce the wave parameters to zero.  If you wasn't to be able to see inside the car also turn off shadow casting for the windows. 

Remember what you see through the class will not be perfect because when the Water Shader is applied to an object it does not smooth the normals when calculating refraction. 
Title: Re: Transparency question
Post by: Mandrake on July 06, 2008, 08:49:13 PM
ML, so you mean the window cant be one poly thick. I have to clone the window points and grow them in to make physical thicknes?
Title: Re: Transparency question
Post by: jo on July 06, 2008, 10:47:42 PM
Hi Mandrake,

Essentially, yes. A polygon doesn't have thickness, it's just an arbitrary plane in space bounded by its edges. Think of it as being infinitely thin :-).

Regards,

Jo
Title: Re: Transparency question
Post by: Mandrake on July 07, 2008, 07:58:23 AM
Man, been bangen my head bout this for a while.. Do both normals for the glass point out?
because usually in the case of a square say looking thru one normal faces you the otherside faces the other way.
Title: Re: Transparency question
Post by: Mr_Lamppost on July 07, 2008, 08:39:53 AM
Yes that's exactly it.  You have to model the glass completely so that it has actual physical thickness, all the normals need to point outwards.  Here's a quick example:

I had to render it using the first alpha (build 1.9.88.1)
When I tried it with the latest version, (build 1.9.98.1), the render would not complete, second image.

The .tgd and test obj are included. Remember to make sure that the Double Sided Surface option is NOT be selected. 
Title: Re: Transparency question
Post by: Mandrake on July 07, 2008, 08:57:20 AM
Excellent!! Thanks ML, Mat and Jo!!
Title: Re: Transparency question
Post by: Mandrake on July 07, 2008, 09:02:43 AM
hmm guess I have to make the whole window, symmetry would have a problem.. unless I have a seam.. worry bout that later.
Title: Re: Transparency question
Post by: bobbystahr on July 07, 2008, 10:36:00 AM
Quote from: Mandrake on July 07, 2008, 09:02:43 AM
hmm guess I have to make the whole window, symmetry would have a problem.. unless I have a seam.. worry bout that later.
Can you not just split the window out and extrude it a small amount? Almost any extrusion should accomplish the needed solid 3D object state as opposed to the 2D plane that it currently is. That's the route I'd take.. ....
Title: Re: Transparency question
Post by: Matt on July 07, 2008, 01:55:00 PM
Quote from: Mr_Lamppost on July 07, 2008, 08:39:53 AM
I had to render it using the first alpha (build 1.9.88.1)
When I tried it with the latest version, (build 1.9.98.1), the render would not complete, second image.

I've managed to get this to stop at exactly the same place in that top-right bucket after just a few minutes. I will find out what's causing it.

Matt
Title: Re: Transparency question
Post by: Mr_Lamppost on July 07, 2008, 03:14:50 PM
Quote from: Matt on July 07, 2008, 01:55:00 PM
I've managed to get this to stop at exactly the same place in that top-right bucket after just a few minutes. I will find out what's causing it.

Matt

I think the problem is in the reflection component, I was having similar problems last week when I used the reflective shader on an object.  I wasn't going to report it until I had done some more tests, I am making these now.  However I needed to mention it as the windscreen example is effected and that is simple enough as a test scene. 
Title: Re: Transparency question
Post by: Mr_Lamppost on July 07, 2008, 08:49:36 PM
It definitely looks to be a problem with reflective shaders attached to objects.

First using a TG sphere object.
Second using an imported object.  Not an actual crash but When I clicked to stop the render TG stopped rendering and had to be closed with the task manager. 
Third: Imported object, no reflective shader.

Test scenes and sphere object are in the zip.

Title: Re: Transparency question
Post by: Matt on July 08, 2008, 08:29:16 AM
I've found the cause of the crash hang, and it's actually been fixed by another bug fix I made a few days ago. It also renders these scenes much faster now that the problem has been fixed. We're aiming for another Tech Preview update very soon.

Matt
Title: Re: Transparency question
Post by: zionner on July 08, 2008, 08:34:07 AM
*Has noticed a much quicker rate of updates :P*
Title: Re: Transparency question
Post by: Mandrake on July 08, 2008, 08:44:58 AM
Quote from: Matt on July 08, 2008, 08:29:16 AM
I've found the cause of the crash hang, and it's actually been fixed by another bug fix I made a few days ago. It also renders these scenes much faster now that the problem has been fixed. We're aiming for another Tech Preview update very soon.

Matt

That's great, I was able to reproduce my own windscreen as ml did, with the same glitch
Title: Re: Transparency question
Post by: rcallicotte on July 08, 2008, 08:54:46 AM
@Matt,

Out of curiosity, is this related to the "block-render missing" error?


Quote from: Matt on July 08, 2008, 08:29:16 AM
I've found the cause of the crash hang, and it's actually been fixed by another bug fix I made a few days ago. It also renders these scenes much faster now that the problem has been fixed. We're aiming for another Tech Preview update very soon.

Matt

Title: Re: Transparency question
Post by: Mr_Lamppost on July 08, 2008, 11:23:04 AM
Quote from: Matt on July 08, 2008, 08:29:16 AM
I've found the cause of the crash hang, and it's actually been fixed by another bug fix I made a few days ago. It also renders these scenes much faster now that the problem has been fixed. We're aiming for another Tech Preview update very soon.

Matt

That's good to hear, I bet you wish all the bugs were like that.  ;D
Title: Re: Transparency question
Post by: Matt on July 08, 2008, 12:15:02 PM
Quote from: calico on July 08, 2008, 08:54:46 AM
@Matt,

Out of curiosity, is this related to the "block-render missing" error?

I don't know at this point :/  It's possible.

Matt
Title: Re: Transparency question
Post by: Matt on July 08, 2008, 12:16:19 PM
ML: You have no idea how much I wish that! :)
Title: Re: Transparency question
Post by: Mandrake on July 18, 2008, 04:26:01 PM
YESSSS!!! The transparency on the windows seem to be working. Nice Build!! PS