<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"sans serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"sans serif","serif";
        color:black;
        mso-believe-normal-left:yes;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Times New Roman","serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<![if mso 9]>
<style>
p.MsoNormal
        {margin-left:37.5pt;}
</style>
<![endif]><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white background="cid:image001.jpg@01C9A77B.01A9EFE0" lang=EN-US
link=blue vlink=purple style='margin-left:37.5pt'>
<img src="cid:image001.jpg@01C9A77B.01A9EFE0"
v:src="cid:image001.jpg@01C9A77B.01A9EFE0" v:shapes="_x0000_Mail" width=0
height=0 class=shape style='display:none;width:0;height:0'>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'>I’m trying to use osgShadow, I read examples on osg
website and try to run this code<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'>But the shadow appears strangely like this picture:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'><a
href="http://i475.photobucket.com/albums/rr113/tek3D/shadow.jpg">http://i475.photobucket.com/albums/rr113/tek3D/shadow.jpg</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'>Here is the code I tested:<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>int main()<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           osgViewer::Viewer
viewer;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           osg::ref_ptr<osg::Group>
root = new osg::Group;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           // create
light source.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           osg::LightSource*
lightsource = new osg::LightSource;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           osg::Light*
light = new osg::Light;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           lightsource->setLight(light);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           light->setDirection(osg::Vec3(0,10,0));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           light->setPosition(osg::Vec4(0,0,90,1.0f));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           light->setAmbient(osg::Vec4(0.00f,0.00f,0.08f,1.0f));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           light->setDiffuse(osg::Vec4(1.0f,1.0f,1.0f,1.0f));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           root->addChild(lightsource);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           //shadow<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           const int
ReceivesShadowTraversalMask = 0x1;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           const int
CastsShadowTraversalMask = 0x2;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new
osgShadow::ShadowedScene;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>    shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
osg::ref_ptr<osgShadow::ShadowMap> sm = new osgShadow::ShadowMap;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
shadowedScene->setShadowTechnique(sm.get());<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>    int mapres = 1024;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
sm->setTextureSize(osg::Vec2s(mapres,mapres));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           sm->setLight(light);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>    osg::Node* cessna1
= osgDB::readNodeFile("car68/car68.3DS");<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
cessna1->setNodeMask(CastsShadowTraversalMask);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>    osg::Node* cessna2
= osgDB::readNodeFile("lai.flt");<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
cessna2->setNodeMask(ReceivesShadowTraversalMask);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
osg::MatrixTransform* positioned = new osg::MatrixTransform;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           osg::Matrix
mat = osg::Matrix::rotate(2.7, osg::Vec3(0,0,1));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           positioned->setMatrix(mat*positioned->getMatrix()*osg::Matrix::translate(10,40,2));<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>   
positioned->addChild(cessna1);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           <o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           shadowedScene->addChild(positioned);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           shadowedScene->addChild(cessna2);   
<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           root->addChild(shadowedScene);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           viewer.setSceneData(root);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:37.5pt'><span style='font-size:11.0pt;
font-family:"Times New Roman","serif";color:windowtext'>           return
viewer.run();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'>}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Times New Roman","serif";
color:windowtext'>Could anyone help me with this problem? Thanks in advance!</span><o:p></o:p></p>

</div>

</body>

</html>