Planetside Software Forums

General => Terragen Discussion => Topic started by: archonforest on January 07, 2015, 11:37:25 AM

Title: Coloring glass shader
Post by: archonforest on January 07, 2015, 11:37:25 AM
It is possible to create a for example gold colored glass surface? Like to give a different color to the glass shader?
I tried all kind of possibilities but the color did not changed at all. Any ideas pls?
Title: Re: Coloring glass shader
Post by: j meyer on January 07, 2015, 01:02:08 PM
Seems to be a bit more problematic nowadays with the new refractive
capabilities.That's what some quick tests suggest at least.
So best seems to be to do it like follows:for the glass shader make sure that
double sided is unchecked,then connect your glass shader to input 1 of a merge
shader and the defaultshader (or a surface layer or a constant colour etc) set to
the desired colour to the 2nd input of the merge shader,set the merge shaders
colour mix mode to multiply input by A's diff colour and render.
Most likely you will have to fine tune the colour hue to come closer to what you
want.
Title: Re: Coloring glass shader
Post by: archonforest on January 07, 2015, 01:49:55 PM
Quote from: j meyer on January 07, 2015, 01:02:08 PM
Seems to be a bit more problematic nowadays with the new refractive
capabilities.That's what some quick tests suggest at least.
So best seems to be to do it like follows:for the glass shader make sure that
double sided is unchecked,then connect your glass shader to input 1 of a merge
shader and the defaultshader (or a surface layer or a constant colour etc) set to
the desired colour to the 2nd input of the merge shader,set the merge shaders
colour mix mode to multiply input by A's diff colour and render.
Most likely you will have to fine tune the colour hue to come closer to what you
want.
Danke fur tip :D I am on it...

Title: Re: Coloring glass shader
Post by: Oshyan on January 07, 2015, 04:53:26 PM
Do you want to color the glass "surface", so to speak, or the volume (interior)? What kind of object are you applying the shader to, a "thick" one (like an ice block or a crystal), or a "thin" one (like a window)? For interior (volume), you can just use the Decay Tint and Decay Distance, for a clear, colored crystal-like effect, or Volume Color and Volume Density.

- Oshyan
Title: Re: Coloring glass shader
Post by: archonforest on January 08, 2015, 03:23:57 AM
Quote from: Oshyan on January 07, 2015, 04:53:26 PM
Do you want to color the glass "surface", so to speak, or the volume (interior)? What kind of object are you applying the shader to, a "thick" one (like an ice block or a crystal), or a "thin" one (like a window)? For interior (volume), you can just use the Decay Tint and Decay Distance, for a clear, colored crystal-like effect, or Volume Color and Volume Density.

- Oshyan
It is an object that was made in PS. There was a flat image and I extrude it and saved it as an .obj in PS. Then I imported into TG and replaced the surface shader with the glassy one. It is a relatively thin. Not like a window but thin. I try to color the volume. Like the logo should look like gold crystal/glass or something similar.
The idea of j meyer works to some degree...I got some colors but it is week? The background is blue sky and blue ocean and that amount of blue kinda kills all the colors I made. What kind of numbers should I set for the tint and decay?
Title: Re: Coloring glass shader
Post by: archonforest on January 08, 2015, 05:13:41 AM
There is something odd here. See attached pix. I zoomed in onto the logo and did a render. TG did not rendered the water shader that is behind the glassy part. ???
Title: Re: Coloring glass shader
Post by: russe166 on January 08, 2015, 06:21:45 AM
Hi!

Try to set the 'Ray detail multiplier' from 0,25 to 1. You can find it in the 'Render subdiv settings' (klick the little cross on the Render node)

Title: Re: Coloring glass shader
Post by: archonforest on January 08, 2015, 07:16:20 AM
Quote from: russe166 on January 08, 2015, 06:21:45 AM
Hi!

Try to set the 'Ray detail multiplier' from 0,25 to 1. You can find it in the 'Render subdiv settings' (klick the little cross on the Render node)
Thx for the tip. I tried with "1" but changed nothing really on the render.
Title: Re: Coloring glass shader
Post by: russe166 on January 08, 2015, 08:57:31 AM
Oh! I have no idea :(
I've attached an example file and maybe someone else knows the answer?
Title: Re: Coloring glass shader
Post by: archonforest on January 08, 2015, 09:13:39 AM
Thanks. yours looks better...hmmm...i will download your file an see what is the difference here...
Title: Re: Coloring glass shader
Post by: j meyer on January 08, 2015, 12:28:41 PM
Oshyan - the volume color and density do behave a bit strange compared
             to the pre-glass shader era.At least with TG's cube and sphere.
Title: Re: Coloring glass shader
Post by: archonforest on January 08, 2015, 12:55:46 PM
Btw jm your idea actually works. I played around with the settings and got some gold-yellow colored glassy surface. I am fine tuning the color now...hope the client will be happy with it ::)
Title: Re: Coloring glass shader
Post by: j meyer on January 08, 2015, 02:06:53 PM
 :) Cool,and good luck!
