[attachimg=1]
Hi everybody,
I want to show you one of the features I was working on for the upcoming Terragen v3.2. It's a new Glass Shader.
There were a number of problems with rendering transparent materials in TG. You've been reminding me of this for years! I set out to fix that. You can apply the new Glass Shader (or the Water Shader like before) to a variety of objects and get much better results than before.
Along the way I thought there should be a dedicated "Glass Shader" that has better defaults for glass and similar-looking materials. It has most of the important settings from the Reflective Shader (except for some of the lesser-used options, because I wanted to simplify it), combined with the subsurface features of the Water Shader, so you can make things like smoky or tinted glass.
It also has a setting to control whether the object's surface is treated as an infinitely thin volume without refraction instead of an interface into or out of a volume. You might turn this on for window panes, for example, or turn it off for gemstones and blocks of ice. It works independently of the index of refraction value.
By the way, the "caustics" in this render are not really caustics. They are simply GISD doing its thing.
We'll release v3.2 very soon :)
Matt
GIMMIE! ;D
Seriously, though, I was just going over on how to create glass. Good timing! 8)
Thank you................. ;D
Question. Can this shader become heavy upon render time?
As far as I tested it, it doesn't make any difference with the water shader, it mostly depends on the displacements, like before. So, not hugely more at all.
That make sense because the more displacements, the more light refractions have to calculate due to the surface variations if I am understanding this correctly.
Oh, that's great! :D
May I ask whether there is also an option for the shadows?
3.2 soon? Nice :)
Very nice bit of news!
What does the render look like form inside the glasses looking out? And does any change need to be made to settings, or can you move the camera in and outside with out making any changes and still get a proper look?
Quote from: russe166 on November 26, 2014, 04:23:08 AM
Oh, that's great! :D
May I ask whether there is also an option for the shadows?
You can turn an object's shadows on and off, as normal. But the shader doesn't change the shadows. To render this sort of thing properly you need to be able to render caustics, which Terragen doesn't do yet. I will think about adding some options that can change the look of glass shadows in future.
Matt
Quote from: TheBadger on November 26, 2014, 02:44:35 PM
Very nice bit of news!
What does the render look like form inside the glasses looking out? And does any change need to be made to settings, or can you move the camera in and outside with out making any changes and still get a proper look?
Do you mean as if it's embedded in the glass material? It should still render the refraction correctly as long as the object normals are correct, but it won't render the internal volume density or decay (attenuation according to Beer's law) which only work when the camera is looking into the object from the outside.
Matt
Matt, I am in the midst of struggling with this problem of getting transparency to work on a project, specifically, windows on a house. I just so happened to search for and read a thread about how to use the water shader for this purpose just yesterday. So far I have not gotten it to work. The new shader will be very much appreciated indeed! I'll let my director know that this feature is in the works.
Using Terragen for an upcoming project seemed as though it was going to depend on having this feature. supporting transparency is very important indeed.
Have you given any thought to supporting luminance? It's not as important but I needed it yesterday (quite literally).
Materials already support luminance, and luminance affects GI as well. Or did you mean somehow related specifically to transparency?
- Oshyan
Quote from: Oshyan on November 26, 2014, 05:53:04 PMMaterials already support luminance, and luminance affects GI as well.
I have an object that has a luminous surface that I converted to an OBJ and then imported to TG. I was assuming that luminance was being carried over into the model and because the surface was not luminous in the render I concluded that TG was not supporting luminosity. Well, I just went into the model's node tree and saw the Luminosity parameter was set to 0. After setting it to 100 and then rendering I see now that it is working. That is wonderful.
I did some more work/research and discovered that it is the "Ke" parameter in the MTL (stands for "material"?) file accompanying the OBJ that encodes luminosity in the object's surface (i.e. "material"). A value of "1" apparently represent 100% because that's what I had the luminosity set to in my modeler. So it looks to me now that the OBJ reader ignores this parameter when it reads in the OBJ and sets the luminosity to 0 making it necessary for me to set the value manually. Perhaps this is why transparency wasn't working for me earlier.
Yes, importing of parameters from external formats isn't always perfect.
- Oshyan
Will the new glass shader do "stained glass"? That is to say, is Matt telling us that the glass can be colored and translucent? I suppose glass with surface relief is a given after applying a sort of displacement shader.
The existing water shader can already be colored. You can even color it by a color function (Volume 1 Color Function input on the Water Shader). So yes. :D
- Oshyan
Quote from: Matt on November 26, 2014, 05:34:45 PM
Quote from: TheBadger on November 26, 2014, 02:44:35 PM
Very nice bit of news!
What does the render look like form inside the glasses looking out? And does any change need to be made to settings, or can you move the camera in and outside with out making any changes and still get a proper look?
Do you mean as if it's embedded in the glass material? It should still render the refraction correctly as long as the object normals are correct, but it won't render the internal volume density or decay (attenuation according to Beer's law) which only work when the camera is looking into the object from the outside.
Matt
Hi and thanks,
I meant if I took your TGD as is, and just moved the camera inside the open area of the glass (where liquid would be), and hit render, would it work the same as looking through it as from the out side? or do you have to make changes to the glass shader settings?
Because before I had to make changes to the "glass" when rendering from inside V outside, As in this thread:
http://www.planetside.co.uk/forums/index.php/topic,15003.30.html
But from the looks of your image, it looks like a real change/fix. So just wanted to ask.
It all depends on the object. These glass models have thickness modeled into them, so putting the camera where the liquid would be it's still on the "outside" of the glass. With polygon models the renderer has to guess what's "inside" and "outside" by looking at the normals. If you just have a plane and you move the camera to the other side of the plane, then you're on the "inside". But the Glass Shader has a checkbox for that situation so it can treat it as though it's still on the outside.
Matt
I just discovered that Terragen also seems to ignore the transparency parameter(s) in the MTL file for an OBJ that is read in with the OBJ reader. I just manually turned down the opacity value (seems to be always initialized to 100%) in the shader that the Terragen OBJ reader created for a surface described in the MTL file that is supposed to be glass . Once I did this the surface became transparent when rendered. So, apparently, transparency does work at least sometimes in Terragen. But I think the OBJ reader needs to be worked on so that it reads and stores the parameters taken from the MTL file and used to initialize the appropriate values in the shader nodes created for the object's surfaces.
Later....
I just tried 50% opacity and it seems to render as though it were 100% opaque so transparency doesn't work in all cases.
It's not really transparency (as in glass) that is in the opacity tab, it's just on and off (invisible), and not gradual, so 49% will still be off and 51% be on.
Will there be support for ACES in v3.2?
Quote from: Dune on November 27, 2014, 02:55:37 AMIt's not really transparency (as in glass) that is in the opacity tab, it's just on and off (invisible), and not gradual, so 49% will still be off and 51% be on.
Thanks. That's pretty much what I observed. It's rounding up which makes sense since 50% or greater in fixed-point binary is "0.1####..." and 49.9999% is "0.0####...".
After trying to get transparency by creating a texture with Alpha channel it looks like TG handles that the same way as Opacity (all or none). Seems I'll be waiting on the Glass Shader that Matt is working on unless I can get the Water Shader working for me.
The usual workaround is connecting the water shader to the child
input of a surface layer and mask that surface layer,thus you can
fake some sort of greyscale opacity.A search might help,too.
Quote from: PabloMack on November 27, 2014, 12:32:47 PM
After trying to get transparency by creating a texture with Alpha channel it looks like TG handles that the same way as Opacity (all or none). Seems I'll be waiting on the Glass Shader that Matt is working on unless I can get the Water Shader working for me.
Try this thread:
http://www.planetside.co.uk/forums/index.php/topic,18342.msg178034.html#msg178034
We have no immediate plans to support ACES. Terragen outputs to 16bit/channel EXR (48bit color) with floating point precision and no gamma applied. Thus you can apply any color conversion you would like in post processing/compositing/etc.
- Oshyan
This will come in handy. Thank you!
Just seeing this. Late for the train. +1!
Having some fun with the new shader. But I have a question. The light seems to have a hard time propagating through the glass. Is there some parameter that governs it? I have decay distance set to 150.
Yes, seems like there's no shadow inside. Did you use one-sided or double sided? Maybe that makes a difference, don't know actually.
Seems to be the cast shadows thing again.
Light won't pass through an object as long as
it(the object) can cast shadows.
Of course you won't have a dropshadow then.
Quote from: j meyer on December 17, 2014, 12:03:37 PM
Seems to be the cast shadows thing again.
Light won't pass through an object as long as
it(the object) can cast shadows.
Of course you won't have a dropshadow then.
Given that it is glass, it shouldn't really have a drop shadow to begin with, or at least, should not be anywhere near as strong as it is.
Quote from: j meyer on December 17, 2014, 12:03:37 PM
Seems to be the cast shadows thing again.
Spot on. Unchecked cast shadows on the sphere which fixed the problem. Thank you! But shouldn't there be a light shadow as the light gets refracted hitting the sphere?
Quote from: otakar on December 17, 2014, 05:27:56 PM
Quote from: j meyer on December 17, 2014, 12:03:37 PM
Seems to be the cast shadows thing again.
Spot on. Unchecked cast shadows on the sphere which fixed the problem. Thank you! But shouldn't there be a light shadow as the light gets refracted hitting the sphere?
TG doesn't support caustics (not yet, and likely not in the near future), but yes, there should. This looks a lot better, though.
Got just one thing to say - bottoms up!
Here is a problem I already mentioned in the subsurface scattering thread:
http://www.planetside.co.uk/forums/index.php/topic,19199.msg189265.html#msg189265
When you put a solid object with a glass (or water-) shader attached behind parts of another solid object that has a glass shader as well, the occluded parts render black (see attached image).
I tried all combinations of shader/object doublesided on/off as well as cast shadows on/off. The only solution I found in the thread I mentioned above for my beer was to uncheck "visible to other rays", but in my other tests this didn't work: the object inside rendered correctly, but the glass of the outer object turned black. Wonder why this worked with the beer?!
Any suggestions or ideas?