Camera ViewProjection and lighting

hi there,

a question regarding the use of Camera (Transform Softimage):
until now i was of the opinion that it would not make a difference when connecting a camera to a renderer like this:

  • Camera ViewProjection -> Renderer _ view_
  • Camera View and Projection-> Renderer View and Projection

i just noticed that there is a difference when it comes to lighting objects (e.g. using phong shading). doing it the first way results in wrong lighting at the backside of objects (see attached patch). i guess this has something to do with wrong normals calculation…

can somebody explain why this is the case?
as i understood all the transform matrices (view, projection, aspect) are multiplied in the renderer anyways. when taking the viewprojection of the camera and feeding it into the view of the renderer, shouldn’t it work the same way?
apparently it does not, but where is the difference (different order maybe)?
or - what is the ViewProjection for anyways?

thanks!

camera_transform_lighting.v4p (12.2 kB)

ej motzi,

if you look into the code of the effect you’ll see the difference:
for correct lighting calculation the light direction and normals are multiplied with the view transform only w/o projection yet

float4x4 tV: VIEW;
float4x4 tWV: WORLDVIEW;



Out.LightDirV = mul(LightDirW, tV);
Out.NormV = normalize(mul(NormO, tWV));

projection takes care of the field of view and perspective distortion and this kind of things you do not want to affect your lighting.

i guess viewprojection is still a legacy thing from ancient pre ex times

heya woei,

yes, that makes sense. thanks for pointing this out for me.