forked from bartvdbraak/blender
Cycles / OSL:
* Ray Length is now available in OSL (via get_attribute)
This commit is contained in:
parent
c9fdf6e496
commit
b4a83e1d0e
@ -25,7 +25,8 @@ shader node_light_path(
|
||||
output float IsGlossyRay = 0.0,
|
||||
output float IsSingularRay = 0.0,
|
||||
output float IsReflectionRay = 0.0,
|
||||
output float IsTransmissionRay = 0.0)
|
||||
output float IsTransmissionRay = 0.0,
|
||||
output float RayLength = 0.0)
|
||||
{
|
||||
IsCameraRay = raytype("camera");
|
||||
IsShadowRay = raytype("shadow");
|
||||
@ -34,5 +35,7 @@ shader node_light_path(
|
||||
IsSingularRay = raytype("singular");
|
||||
IsReflectionRay = raytype("reflection");
|
||||
IsTransmissionRay = raytype("refraction");
|
||||
|
||||
getattribute("std::ray_length", RayLength);
|
||||
}
|
||||
|
||||
|
@ -459,6 +459,15 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
|
||||
set_attribute_float3(fval, type, derivatives, val);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Ray Length */
|
||||
else if (name == "std::ray_length") {
|
||||
float fval[3];
|
||||
fval[0] = sd->ray_length;
|
||||
fval[1] = fval[2] = 0.0; /* derivates set to 0 */
|
||||
set_attribute_float(fval, type, derivatives, val);
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user