Super Fly Coloured Glass

  • @bagginsbill said in Super Fly Coloured Glass:

    Here ya go. This is the proper way to do colored tricky glass. You apply the color to the volume, not the surfaces.


    That is just so elegant, like an equation, simple but profound.

    I feel your pain about RDNA there was so much there that just evaporated, really, really sad.

    But thank you so much for this! Off to make my bottles look right!


  • @ghostship said in Super Fly Coloured Glass:

    @amethystpendant have you tried my free shader for this yet?

    Hi @ghostship, I certainly have and use it all the time! Wasn't sure what settings to use for coloured glass though which is why I asked here.

    BTW if you are doing another version could you add inputs to your bump settings so we can easily change the weave density etc, I know I can do it by opening the compound node, but I'm lazy ;)


  • @amethystpendant just set refract to 1 and choose a color for "refract color." it does not have volume absorption like BB's shader so go with his if that's what you need.

    I guess I could expand the bump plug-in node to have more options...

  • Poser Ambassadors

    In case somebody is reading this and doesn't grasp the significance of "Tricky" Glass, nor the significance of Volume attenuation, here's a comparison.

    On the left, using colored Refraction (in fact, this is GhostShip's Uber shader).
    On the right, tricky glass combining volume color attenuation and transparency for light passing through.

    The shadow with Tricky Glass is not black - instead it adopts the volume coloring and so some light goes through. This is not exactly correct as a true caustic calculation, but it's WAY cheaper for render time and it's certainly much better than black. You don't have to enable caustics and wait 48 hours for convergence. Unless you're making a render that is all about the caustics, you don't need caustics. Few would notice.

    The other thing to notice is that the deepness of the color depends on how thick the volume is. For the thinner parts, the glass is closer to clear than the thick parts. That's the Beer-Lambert law in action. Google it for details.

    0_1487085488449_Tricky Glass.jpg

    You can also see the Beer-Lambert back-lighting effect here:

    0_1487085563710_Stanford Buddha.jpg

  • @bagginsbill Stunning! A great demonstration


  • @bagginsbill

    Sorry tried to edit my last post but couldn't :(

    Do you have to have Volume Bounces and Samples set for your coloured tricky glass to work?

  • Poser Ambassadors

    @amethystpendant said in Super Fly Coloured Glass:

    Do you have to have Volume Bounces and Samples set for your coloured tricky glass to work?

    I believe you don't. Volume bounces and samples affect volume scattering, not volume attenuation.

    Scattering involves aborting an internal ray passing through the volume as if a particle got in the way.

    Attenuation is an effect that happens based only on distance traveled in the volume, which can be calculated without introducing more samples along the way. A straight line will do.

    The AbsorptionVolume node is calculating attenuation.

  • @bagginsbill yep. Your glass is better and is even casting a colored shadow.

  • @bagginsbill Yes, that's exactly what I was wondering. Thanks for the explanation.

  • @bagginsbill I used your material on two primitives (ball cone and open cylinder) with a single spotlight and a backdrop. It seems to me that, although the transparent shadow is fine, the glass itself looks way too dark.
    These are my render settings. Anything wrong with that?

  • @oldenburg adjust the density on the absorption node to taste.

  • Poser Ambassadors

    Your max bounces is 3. It takes 4 bounces to get all the way through both walls of a cylinder or glass. It takes more than that to get through other more complicated shapes and angles, like a glass Andy figure.

  • Poser Ambassadors

    Here I render with your settings on the bounces.
    0_1487248876047_TG 3 Bounces.jpg
    Now I change Max Bounces to 16 to agree with your Transmission Bounces.
    0_1487248895934_TG 16 Bounces.jpg

  • I gave this information some time ago on a site that had been switched off some days ago…

    The tricky glass trick does not work with indirect light (e.g. an environment sphere).
    The best workaround i found is to use both isShadowRay and isDiffuseRay for the MixClosure, like this:


    Here a set of test renders without direct light. Left is BBs tricky glass and on the right my version. Please note the differences on the spoon inside the glass and the shadow on the ground.


    This render is with env sphere and direct sun light.


    I made some other test renders showing the effect on eyes but can’t find them right now.

  • Poser Ambassadors

    @nagra_00_ said in Super Fly Coloured Glass:

    The tricky glass trick does not work with indirect light (e.g. an environment sphere).
    The best workaround i found is to use both isShadowRay and isDiffuseRay for the MixClosure, like this:

    Hm. That's interesting. If I understand correctly why this is the case, it tells me that when a "shadow" ray is generated for direct lighting, it goes only to actual lights, and these "shadow" rays are not generated for our prop emitters. They're actually a cheat.

    The addition of consulting the Diffuse ray seems like a good solution. I can't think of any reason not to do that in the general case.

  • Poser Ambassadors

    If you are using flat glass (like a window) or nearly flat glass (like the cornea of an eye) you can get away with not modulating the transparency at all.

    But if the object is curved, there is a big improvement you can get just by adding three nodes.


    This is a hack and requires YOUR PARTICIPATION AND THOUGHT. Correct values will not be automatic. No single shader will work for all situations. Blindly copying this will not match my results.

    I'm using two area lights. The appearance of shadows and caustics (real or faked) are heavily influenced by size, shape, position, and intensity of your light sources!!! You have been warned.


    In this grouping we create increased "shadowing" where the angle of incidence is low, and an intense, amplified concentration where the angle of incidence is high.

    0_1487260491049_TG Fake Caustics.png

    The Edge_Blend produces a gradient that is white for high angle of incidence and black for low angle of incidence. The concentrated version is where we apply the Pow (20) and add some of that back in to the transparency color.

    Because this is a cheat, and not a proper rendering calculation, you will have to personally get involved in adjusting the proportion (.5) and concentration (20).

    The Proportion value is Math_Functions_2.Value_2
    The Concentration value is Math_Functions.Value_2

    Here is a demonstration using three props:

    0_1487260629438_TG Caustics.jpg

    These shadow+transparency effects look much better than nothing.

    For the cylinder, the proportion is .5 and concentration is 20.

    For the ball-cone (teardrop), the proportion is 3 and concentration is 20.

    For the sphere, the proportion is 2 and concentration is 40.

    Note also these values should be adjusted in response to the distance from the prop to the floor.

  • @bagginsbill You are absolutely right. I tried increasing every render parameter but the Max Bounces.

    That was because I was thinking that Max Bounces would limit the ray bounces for the "usual bounces" except for the "special bounces" that are listed afterwards, namely diffuse, glossy, transmission, transparent and volume bounces.
    If I understand this correctly, the Min/Max Bounces parameters are overruling the special bounces parameters?

    BTW I see no difference in the renders between setting Transmission Bounces to 4 or to 16. That would mean that this glass material is relying on the Transparent Bounces to be high enough, not the Transmission Bounces, right?

  • Poser Ambassadors

    For the cylinder, excluding the ends where it gets complicated, the ray has to transmit 4 times.

    1 - to enter the front
    2 - to exit the front - now it';s in the air again, between front and back of the cylinder
    3 - to enter the back
    4 - to exit the back

    You asked if setting transmission bounces from 4 to 16 resulting in no change means it's not using transmission bounces. That is false. It's using the transmission bounces for the refractions (when you LOOK through the glass), and that is why 3 is not enough.

    On the other hand, the nearby surface that is picking up light via the TransparentBsdf (not the Glass) is instead controlled by the Transparent Bounces.

    Either way, you need at least 4 in both. One will effect what the camera sees through the glass, the other will affect what the wall or floor gets lit by that passed through the glass.

  • Poser Ambassadors

    Regarding Min and Max bounces, yes these place an overall boundary on bounces of any kind.

    I leave my individual bounce values high, like 16 for transmission and 32 for transparency (because hair).

    For test renders I set Max Bounces to 4 and I get a fast, but incomplete render. (Missing some transmissions)

    For final I set Max Bounces to 32.