Blender Internal: Fix shader node "Camera Data" that doesn't consider orthographic view.
Note that Cycles still needs to fix.
This commit is contained in:
parent
ddb3ad9092
commit
0c7d2de382
Notes:
blender-bot
2023-02-14 08:40:26 +01:00
Referenced by commit 178bd849bf
, Blender Internal: Revert own previous commit for "Camera Data" node, correct GLSL code for view vector output of "Geometry" node.
|
@ -163,7 +163,7 @@ void camera(vec3 co, out vec3 outview, out float outdepth, out float outdist)
|
|||
{
|
||||
outdepth = abs(co.z);
|
||||
outdist = length(co);
|
||||
outview = normalize(co);
|
||||
outview = (gl_ProjectionMatrix[3][3] == 0.0)? normalize(co): vec3(0.0, 0.0, -1.0);
|
||||
}
|
||||
|
||||
void math_add(float val1, float val2, out float outval)
|
||||
|
|
|
@ -46,9 +46,9 @@ static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSE
|
|||
if (data) {
|
||||
ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */
|
||||
|
||||
copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
|
||||
copy_v3_v3(out[0]->vec, shi->view); /* get view vector */
|
||||
out[1]->vec[0] = fabs(shi->co[2]); /* get view z-depth */
|
||||
out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */
|
||||
out[2]->vec[0] = len_v3(shi->co); /* get view distance */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue