Planetside Software Forums

General => Terragen Discussion => Topic started by: gregsandor on January 21, 2014, 08:49:40 PM

Title: Glass Shader
Post by: gregsandor on January 21, 2014, 08:49:40 PM
I've been trying to get a decent glass shader working, based on a water shader.  My window glass is fully modeled (not just a single poly), double sided render is off.

When it renders, blotchy black artifacts appear.  Also, how do I allow some light to pass through so shadows cast by the glass are not fully shadowed, but only by the inverse of the opacity of the glass?
Title: Re: Glass Shader
Post by: TheBadger on January 21, 2014, 09:08:59 PM
It would be very nice to have a real glass shader, Instead of using the water trick. The water shader is to limited in what you can do with it as glass. Or requires a ton of playing to get it to work well anyway. And people try to make glass a lot around here.
Title: Re: Glass Shader
Post by: j meyer on January 22, 2014, 09:54:21 AM
One thing to remember would be to set the decay distance of the water
shader to 1e+010.
Fully modelled can cause more trouble than two panes that are not
connected.And each pane should have polies on one side and a hole
on the other,so that they are not doublesided.(judging from my experience)
As far as I know there still is no way to get the transparency affecting the
shadows.(of course you could render without the glass parts and another
pass with the glass and comp it,but...oh well)
Title: Re: Glass Shader
Post by: gregsandor on January 22, 2014, 03:50:11 PM
Quote from: j meyer on January 22, 2014, 09:54:21 AM
... each pane should have polies on one side and a hole on the other,so that they are not doublesided ...

What do you mean by this?
Title: Re: Glass Shader
Post by: gregsandor on January 22, 2014, 03:52:16 PM
Here's the result with 6-sided panes:
Title: Re: Glass Shader
Post by: TheBadger on January 22, 2014, 04:04:34 PM
Correct me if Im wrong, J. But you mean is should be 5 sided? So that there is not an extra polygon on the inside, right?

It looks good Greg. But its to dark I think. And then there is the part on the far right that is so clear its as though nothing is there at all. THis is the primary problem with the water shader. Its inconstant, and changes with the light.

I had some luck using one polygon plain, it seemed to work better than the 6 sided I tried. But there were still problems. http://www.planetside.co.uk/forums/index.php/topic,15003.msg148185.html?PHPSESSID=fdcc073f924ae32981fa0b1f088ebecd#msg148185

We need a glass shader. The idea of Terragen being used for architectural visualization is kinda hard without glass that works right in all lighting.
That is if I understand the problem here, which I thought I did.

nice looking model by the way.
Title: Re: Glass Shader
Post by: gregsandor on January 22, 2014, 04:17:09 PM
Some of the darkness I think is because it is fully shadowing the interior of the building; it might as well be solid brick. What do Volume 1 Density and Color do?  Would that affect the look?  Also I don't like the blotchy artifacts that show up.
Title: Re: Glass Shader
Post by: gregsandor on January 22, 2014, 04:25:55 PM
Here i tried to recreate Dandelo's (or yours) setup with the watershader as a child of a surface layer - notice the fuzzy interior.  (have either of you posted a clip file of that setup?)
Title: Re: Glass Shader
Post by: TheBadger on January 22, 2014, 04:33:19 PM
The last page of the link has a clip from Dune, and one from me too. Dune shows how some changes to what I did helps.
DandelO has a thread  where he uses a bee and its wings to demonstrate his thinking (there should be a link in my link, or one on  the first page of this part of the forum). I simply used DandelO's brain and applied it to what I was doing. If I remember right, I got better results when I used DandelO's method of adding a texture to the glass, but I went for a more aged unkept look. I dont know if that will be good for you here. *The point is that in a situation where the glass will be too clear and one where its too dark, can be compensated for by adding a dirt texture. So it will be visible that there is glass there when its clear, and when you back light it. SO it will work for more angles.

Quote from: gregsandor on January 22, 2014, 04:17:09 PM
Some of the darkness I think is because it is fully shadowing the interior of the building; it might as well be solid brick. What do Volume 1 Density and Color do?  Would that affect the look?  Also I don't like the blotchy artifacts that show up.

Well you can always add light sources to the inside of the building, which will help with the darkness part. But that has issues too and will require a fair amount of tweaking. And all that is dependent on the cameras position, relative to the glass, relative to the sun.
Sorry Greg, I haven't done glass in a while. I don't remember what effect if any Volume 1 Density and Color had. I have been modeling buildings that don't have glass lately.


*Ah yes, check the first page of my link. It has links to all the threads by others that I used.
Title: Re: Glass Shader
Post by: gregsandor on January 22, 2014, 04:45:39 PM
Okay, Ive attached Dune's water shader in that thread to your masking setup.  Still dark.
Title: Re: Glass Shader
Post by: TheBadger on January 22, 2014, 11:52:05 PM
Yep like I said, we need a glass shader.

You should put some light on behind the windows?
Title: Re: Glass Shader
Post by: Kadri on January 23, 2014, 12:08:02 AM

