Boolean operations in the node editor

I’m familiar with the light path node in Cycles and from what I understand when used as the factor of a mix node it more or less functions as an if statement (ray == camera ? use_texture_2 : use_texture_1).

How would you use it for more complicated operations, though? Let’s say you have a low res HDR file that contains only lighting information and a high resolution JPG or PNG file, both equirectangular (don’t know if the high res image could rightly be called a back plate in that instance), and you want to use the high resolution image if the ray type is camera OR glossy, otherwise use the HDR.

How would one go about setting up something similar to an OR statement? I’ve tried the math nodes with little luck. Instead of returning 1 or 0 they usually give a mix.

Hi. Here’s a crude method that will do what you asked. Studio environment texture is used for only diffuse and glossy and another texture for everything else. Basically you need to separately tell what texture to use with all the ray types and then add all together. From left to right: green glass, white diffuse, 100% glossy.


This works if you have the same image in different file formats… Be aware things like glossy ray and reflection ray overlap. Glass material has glossy, reflection and transmission rays etc. If I wanted to use different textures for different objects/materials I would need to use obj info node instead.

I never thought of checking the add shader. Thank you. That does exactly what I need it to.