I'm trying to create a glass block and have it so the light color changes according to the glass color.

I want a lighting effect like the blue glass (texture-less) block, but with the "streaks" of the glass blocks provided by the image, as well as the glass color.

enter image description here

Top: Non-textured glass block, with the intended lighting effect seen on the background Bottom left: Blue Glass block w/ image texture Bottom right: Glass Block w/ image texture

I want the blue glass block to cast a blue shadow, but it's casting a gray shadow. The plain glass, however, is fine. Both images have alpha channels.

Texture-less block node: enter image description here

Glass block nodes w/ image texture: enter image description here

I've used glass, transparent, and translucent shaders in a "mix" in various combinations with no luck. The shadows remain the same.

  • $\begingroup$ You haven't introduced any transmission on the bottom node tree, so the colored portions are just reflecting rays $\endgroup$ Mar 8 at 19:17

I found a solution to your problem. The answer lays within the lightpaths. You want your direct rays with your texture and alpha and your indirect (Colored shadows) using a solid blue object. This can be done fairly easy inside the nodes.

So, this shadow:enter image description here

With this texture: enter image description here

This is your solution: enter image description here

One material will be used when rendering the cube and the other one when rendering the shadow. The Lightpath node will output white when the ray is directly coming from the object to the camera. Black if it isn't.

  • $\begingroup$ This does work, however, it's not quite the effect I was going for. I wanted an effect similar to Minecraft shaders: link Where each different color of glass casts shadows corresponding to it's color. $\endgroup$
    – SanjivanM
    Mar 8 at 21:11
  • $\begingroup$ That's an easy fix. Just plug your texture into the base color of your transparent BSDF. That should do the trick. $\endgroup$
    – ThijsSmeel
    Mar 9 at 19:08

After more research and testing and almost giving up lol) I think I've found the key... Node setup for Blue glass: Output (rendered view, Cycles): Viewing the block with no background: enter image description here

Usage: Change the color in the Transparent BDSF. This is the 'shadow color' The image texture is what's used to display the block without light passing through it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.