-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exported lights point in the "wrong" direction #231
Comments
can you link the code for this? I would assume that issue this is not limited to lights. Try exporting the monkey mesh, instead of the symmetrical cube. |
sidenote: if you are exporting the whole scene, you should not need to flip the coordinate axes. those are defined by the scene, which you are in full control of |
This is the function where each node in the scene is processed in terms of "axis swapping": blender2ogre/io_ogre/ogre/scene.py Lines 350 to 393 in 25a8789
And in Lines 424 to 437 in 25a8789
|
ah.. ok.. I thought there is some explicit check for identity transform somewhere. frankly I think that swap function is just broken for rotations and being needlessly slow due to all the ifs. The correct approach would be just to construct a 3x3 matrix to transform both rotations and positions. |
Yes, you are right. When I discovered this, I spent 3 days in a deep confusion 😂. I'll see how to do it with matrices. Although let me tell you that despite all that... it works. If you export a scene it looks correct even with rotations. |
So, really my question is this: If that is true, then there needs to be a correction. |
yes. with identity transform lights and cameras in ogre point towards Z-
actually, for meshes the rotation is taken care of by swapping the vertices (position) and lights are broken. So I still assume that it does not work :P |
I mean, it works for everything except lights. That is in fact everything is properly converted. The issue is that in Blender lights with identity transform point downwards (-Y in OGRE) and in OGRE they point towards the "back" (-Z in OGRE), that is why lights need special handling. |
see #240 |
Hello, @paroj.
While developing the ability to export rectangular lights, it came to my attention an issue regarding the exporting of lights.
Suppose we have a scene with a cube and a directional light of type "Sun".
By default in Blender a light with identity transform will have the light pointing downwards.
If we export the scene to OGREs coordinate system, and since
blender2ogre
does a conversion where x->x, y->z, z->-y,then the result is that the cube now is in position (1, 0, -1) and the light is pointing towards -Z.
This is because since the light had identity transform in Blender its transform will not change in OGRE.
But the thing is that in OGRE the light will point towards -Z because that is what happens with a light that has no rotation.
I changed the code in
scene.py
so that the lights are the only objects transformed by a -90° rotation on the X axis.What do you think?
The text was updated successfully, but these errors were encountered: