[osg-users] [Problem with osgLight]
Jean-Baptiste Authesserre
authesse at gmail.com
Thu Jun 19 05:18:44 PDT 2008
Hi,
In fact I export blender object to .3ds file by using blender export
function. To check if the probleme comes from this export function, I
exported also my object to .ac (AC3D) file format.
To obtain the same view of my "IMS" square (I want my camera in front of the
square, not above), I have to change the position of my camera from (0, 0,
-20) to (0, 20, 0), so it seems that the frame of ac3d is rotated from -90°
around X-axis. Because of this axis rotation, I have dispaced my Light to
the position (0, 15,20) to recreate the same scene than with the .3ds
object. The results are totally different.
I have attached four image to this mail. The first is the result obtained
with .3ds file. The second is the result if I use .ac file without changing
camera position. The third is the result obtained by changing camera
position. And the fourth is the result when I changed camera position and
light position.
It seems, that with AC3D file (.ac), I have not the probleme of the
"bottom-left corner". But the black color of the square around the IMS text
is become grey! When I displace the light , the square seems to be less
enlighten. I don't understand why...
Have anybody had the same kind of problem?
Jean-Baptiste.
2008/6/18 Paul Melis <paul at science.uva.nl>:
> Jean-Baptiste Authesserre wrote:
>
>> This is the result when I remove the helmet. I really don(t understand.
>> The square is obtained thanks to the following way. I ceated a cube with
>> blender 3*3*0.1 (small depth along th Z-axis)
>> I load on that cube a texture. I attach to this mail the result without
>> the helmet and the texture attached to the cube.
>> It's very strange...
>>
> You can check the .osg file exported by Blender to see if the normals are
> set correctly. There shouldn't be that many for this simple model I suspect.
>
> Paul
>
>
>> 2008/6/18 Paul Melis <paul at science.uva.nl <mailto:paul at science.uva.nl>>:
>>
>> Jean-Baptiste Authesserre wrote:
>>
>> Sorry for the previous mail. I'm a little confused. My camera
>> is configured to take Y-axis as UP axis. In my 3D-model, I put
>> the helmet so that the bottom of the helmet correspond to
>> negative Y, and the top to positive Y (cf attached figure).
>> The camera look at (0, 0, 0). Thus I can obtain the attached
>> image. To enlight the scene I put the light at 0 on X-axis so
>> the region around the bottom corners of the square be
>> enlighten the same way (the square is in the XY plane).
>> However the region around bottom-left corner is darker than
>> the region around bottom-right corner. What have I missed?
>>
>> Ah! You said "my object isn't uniformly enlighten" in your
>> original mail. With "object" I figured you meant the whole
>> thing/"helmet". I now see what you mean w.r.t. the dark corner on
>> the square. Could it be that you have an incorrect normal for that
>> corner of the square? Are the square and helmet one object? Does
>> it still show when you display only the square (i.e. could it be
>> an artifact that actually comes from the helmet, and not the square)?
>>
>> Paul
>>
>>
>> Jean-Baptiste
>>
>> 2008/6/18 Jean-Baptiste Authesserre <authesse at gmail.com
>> <mailto:authesse at gmail.com> <mailto:authesse at gmail.com
>> <mailto:authesse at gmail.com>>>:
>>
>>
>> Hi,
>>
>> I am a little confused. My camera
>>
>> 2008/6/18 Paul Melis <paul at science.uva.nl
>> <mailto:paul at science.uva.nl>
>> <mailto:paul at science.uva.nl <mailto:paul at science.uva.nl>>>:
>>
>>
>>
>> Jean-Baptiste Authesserre wrote:
>>
>> Hi everyone,
>>
>> I have some problem with OSG Light, and I don't find
>> answer in the osg archives. My problem is the
>> following :
>> I don't understand why with the following code my
>> object
>> isn't uniformly enlighten. (cf. image in attached
>> document)
>> -The black and white square of the image is centered at
>> (0, 0, 0) (in world frame with convention (x, y, z))
>> -The camera is located at (0, 0, -20)
>> -the light is located at (0,20, -15)
>>
>> If you didn't change this yourself then +Z will be the up
>> axis, btw
>>
>>
>>
>> The code for activating light is the following:
>>
>> /*****************************
>> ** light *************************************/
>>
>>
>> //Creation of light source
>> osg::Light* light = new osg::Light();
>> osg::LightSource * lightsource = new
>> osg::LightSource();
>> lightsource->setLight(light);
>> // put the light source in the scenegraph
>> root->addChild(lightsource);
>>
>> // turn light on
>> osg::StateSet * stateset =
>> root->getOrCreateStateSet();
>> lightsource->setStateSetModes(*stateset,
>> osg::StateAttribute::ON);
>> light->setAmbient(osg::Vec4d(1.0, 1.0, 1.0, 1.0));
>> //light->setDiffuse(osg::Vec4d(0.0, 0.0, 0.0, 0.0));
>> //light->setSpecular(osg::Vec4d(1.0, 1.0, 1.0,
>> 1.0));
>> light->setPosition(osg::Vec4d(0.0, 20.0, -15.0,
>> 1.0));
>>
>>
>> /******************************************************************************/
>>
>> So, I don't understand why the bottom-left corner of my
>> square is darker than the others corners
>>
>> I don't see any difference here between left and right
>> bottom
>> corners, they're equally dark IMHO. Which seems to make
>> sense,
>> as you've put the light source above and little in front of
>> the camera, but in the center of the object (the X plane).
>>
>> Paul
>>
>> Has anybody an Idea?
>>
>>
>> Best regards,
>>
>> Jean-Baptiste.
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> <mailto:osg-users at lists.openscenegraph.org>
>> <mailto:osg-users at lists.openscenegraph.org
>> <mailto:osg-users at lists.openscenegraph.org>>
>>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> <mailto:osg-users at lists.openscenegraph.org>
>> <mailto:osg-users at lists.openscenegraph.org
>> <mailto:osg-users at lists.openscenegraph.org>>
>>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> <mailto:osg-users at lists.openscenegraph.org>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> <mailto:osg-users at lists.openscenegraph.org>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080619/c21cf04d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001_3ds.jpg
Type: image/jpeg
Size: 2549 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080619/c21cf04d/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001_AC3D_above.jpg
Type: image/jpeg
Size: 2112 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080619/c21cf04d/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001_ac3d.jpg
Type: image/jpeg
Size: 2649 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080619/c21cf04d/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001_ac3d_displacedLight.jpg
Type: image/jpeg
Size: 2606 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080619/c21cf04d/attachment-0007.jpg>
More information about the osg-users
mailing list