Title: Re: Coloring glass shader
Post by: Oshyan on January 08, 2015, 05:14:51 PM
j meyer, have you tested this with exact same settings/scene in 3.2 and previous versions(s)? What exactly are the differences you're seeing?

- Oshyan
Title: Re: Coloring glass shader
Post by: j meyer on January 09, 2015, 10:24:08 AM
No,not the exact same settings/scene,not yet.
The effect I saw is hard to describe.
Will do some more tests tonight and then post images.
Title: Re: Coloring glass shader
Post by: Oshyan on January 09, 2015, 06:55:55 PM
Sounds good, please do!

- Oshyan
Title: Re: Coloring glass shader
Post by: j meyer on January 10, 2015, 11:33:33 AM
Spent several hours last night testing with procedural and imported objects
in TG 3.2.03 and TG 3.1.02 and even TG 2.5 and could refresh my memory and
got the answers to some questions that were not discussed here.
I won't go into everything to not confuse you too much hopefully.

The issues I perceived the other day can be illustrated with images from the
latest version (TG 3.2.03) alone I think.

[attach=1]

You'll notice that difference in the volume density values.That's because the
water shader has a range from 0 to 10 by default while the glass shader's
range goes from 0 to 1000.
With double sided checked (which gives the same glass effect like the water
shader method) you can crank the value all the way up and won't see any
color.As you can see in row #2 the procedurals show some weird light blue
plane effect.
In row #3 the procedurals just show some grainy noise.

For the sake of completeness a comparison between TG 3.1 and 3.2.

[attach=2]

Hope that's good enough an illustration of the issues.

Title: Re: Coloring glass shader
Post by: j meyer on January 10, 2015, 11:42:45 AM
One more thing I want to show although it has nothing to do with
coloring the glass shader.
This image depicts the reason for using the water shader in conjunction
with a reflective shader instead of using the water shader's reflection
feature.

[attach=1]

Hope you don't mind,but since it's related to glass effects in TG I
thought it's better here than making a new thread.
Title: Re: Coloring glass shader
Post by: archonforest on January 10, 2015, 12:17:16 PM
great stuff dude. I learned something :)
Title: Re: Coloring glass shader
Post by: archonforest on January 10, 2015, 01:13:19 PM
If I apply the default glass shader to a built in sphere it looks very glassy. If I apply the same default glass shader into an imported object I got some very dark looking non kinda glassy object. Why is that? Maybe my imported obj is wrong or something?
Title: Re: Coloring glass shader
Post by: j meyer on January 10, 2015, 01:44:49 PM
Hard to say without knowing your object or the way you connected things.
Title: Re: Coloring glass shader
Post by: archonforest on January 10, 2015, 01:56:33 PM
Quote from: j meyer on January 10, 2015, 01:44:49 PM
Hard to say without knowing your object or the way you connected things.

Yeah sure...
Well the object was made via PS. I had a tiff file with some white shape on it. I extruded in PS and saved as .obj. Then exported into TG. Connected the glass shader directly to the surface shader of the object. Is this enough info as I cannot give out the object itself...
Title: Re: Coloring glass shader
Post by: j meyer on January 10, 2015, 02:08:35 PM
Well I don't know anything about PS generated meshes.
In case surface shader of the model means the default shader that's
connected to the grey part node try it without the default shader.
Beyond that I have no idea at the moment,sorry.
Title: Re: Coloring glass shader
Post by: archonforest on January 10, 2015, 02:40:15 PM
Okay got it.
I uploaded a test file if anybody can look at it and perhaps tell me why the object is not see through glassy?
I have a feeling that the object itself is wrongly made... ??? Anycow any input is appreciated :)
Title: Re: Coloring glass shader
Post by: archonforest on January 10, 2015, 03:04:31 PM
Well never mind... I used an in build object that is in PS3d and that worked okay in TG with the default glass shader :)
So looks like the object I made (not build in in PS) was saved with a shader and that created the problem for TG :D
Title: Re: Coloring glass shader
Post by: Dune on January 11, 2015, 03:53:22 AM
Interesting tests, Jochen. Thanks for that. It seems like an imported sphere is nicer, less grainy, and I suspect that's because it's rendered in a RT manner, while the TG sphere is rendered differently. Something that would still need some improvement is the darkness of the shadows through a near transparent object. And seeing foam on other sides of waves  ;)
Title: Re: Coloring glass shader
Post by: j meyer on January 11, 2015, 10:18:38 AM
Attila - After thinking about your problem again I came to the conclusion
          that it might be caused by flipped normals.While these are supposed
          to render correct on a shaded object thea may cause problems with
          reflections and so on.
          Quote from the change log:
          On surfaces that have inverted normals, diffuse lighting now renders as though the normals were not inverted. Flipped normals may still have consequences for other types of shading, such as reflection and refraction.

           So maybe it's that.
