ogre 中的 shader
2010-12-15 21:04
141 查看
shader可以用在material里 被setmaterial到entity那 用于全屏的 shader要怎样使用呢?是通过 compositot 。compositot是对viewport进行处理的这是一个compositor脚本的粒子 from wikiogre对了这里介绍下 wikiogre 除了 basicturtorial和intermediateturtorial还有 DCCTurtorial 里面的materail和HDR什么的都能抄还有 snippets http://www.ogre3d.org/tikiwiki/Snippets 里面对ogre介绍很多包括shader particle animation sound physics system....这是一个老版本的manual 杨延平翻译http://www.ogre3d.cn/wiki/index.php?title=%E6%96%87%E6%A1%A3:%E6%89%8B%E5%86%8C:1-4-0
compositor Bloom
{
technique
{
// Temporary textures
texture scene target_width target_height PF_A8R8G8B8
texture rt0 128 128 PF_A8R8G8B8
texture rt1 128 128 PF_A8R8G8B8
target scene
{
// Render output from previous compositor (or original scene)
input previous
}
target rt0
{
// Start with clear texture
input none
// Vertical blur pass
pass render_quad
{
// Renders a fullscreen quad with a material
material PostFilters/Blur0
input 0 scene
}
}
target rt1
{
// Start with clear texture
input none
// Horizontal blur pass
pass render_quad
{
// Renders a fullscreen quad with a material
material PostFilters/Blur1
input 0 rt0
}}
target_output
{
// Start with clear output
input none
// Draw a fullscreen quad
pass render_quad
{
// Renders a fullscreen quad with a material
material PostFilters/BloomBlend
input 0 scene
input 1 rt1
}
}
}
}//这些空格好难排啊使用
CompositorManager::getSingleton().addCompositor(viewport, compositorName);
CompositorManager::getSingleton().setCompositorEnabled(viewport, compositorName, enabledOrDisabled);
这是一个bloom的compositor里面包含一个technique
technique里面包含三个target在开始的地方有声明格式
第一个target scene根据input参数[code]previous 表示 是从上个viewport自动获取 (或者啥啥的自己google)
第二个target rt0 input为空但是它的pass的input 为scene 采用material
PostFilters/Blur0后面介绍 shader就在这里面和material脚本那套一样[/code]
第三个 target rt1 input为空 它的pass以rt1如输入 用materail的PostFilters/Blur1实现
最后一个target 输出了不用指定格式 套路同上
下面分析一个 这是新版本里面的blur的material不是一套的material Ogre/Compositor/BlurH
{
technique{pass
{
cull_hardware nonecull_software nonedepth_check off
fragment_program_ref BlurH_ps
{}
vertex_program_ref Blur_vs
{}
texture_unit
{
tex_coord_set 0
tex_address_mode
clampfiltering trilinear}}}}
这里面加了两个shaderBlurH_ps Blur_vs[/code]
相关文章推荐
- Ogre RT Shader System
- 将Shader嵌入Ogre(固定渲染管线到可编程渲染管线)
- Ogre Atomsphere shader
- [转]Shader Editor的设计原理(OGRE)
- 将Shader嵌入Ogre(固定渲染管线到可编程渲染管线)
- Ogre材质shader模版,包括如何设置uniform参数
- Ogre 中替换现有材质中的 shader
- Ogre 实时shader系统, RT Shader System in OGRE 1.7.0
- 地形的构建ogre地形shader 析解
- Ogre shader中定义 param_named_auto custom, 材质中纹理操作
- 第七章 OGRE中的材质以及shader
- RT Shader System in OGRE 1.7.0 .
- ogre 使用 shader 要自己做一些mesh 的顶点声明等操作
- 将Shader嵌入Ogre(固定渲染管线到可编程渲染管线)
- Ogre Texture 格式 以及在 Shader中的区别
- Shader 程序在OGRE中的应用
- Ogre 中使用自定义shader(glsles)
- 将Shader嵌入Ogre
- RT Shader System in OGRE 1.7.0
- 将Shader嵌入Ogre(固定渲染管线到可编程渲染管线)