Why is shading of a mesh affected when I use matrix transform on EX9 Effect (GouraudDirectional for example) i.e. faces that are closer to the light source due to scale transformation are darker?
Everything is fine when I resize mesh itself, but I would like to use spreads in matrix transform to create multiple objects.
hi, some lightning models require the viev and the projection as seperate metrices at the two input pins at the renderer. the camera outputs the viewprojection, view and projection matrices, connect the latter two to the renderer.
directional light has no light source where you can get closer to, its only a direction, no matter where you are…
you can also upload your patch to show the problem in detail.
i cannot explain that, the shader is the fixed function shader, so it should be correct and no coding mistake. but i am sure it has something to do with the coordinate space. the vertex positions of the model are in model space, you change them directly at the Box node. the lighning is done in worldview space, which is defined by the world matrices at the 3D object an the view matrix at the renderer.
often in 3d graphics, there is done a trick, so that you dont have to transform a whole model into a special space, you just transform the light into the object space by the inverse worldview matrix… that could be the reason, just a performance thing…
… i would understand the effect if it was a point light. if i transform the worldview it could affect light source distance, but as tonfilm mentioned before, directional light shouldn’t be transformed (cause it has no actual source). right?
maybe i got it all wrong but, the whole story is about that original question. when i use transforms lighting gets messed up. it doesn’t when i scale the box.
in my case, all shaders produce the same behavior although tehniques register as valid.
let me close this tread cause it seems we are running in circles. i will try to run this test on several other machines and will come back with conclusion.