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:
@@ -163,7 +163,7 @@ void camera(vec3 co, out vec3 outview, out float outdepth, out float outdist)
|
|||||||
{
|
{
|
||||||
outdepth = abs(co.z);
|
outdepth = abs(co.z);
|
||||||
outdist = length(co);
|
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)
|
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) {
|
if (data) {
|
||||||
ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */
|
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[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 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user