EX9 Effect - transform affects mesh shading question

Hi, I am a newbie.

My question is:

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.

Is there a workaround?

tnx

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.

ok.
here it is. please take a look.


“directional light has no light source where you can get closer to, its only a direction, no matter where you are…”

isn’t that metaphysical? zen anyone? :)))))))

tnx m8

01 question.v4p (8.5 kB)

that seems metavvvvysical indeed…

:)

does anybody see what I see on that patch, or is it just me and my gpu?

face that moves toward the ligh gets darker.

any ideas, pls.

Yes, it gets darker on my GPU too, goes from white thru grayscale to black.

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…

so…

if, for example, i want to have multiple boxes, different sizes and have consistent lighting, what should i do?

… 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?

if, for example, i want to have multiple boxes, different sizes and have consistent lighting, what should i do?

leave the Box node like it is, do every scaling with transforms…

tonfilm ???

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.

example attached:

02 question.v4p (9.0 kB)

its only the fixed pipeline flat shading, just use gouroud or phong they even have way better shading quality…

tnx tonfilm

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.

it bothers me, though, so stay tuned.

tnx guys.
good vvvvibes overload.

puh. a tough one. never noticed that before.
in all the fixedfunction shaders we were missing one line:

NormalizeNormals = true;

put that in and they shall shade correctly. thanks for pointing that out.

bingo!

i realy thought it was something wrong with this older computer i am using.

think how this will change the look of all older patches.

suggestion:

bool bFixNormals ~60~String uiname=“Normalize”;~62~ = 1;
NormalizeNormals = (bFixNormals);

or something similar.