I'm beginner in osl I want to make simple fresnel by Open Shading Language:
my problem is I can't find view direction in osl documention
shader Fresnel
(
output color Out = 0.0,
)
{
vector Fresnel = 1.-dot(N,ViewDir);
Out = Fresnel;
}
and this is my error
Line 11: error: 'ViewDir' was not declared in this scope
I want result like this:
I tried to transform but not work:
vector WorldPos = transform("camera","world",point(0,0,0));
vector CameraWorldPos = transform ("camera", "world",(1.,0.,0.));
vector viewDirection = CameraWorldPos - WorldPos;