Page 1 of 1

HRDI light but not reflections

Posted: Sun Jul 25, 2021 9:48 am
by stevepickup
Hello - Just thought i'd post this in case it's of use to anyone else.
I wanted to use an HDRI to light a scene but not show up in reflections... please correct me if I'm wrong but you can't do out of the box?

A quick and dirty workaround -
Drop down a Texture OSL node and paste and compile this into code box:

Code: Select all

shader raytype_contribution(
   float cam = 1 [[string label = "Camera", float min=0, float max=1]],
   float shad = 1 [[string label = "Shadow", float min=0, float max=1]],
   float AO = 1 [[string label = "Ambient occlusion", float min=0, float max=1]],
   float diff = 1 [[string label = "Diffuse", float min=0, float max=1]],
   float refl = 1 [[string label = "Reflection", float min=0, float max=1]],
   float refr = 1 [[string label = "Refraction", float min=0, float max=1]],
   output color c = 0
    )
{
    c = cam*raytype("camera") + shad*raytype("shadow") + AO*raytype("AO")
    + diff*raytype("diffuse") + refl*raytype("reflection") + refr*raytype("refraction");
}
Then wire it into the power input of the Texture image RBG you are using for your Environment HDRI
From this you can then tweak the reflection slider... and for a bonus the AO.

Not my code, was posted in another thread for a different purpose... sorry cant remember where or what.
Seems to work for this.