Cycles: Align Camera data output between SVM and OSL
The `ZDepth` output of the camera data node was different between SVM and OSL. SVM would output the `ZDepth`, with negative distances for points behind the camera. While OSL would output the absolute of the distance, which resulted in points behind the camera becoming positive. Align OSL to SVM and allow outputting the negative distance as it allows users to differentiate between what's in front or behind the camera. Pull Request: https://projects.blender.org/blender/blender/pulls/132837
This commit is contained in:
@@ -10,7 +10,7 @@ shader node_camera(output vector ViewVector = vector(0.0, 0.0, 0.0),
|
||||
{
|
||||
ViewVector = (vector)transform("world", "camera", P);
|
||||
|
||||
ViewZDepth = fabs(ViewVector[2]);
|
||||
ViewZDepth = ViewVector[2];
|
||||
ViewDistance = length(ViewVector);
|
||||
|
||||
ViewVector = normalize(ViewVector);
|
||||
|
||||
Reference in New Issue
Block a user