first of all thanks for the great engine !! It really helps me a lot .
I have been playing with Electron's getXJointNode and finally got my model attached hair. but the lighting is not working the way it should work.
I have two .x files , one for model and one for hair. and created one lighting . but like the screenshots below my hair gets lighting from behind.
I looked my .x file and found out the joint I am using to attach hair part of model is facing opposit way of model.. would it be the problem of this lighting ?
Does lightwave uses a right or left handed coordinate system? Irrlicht (and the DirectX format also) uses a left handed system.
I'm the author of the DirectX Exporter Mod for Blender. Blender uses a right handed system. The original exporter by Ben Omari would just flip the Z axis of the root matrix to convert the system. This works in most cases, but in some others it leads to problems. This is why I did a real conversion of all matrices in the modded exporter.
I dont know how the D-Storm exporter work. Maybe it uses the same "cheap" conversion.
I think getXJointNode returns a matrix, doesn't it? So it might be coordinate system problem that you have. But maybe it's a totaly different problem. Like I said I was just guessing...
Hm, could you post some (any) D-Storm exported X mesh file content?
It is like it is. And because it is like it is, things are like they are.
hmm my question is .. there is only one light available on the scenemanager , why does head get light from behind and while body gets light from front ? could it be the coordinate system's fault ?
hmm maybe I think I know why.
I has nothing to do with getJointXNode at all .
I think light is applied before mesh gets animated thus false lighting after animated.
when I added one more light in front of model and slightly lower than the model itself , it lights bottom part of the face but not the bottom of the fist which gets animated.
jyon wrote:
if the hair goes where it should be (above head of course) the lighting is right I think.
No, I don't think so. The (not attached) hair should be lit from the left (from the perspective of the screenshot) at that position. Try to position the hair approx to the head with setPosition and setRotation and then look how it's lighted.
jyon wrote:when I added one more light in front of model and slightly lower than the model itself , it lights bottom part of the face but not the bottom of the fist which gets animated.
I dunno if I made myself clear ..
yes you did . I now that problem. It's a different problem (I think). It's because only the vertices get animated but not the vertex normals. And the vertex normals affect the lighting.
It is like it is. And because it is like it is, things are like they are.
hmm I think that is the exact problem. Vertex normals do not change after animation.
since the hair part is loaded to the scene facing oposite way of lighting,
when I get the hair part attached model (which is facing to the light) the hair part only gets lighting from behind. That is because the vertex normals of the hair part didn't change.
So, the problem is now , how do I get the vertex normals right after the animation ?
I looked thru the engine code. and void CXAnimationPlayer::modifySkin() does transfromation for the vertex. If I add a routine for the transformation of normals , would it fix the problem ?
jyon wrote:hmm I think that is the exact problem. Vertex normals do not change after animation.
since the hair part is loaded to the scene facing oposite way of lighting,
when I get the hair part attached model (which is facing to the light) the hair part only gets lighting from behind. That is because the vertex normals of the hair part didn't change.
Yea, but your hair is not animated, or is it? So the lighting should be ok when loaded and not attached. Which it is not... strange
jyon wrote:
So, the problem is now , how do I get the vertex normals right after the animation ?
I looked thru the engine code. and void CXAnimationPlayer::modifySkin() does transfromation for the vertex. If I add a routine for the transformation of normals , would it fix the problem ?
Yes, this would fix the non-animated vetex problem. I did that too in my engine. But I doubt this will fix the other problem, but I might be wrong.
It is like it is. And because it is like it is, things are like they are.
Dear jyon:
Do u do the animation on your model? when i do this the hair and body
move is strange? do u have this problem?
sorry for my poor english.
ttom