Gregsandor did you tried basic planes?
Just curious because TG3 is probably trying to make all sides of your object to be transparent.
You may get this to work but i would not press TG3 to hard on this as it is.
I had mostly problems with this kind of renders.
Title: Re: Glass Shader
Post by: dandelO on January 23, 2014, 08:40:58 AM
Hi, Greg.
I have problems with some objects and a transparency shader, generally, though, ray-traced objects tend to work fine for me. Thd built-in sphere renders noisy, black spots when atmosphere passes through it but a RT rock object renders that fine.
In all these GI tests following, the spheres are built-in rock objects and the tabletop they're sitting on is a 6 sided cube object, just like your windows, the transparency shader rendered them all fine.

Volume 1 Colour/Density creates a faked 'milky' effect, colour is self explanatory, density is how 'thick' the 'milkiness' appears. Imagine a muddy puddle, you can see through the water only so far until the mud volume obscures the transparency. However, there's a problem with the 'volumetric' shadowing in the water shader, in that the shadows appear very noisy along the edges, there are no quality settings, that I know of, that can reduce the noise. Raising render detail/ray detail maybe but that can't really be called a 'fix' as even full quality settings does not remove the noise and it's really wasteful of render time to go even higher. The error/effect looks similar to Soft-Shadows lacking samples on regular surfaces, noisy blurring, no smooth falloff. A water volume quality slider would be a handy thing here but I don't know how easy that would be to implement. The Water Shader 'volume' is a fake 2D approximation, not a full 3D volumetric effect.
Title: Re: Glass Shader
Post by: dandelO on January 23, 2014, 09:34:38 AM
Plane and rock objects. There's no volume density on the left, 0.1 in the middle and 1 on the right. The volume settings are pretty much unusable when there are objects casting shadows into it, see the noise as volume density increases. Render detail at 0.8/AA=4. A ridiculous increas in detail would be required to clean that up!
Rendering a RTE version to test the shadow noise with that,

* Btw, in your glass object, are you unchecking Casts Shadows? You should.
Title: Re: Glass Shader
Post by: dandelO on January 23, 2014, 09:38:46 AM
* Ray tracing the water volume doesn't held remove all the noise, although it's better, it's still nowhere near usable. :/
Title: Re: Glass Shader
Post by: dandelO on January 23, 2014, 10:37:36 AM
On testing transparency on a built-in Rock Vs. Sphere, I'm getting the black artefacts on both now in an open to the atmosphere setup. Interesting that my indoor Rocks work fine, Spheres didn't, black artefacts again. Maybe it only occurs when atmosphere is behind the transparent surface? And then maybe only on curved surfaces? I'll try one planar Vs. Multipolygonal surface with open atmosphere behind them shortly...
Sphere left, Rock right.
Title: Re: Glass Shader
Post by: j meyer on January 23, 2014, 11:29:48 AM
Quote from: gregsandor on January 22, 2014, 03:50:11 PM
Quote from: j meyer on January 22, 2014, 09:54:21 AM
... each pane should have polies on one side and a hole on the other,so that they are not doublesided ...

What do you mean by this?

In your 6-sided panes example you have 2 big sides and 4 smaller ones,representing
the edges of the pane.My suggestion was removing the 4 small sides.That would leave
you with the 2 big sides and those would be doublesided polygons,but you'd want them
to be singlesided.To make them singlesided - in some apps - you'd have to assign a
hole to one side (the inner sides in this case).
I don't know how this is called in your app,sorry.
Hope it's a bit clearer now.
Title: Re: Glass Shader
Post by: Seth on January 23, 2014, 02:17:10 PM
that's why i dig up that old post lately : http://www.planetside.co.uk/forums/index.php/topic,9943.msg169392.html#msg169392
Title: Re: Glass Shader
Post by: gregsandor on January 23, 2014, 05:37:03 PM
I removed the outer polygons from each pane and re-rendered with no other changes to the scene posted above.  There is no difference between 6-poly and 2-poly glass in the final result. 
Title: Re: Glass Shader
Post by: fleetwood on January 23, 2014, 05:37:39 PM
Don't know if this would help, but you might look at this post which includes the TGD.
What index of refraction are you using in your water shader ?

http://www.planetside.co.uk/forums/index.php/topic,11822.msg119715.html#msg119715 (http://www.planetside.co.uk/forums/index.php/topic,11822.msg119715.html#msg119715)
Title: Re: Glass Shader
Post by: gregsandor on January 23, 2014, 07:03:34 PM
Quote from: fleetwood on January 23, 2014, 05:37:39 PM
What index of refraction are you using in your water shader ?

1.51
Title: Re: Glass Shader
Post by: fleetwood on January 23, 2014, 08:01:34 PM
You might try a test with simple 1.0 and see what the result is. In doing a car windshield I found that it was better to forget about real glass at 1.5 . This isn't a true physical object render so 1.5 may create distortion that doesn't end up looking "real".
Title: Re: Glass Shader
Post by: dandelO on January 24, 2014, 02:09:09 AM
Franck, yep, since v2.1.

An IOR of 1 will actually remove any distortion, not create any, in the transparency, making a perfectly transparent surface where the back and foreview line up exactly. It's a good idea to do that. That's how I did the bee wings, mentioned earlier. Tinx increments of 0.01 are best to add above 1 to have a decent 'glass' type effect, but only when some small shift is needed, when the glass-edge is open, for example, window panes, with a frame around all edges are best left at 1, indeed, as you don't really percieve the refraction then anyway.
Would be handy if it just 'worked', like it used to, though! ;)
Title: Re: Glass Shader
Post by: Matt on January 27, 2014, 07:08:09 PM
I'll take a look at the noise problem.

Matt