|
1)
利用osg生成阴影,两个模型相交的地方会有一条白线(如图),这到底是为什么呢
生成阴影的代码如下
- const int iReceiveNodeMask = 0x1;
- const int iCastNodeMask = 0x2;
- osg::ref_ptr<osgShadow::MinimalShadowMap> sm = new osgShadow::LightSpacePerspectiveShadowMapDB;
- pScene->setShadowTechnique(sm);
- float minLightMargin = 0;
- float maxFarPlane = 0;
- unsigned int texSize = 4096;
- unsigned int baseTexUnit = 0;
- unsigned int shadowTexUnit = 3;
- sm->setMinLightMargin( minLightMargin );
- sm->setMaxFarPlane( maxFarPlane );
- sm->setTextureSize( osg::Vec2s( texSize, texSize ) );
- sm->setShadowTextureCoordIndex( shadowTexUnit );
- sm->setShadowTextureUnit( shadowTexUnit );
- sm->setBaseTextureCoordIndex( baseTexUnit );
- sm->setBaseTextureUnit( baseTexUnit );
复制代码
2)如果在程序中添加shadow则在退出是程序会崩溃,不知何故 |
|