GLSL实现Simple Displace Mapping
来源:互联网 发布:微商网络推广方案ppt 编辑:程序博客网 时间:2024/06/04 18:33
http://blog.csdn.net/a3070173/archive/2008/11/20/3342062.aspx
- Dislace Mapping其实就是在顶点着色器中
- 对顶点进行置换偏移,经常用于水仿真流体绘制.
- 顶点着色器:
- uniform float g_fScale;
- uniform sampler2D g_DisplaceTexture;
- void main()
- {
- float fDisplace = texture2DLod(g_DisplaceTexture, gl_MultiTexCoord0.st, 0.0).r;
- vec4 vec4NewVertex = vec4(gl_Vertex.x, gl_Vertex.y + g_fScale*fDisplace, gl_Vertex.zw);
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_Position = gl_ModelViewProjectionMatrix*vec4NewVertex;
- }
- 片元着色器:
- uniform sampler2D g_DecalTexture;
- void main()
- {
- gl_FragColor = texture2D(g_DecalTexture, gl_TexCoord[0].st);
- }
- Demo效果截图:
- exe文件:http://www.fileupyours.com/view/219112/GLSL/Simple%20Displace%20Mapping.rar
- VC9运行库:http://www.fileupyours.com/view/219112/GLSL/VC9%26%2336816%3B%26%2334892%3B%26%2326102%3B%26%2324211%3B.rar
- GLSL实现Simple Displace Mapping
- GLSL实现Simple Displace Mapping
- Bump mapping的GLSL实现
- Shader特效——“Simple RayTrace”的实现 【GLSL】
- OpenGL 4.0 GLSL 实现 投影纹理映射(Projective Texture Mapping)
- OpenGL 4.0 GLSL 实现 投影纹理映射(Projective Texture Mapping)
- Shader特效——“Simple 3D Raymarch”的实现 【GLSL】
- Tangent space normal mapping with GLSL
- Lighting and environment mapping with GLSL
- OpenGL LIGHTING AND ENVIRONMENT MAPPING WITH GLSL
- GLSL实现Glow效果
- GLSL实现Ambient Occlusion
- GLSL实现Image Filter
- GLSL实现HDR Rendering
- GLSL实现Interactive Fluid
- GLSL实现Glow效果
- GLSL实现Ambient Occlusion
- GLSL实现Image Filter
- java类获取web应用的根目录(转载)
- 换行word-wrap与word-break兼容IE和FIREFOX
- 网站设为主页
- 收藏本站
- 腾讯QQ2009 Beta3 传美版 绿色最终版
- GLSL实现Simple Displace Mapping
- PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
- GLSL实现Image Filter
- ASP.NET遍历某一区域所有的TextBox并为其赋值
- C++ 高级主题之模板特化
- GLSL实现HDR Rendering
- 产生一个int数组,长度为100,并向其中随机插入1-100,并且不能重复
- POJO 概念
- 改天总结下怎么用guice