Lighting problem using getXJointNode addon by Electron
Lighting problem using getXJointNode addon by Electron
greetings
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 ?
thanks and sorry for my english
jyon[/img]
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 ?
thanks and sorry for my english
jyon[/img]
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?
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.
first of all thanks for your replies, jox
I think lightwave uses left handed coordinate system. the positive part of the Z-axis goes away from the screen , right ?
these are the two .x files used in above examlpe (without textures tho')
http://www.triongames.com/jyon/xfiles.zip
and getXJointNode returns a node afa I know.
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 ?
jyon
I think lightwave uses left handed coordinate system. the positive part of the Z-axis goes away from the screen , right ?
these are the two .x files used in above examlpe (without textures tho')
http://www.triongames.com/jyon/xfiles.zip
and getXJointNode returns a node afa I know.
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 ?
jyon
If also Y goes up and X to the right then its left-handed..
The X files look ok.
What happens if you place the hair mesh in the scene without attaching it with getXJointNode? Still wrong lighting?
Oh right, getXJointNode should return a node, should have figured it by the name. You make the hair a child of that node I guess.
The X files look ok.
What happens if you place the hair mesh in the scene without attaching it with getXJointNode? Still wrong lighting?
Oh right, getXJointNode should return a node, should have figured it by the name. You make the hair a child of that node I guess.
It is like it is. And because it is like it is, things are like they are.
lighting doesn't seem right after model got animated
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.
I dunno if I made myself clear ..
any help with this problem ?
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.
I dunno if I made myself clear ..
any help with this problem ?
Re: lighting doesn't seem right after model got animated
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: if the hair goes where it should be (above head of course) the lighting is right I think.
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.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 ..
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 ?
or is there already such fix exist ?
jyon
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 ?
or is there already such fix exist ?
jyon
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... strangejyon 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.
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.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 ?
It is like it is. And because it is like it is, things are like they are.