随笔 - 505  文章 - 1034  trackbacks - 0
<2008年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910


子曾经曰过:编程无他,唯手熟尔!

常用链接

留言簿(94)

随笔分类(649)

随笔档案(505)

相册

BCB

Crytek

  • crymod
  • Crytek's Offical Modding Portal

Game Industry

OGRE

other

Programmers

Qt

WOW Stuff

搜索

  •  

积分与排名

  • 积分 - 894628
  • 排名 - 14

最新随笔

最新评论

阅读排行榜

评论排行榜

截图:



参考对比下纯D3D的实现:《精通DirectX 3D》第十二章 高级纹理应用 06_SphericalEnvMapping
    原理都是一样的,都是有个环境贴图,假的环境映射!


实现很简单,override createScene成员函数就可以了
    // Just override the mandatory create scene method
    void createScene(void)
    {
        
// Set ambient light
        mSceneMgr->setAmbientLight(ColourValue(0.50.50.5));

        
// Create a point light
        Light* l = mSceneMgr->createLight("MainLight");
        
// Accept default settings: point light, white diffuse, just set position
        
// NB I could attach the light to a SceneNode if I wanted it to move automatically with
        
//  other objects, but I don't
        l->setPosition(20,80,50);

        Entity 
*ent = mSceneMgr->createEntity("head""ogrehead.mesh");

        
// Set material loaded from Example.material
        ent->setMaterialName("Examples/EnvMappedRustySteel");

        
// Add entity to the root scene node
        mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);  
    }

对应的材质脚本在
ogrenew\Samples\Media\materials\scripts\Example.material
里,如下:

material Examples/EnvMappedRustySteel
{
    technique
    {
        pass
        {

            texture_unit
            {
                texture RustySteel.jpg
            }

            texture_unit
            {
                texture spheremap.png
                colour_op_ex add src_texture src_current
                colour_op_multipass_fallback one one
                env_map spherical // hew:这里指明环境映射的类型是球形环境映射
            }
        }
    }
}

ogrenew\Samples\Media\materials\textures\spheremap.png



ogrenew\Samples\Media\materials\textures\RustySteel.jpg









posted on 2008-04-28 23:03 七星重剑 阅读(1539) 评论(0)  编辑 收藏 引用 所属分类: Game GraphicsGame EngineOGRE

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理