GottaGoFes / blender2ogre

Automatically exported from code.google.com/p/blender2ogre
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Orientation of directional light is wrong #54

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add a cube in blender at origin.
2. Set the camera from the dotScene as the default camera.
3. Add a directional light (sun) in blender at the same location as the camera.
4. Rotate it around the x axis by 90 degrees. It should now point towards the 
cube.
5. Export using blender2oger.
6. Load into an Ogre scene using a dotScene loader.
7. Set the camera from the dotScene as the default camera.

What is the expected output? What do you see instead?
The cube should be illuminated from the front, since the sun is shining from 
the camera towards the cube. Instead the cube is illuminated from the top.

What version of the product are you using? On what operating system?
Blender 2.63
blender2ogre 0.5.7-1
Ogre 1.8

Please provide any additional information below.
I found that blender2ogre tries to set the direction of the sun twice. First it 
does so by copying the rotation of the blender camera into the rotation of the 
scene node that will hold the camera. Then it uses the rotation of the blender 
camera to set the direction of the light (and sometimes incorrectly? XYZ 
rotation of (x,y,z)=(45,0,45) gives <direction y="-0.707" x="0.0" z="0.707" /> 
and (x,y,z)=(45,0,0) gives                                 the same result of 
<direction y="-0.707" x="0.0" z="0.707" />.). However only one of those is 
needed. 

I found one way to fix this in Ogre was to set the direction of the light to be 
(0,-1,0), which is the same as the default direction of light in Blender (with 
axes exchanged correspondingly). Then I let the rotation of the node, since I 
know it is correct in the dotScene file, to take care of the wanted direction.

Original issue reported on code.google.com by kkri...@gmail.com on 30 Jun 2012 at 7:30