Title: Re: Coloring glass shader
Post by: archonforest on January 11, 2015, 10:53:49 AM
Quote from: j meyer on January 11, 2015, 10:18:38 AM
Attila - After thinking about your problem again I came to the conclusion
          that it might be caused by flipped normals.While these are supposed
          to render correct on a shaded object thea may cause problems with
          reflections and so on.
          Quote from the change log:
          On surfaces that have inverted normals, diffuse lighting now renders as though the normals were not inverted. Flipped normals may still have consequences for other types of shading, such as reflection and refraction.

           So maybe it's that.
Thx a lot for the info. I will chk it out. Mean time I managed to work around and played with the glass sliders and got pleasing results. The only thing still puzzles me that why TG is not rendering the scene that is behind the glass...


Title: Re: Coloring glass shader
Post by: Kadri on January 11, 2015, 11:01:07 AM

Nice thread with good info guys.
Title: Re: Coloring glass shader
Post by: Dune on January 11, 2015, 11:52:35 AM
QuoteThe only thing still puzzles me that why TG is not rendering the scene that is behind the glass...

It does doesn't it? I see stuff through the glass. But if you mean; why doesn't it render in high detail, then the answer is in the render subdivision settings (which are inside the render shader, and default at 0.25). Make it 1 and it's perfect, though takes longer to render.
Title: Re: Coloring glass shader
Post by: archonforest on January 11, 2015, 01:27:38 PM
Quote from: Dune on January 11, 2015, 11:52:35 AM
QuoteThe only thing still puzzles me that why TG is not rendering the scene that is behind the glass...

It does doesn't it? I see stuff through the glass. But if you mean; why doesn't it render in high detail, then the answer is in the render subdivision settings (which are inside the render shader, and default at 0.25). Make it 1 and it's perfect, though takes longer to render.
Thx for your input. Yes it does but stays lo-res. I already tried to increase render subdiv to 1 but did not changed anything. I will crank it a bit now...

Update. Dune you were right. Tried again with 1 and it worked well. Not sure what was wrong yesterday when I tried with 1 but who cares as now all good!
Title: Re: Coloring glass shader
Post by: Matt on January 11, 2015, 05:26:16 PM
Quote from: j meyer on January 10, 2015, 11:33:33 AM
You'll notice that difference in the volume density values.That's because the
water shader has a range from 0 to 10 by default while the glass shader's
range goes from 0 to 1000.

The shaders have different slider ranges, but the strength of the volume density setting should be the same in each shader. I don't know why the 3 images on the 1st row appear to have the same density. It looks like the density setting isn't having any effect. Is there some reason you used 10x the density on the built-in objects versus the imported sphere? Could you repeat each of those 1st row tests with different values?

Quote
With double sided checked (which gives the same glass effect like the water
shader method) you can crank the value all the way up and won't see any
color.As you can see in row #2 the procedurals show some weird light blue
plane effect.

The volume density and decay distance aren't designed to be used when double-sided is enabled on the glass shader, because double-sided means the object has no volume. (If it were to render as a volume it would break its ability to render open surfaces as sheets of glass, which is the main reason for the double-side setting IMO.) I'll investigate the weird blue stuff on the built-in sphere and cube.

Quote
In row #3 the procedurals just show some grainy noise.

The volume settings don't work well with shadow-casting objects, I'm afraid. Since the object's surface is casting a shadow, the whole of the volume should be in shadow, but due to other things going on in the renderer some parts of the surface are picking up unshadowed light on the light-facing sides.

Matt
Title: Re: Coloring glass shader
Post by: Matt on January 11, 2015, 05:38:35 PM
Quote from: j meyer on January 10, 2015, 11:42:45 AM
One more thing I want to show although it has nothing to do with
coloring the glass shader.
This image depicts the reason for using the water shader in conjunction
with a reflective shader instead of using the water shader's reflection
feature.

[attach=1]

Hope you don't mind,but since it's related to glass effects in TG I
thought it's better here than making a new thread.

It looks to me like you want to tint the transparency, but not produce any refraction. You can use the Glass Shader and tint its transparency directly with the transparency colour. It doesn't change with depth like the decay and volume settings do, but you probably don't need it to if you're rendering a piece of glass that's thin enough not to produce refraction.

Matt
Title: Re: Coloring glass shader
Post by: j meyer on January 12, 2015, 12:21:46 PM
QuoteThe shaders have different slider ranges, but the strength of the volume density setting should be the same in each shader. I don't know why the 3 images on the 1st row appear to have the same density. It looks like the density setting isn't having any effect. Is there some reason you used 10x the density on the built-in objects versus the imported sphere? Could you repeat each of those 1st row tests with different values?

The reason I used 10x the density was that I wanted to have the same amount of color on the
procedurals and I naively thought that would be the right way,because 2.88906 was too weak
with the glass shader.And I even thought it was 100x the value btw.
And yes,I can and will repeat those with different values later today.

QuoteThe volume density and decay distance aren't designed to be used when double-sided is enabled on the glass shader, because double-sided means the object has no volume. (If it were to render as a volume it would break its ability to render open surfaces as sheets of glass, which is the main reason for the double-side setting IMO.) I'll investigate the weird blue stuff on the built-in sphere and cube.

That was done for demo-purposes solely.Especially as I told Oshyan I had observed something
weird going on.
Thanks for the explanation,though.

QuoteThe volume settings don't work well with shadow-casting objects, I'm afraid. Since the object's surface is casting a shadow, the whole of the volume should be in shadow, but due to other things going on in the renderer some parts of the surface are picking up unshadowed light on the light-facing sides.

Demo-purposes again.Seems to be related to what we saw earlier (TG2).The black spots.

Edit: just noticed that there might be a mistake in the inscription of the image.
        Will check that also.




Title: Re: Coloring glass shader
Post by: j meyer on January 12, 2015, 12:38:34 PM
QuoteIt looks to me like you want to tint the transparency, but not produce any refraction. You can use the Glass Shader and tint its transparency directly with the transparency colour. It doesn't change with depth like the decay and volume settings do, but you probably don't need it to if you're rendering a piece of glass that's thin enough not to produce refraction.

That post was admittingly somewhat confusing maybe.
I wanted to show why it was better not to use the reflection features of the water shader to
mimic glass (windows and so on) in the pre glass shader era.
I ran into some issues long ago and then after a while forgot why I used the two shaders
instead of using the water shader's build in reflections,like some of the others did.
And these tests reminded me and so I rendered that example.
Also reminded me why to leave the refraction at 1 for the water shader,even when using
the additional refl shader.(anything goes black)

Sorry for being confusing,
and thanks again for your explanations.
Title: Re: Coloring glass shader
Post by: j meyer on January 12, 2015, 05:26:12 PM
Indeed the inscription of the comparison image was wrong.
Here is the corrected version.

[attach=1]

The corrected version should be sufficient enough to explain this:
QuoteThe shaders have different slider ranges, but the strength of the volume density setting should be the same in each shader. I don't know why the 3 images on the 1st row appear to have the same density. It looks like the density setting isn't having any effect. Is there some reason you used 10x the density on the built-in objects versus the imported sphere? Could you repeat each of those 1st row tests with different values?

I think rendering the first row with different values is consequently not necessary anymore.

I did render all three objects with the glass shader,double sided unchecked and a volume
density of 2.88906,though.And of course you were right that it is not required to set it to
a value 10x or 100x stronger.
I was just assuming that,because of the different ranges of the sliders.

[attach=2]

The inscription was done after several hours of testing and deinstalling and reinstalling and I
got too tired obviously.
Again I'm sorry to have caused confusion.
Title: Re: Coloring glass shader
Post by: Matt on January 14, 2015, 12:36:27 AM
No problem. Thanks for updating the annotations. That all makes sense now.

Matt
Title: Re: Coloring glass shader
Post by: j meyer on January 14, 2015, 12:43:23 PM
Thank you for making me aware of my mistake.
Title: Re: Coloring glass shader
Post by: bobbystahr on January 14, 2015, 04:52:11 PM
This thread is so polite it's almost Canadian, hee hee hee...and interesting as well