chap6_1 Sphere Environmental mapping in OGRE
OGRE帮我们实现了一些环境映射其中包括了球形环境映射,我们只需要在material脚本里面修改相映参数就可以了,所以这篇并不是讲球形环境映射的原理,而讲如何利用OGRE的球形映射,为了了解球形环境映射,我会用DX写一个例子,敬请期待!
/*------------------------------------------------------------
main.cpp -- Achieve sphere environmental mapping in OGRE
(c) Seamanj.2013/7/21
------------------------------------------------------------*/
//Phase1 : Add Framework
//Phase2 : Add ogrehead with spheremap material
#define Phase1 1
#define Phase2 1
#if Phase1
#include "ExampleApplication.h"
#include <windows.h>
class MyApplication : public ExampleApplication
{
public:
MyApplication()
{}
~MyApplication()
{}
protected:
void createScene()
{
#if Phase2
Entity* ent = mSceneMgr->createEntity("Head","ogrehead.mesh");
ent->setMaterialName("Examples/SphereMappedRustySteel");//知识点1
/*知识点1:球形环境映射材质
---------------------------------------------
来自ogre_src_v1-7-4\Samples\Media\materials\scripts\Examples.material文件
---------------------------------------------
material Examples/SphereMappedRustySteel
{
technique
{
pass
{
texture_unit
{
texture RustySteel.jpg
}
texture_unit
{
texture spheremap.png
// colour_op_ex <operation> <source1> (Advanced) Type of texturelayer
// <source2> [<manual_factor>] blending; operation is one of
// [<manual_colour1>] source1, source2, modulate,
// [<manual_colour2>] modulate_x2, modulate_x4, add,
// add_signed, add_smooth, subtract,
// blend_diffuse_alpha,
// blend_texture_alpha,
// blend_current_alpha,
// blend_manual, dotproduct,
// blend_diffuse_color; source1 and
// source2 are one of src_current,
// src_texture, src_diffuse,
// src_specular, src_manual; values
// for manual_factor, manual_colour1,
// and manual_colour2 are dependent
// on operation, source1, and source2
// values.
colour_op_ex add src_texture src_current
// colour_op_ <src_factor> <dest_factor> Fallback texture blending to use
// multipass_fallback when multitexturing not available;
// src_factor and dest_factor
// values same as for scene_blend.
colour_op_multipass_fallback one one
// env_map <off> | <spherical> | Enable this texture layer as an
// <planar> | cubic_reflection | environment map (default off).
// cubic_normal
env_map spherical
}
}
}
}
]*/
mSceneMgr->getRootSceneNode()->attachObject(ent);
#endif
}
};
INT WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd )
{
MyApplication app;
try
{
app.go();
}
catch( Exception& e)
{
MessageBoxA( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
}
return 0;
}
#endif
/*RustySteel.jpg
---------------------------------------------
来自ogre_src_v1-7-4\Samples\Media\materials\textures
---------------------------------------------
*/
/*spheremap.png
---------------------------------------------
来自ogre_src_v1-7-4\Samples\Media\materials\textures
---------------------------------------------
*/
最后运行结果如下:
chap6_1 Sphere Environmental mapping in OGRE相关推荐
- 3Dshader之球形环境映射(sphere environment mapping)
尼玛等了135天,终于第二个shader出炉了,哥,汗颜啊,真TM扯蛋,不过这几个月都在看一些基础图形的数学知识以及RTR,看了几本过后还是感觉实践才能真正理解所学的东西.好了废话不多说了,这个sha ...
- chap6_2 Parallax mapping in OGRE
Parallax mapping(视差映射)是凹凸映射的一种,同样,这里只是在OGRE里面实现,不讲原理.我会写个DX版本的parallax mappiing,到时候再讲原理,敬请期待! /*---- ...
- 3DShader之法线贴图(normal mapping)
凹凸贴图(bump mapping)实现的技术有几种,normal mapping属于其中的一种,这里WALL的实现在物体坐标系空间中,其他都在物体的切线空间中实现,国际惯例,上图先: 由于时间关系我 ...
- DXUT扩展之摄像机
最近需要用DXUT写一个球形环境映射,需要用到摄像机,然而原来的三步曲没有涉及到摄像机,所以这里专门补充下摄像机的用法 /*-------------------------------------- ...
- 基础地理信息术语(a-b-c-d-e-f-g-h-i-k-l-m-n-o-t-u-v-w-x-y-z)
基础地理信息术语(a-b-c-d-e-f-g-h-i-k-l-m-n-o-t-u-v-w-x-y-z) absolute reference frame 绝对参考坐标系 adjacency analy ...
- 《An Introduction to Ray Tracing》——2.2 Ray/Sphere Intersection And Mapping
总结<An Introduction to Ray Tracing>全文:点这里http://blog.csdn.net/libing_zeng/article/details/72603 ...
- C++学习(三三六)球面贴图Sphere mapping 立方体贴图Cube mapping
1.球面贴图 1.1原理 在一幅平面纹理图像中对各个方向的颜色进行编码就相当于把一个擦得锃亮的完美球体放在环境的中央,然后在极远处用长焦镜头对它进行拍照.需要编码的区域就是覆盖整个纹理图像的一个圆形区 ...
- 在 OpenGL ES 2.0 上实现视差贴图(Parallax Mapping)
在 OpenGL ES 2.0 上实现视差贴图(Parallax Mapping) 视差贴图 最近一直在研究如何在我的 iPad 2(只支持 OpenGL ES 2.0, 不支持 3.0) 上实现 视 ...
- Axiom3D:Ogre射线与点,线,面相交,鼠标操作3维空间.
在第一篇网络分解成点,线,面.第二篇分别点以球形,线以圆柱,面分别以MergerBatch整合批次显示.因为整合批次显示后,相应的点,线,面不能以Ogre本身的射线来选取,因为整合后,以点举例,多个点 ...
最新文章
- 抛出一个nullpointerexception_Java 14 发布了,再也不怕 NullPointerException 了!
- 许式伟:毕业两年成为首席架构师,我的技术学习方法论
- Java学习资料-SimpleFactory
- Java Instant类
- 空值为0非空为1_万达广场4周年,1降到底!0元送万张杂技团门票、人气餐饮6.8折,这波周年庆我先锁为敬...
- IDEA新项目代码上传到gitlab远程仓库
- 解决IE6中PNG图出现灰色背景问题
- wifi的主动扫描和被动扫描
- LRU原理和Redis实现
- 神经网络之BP算法(图说神经网络+BP算法理论推导+例子运用+代码)
- Latex/CTex/WinEdt自动编号小标题序号(条目/编号/描述)
- WebSocket对象的“readyState”属性记录连接过程中的状态值
- phpstorm连接mysql
- 手机信号强度大小的意义
- 导出 服务器 excel文件,服务器数据库导出excel文件格式
- Python 爬虫下载喜马拉雅音频文件
- 从数学计算上分析人脑与电脑差异
- L1-6 吉老师的回归 (15 分)
- 如何压缩图片200k以下?
- elastic-search学习笔记