OGRE Bloom全屏柔光

搜索了一下cg文件,才发现有这个文件,

shader实现的bloom全屏柔光效果,有点朦胧,感觉没漩涡鸣的清晰啊

混了2次太模糊了.应该做成blur,囧

这fps掉得真快...

 

OGRE Bloom全屏柔光_第1张图片 

由于搜狐并没有提供合成器脚本,所以要我们自己代码实现合成器

 

我发出自己实现的源码,模糊版本:

[cpp] view plain copy print ?
  1. // bloom   
  2. CompositorPtr comp = CompositorManager::getSingleton().create("Bloom""TLBB");  
  3. {  
  4.     CompositionTechnique *t = comp->createTechnique();  
  5.     {  
  6.         CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("rt0");  
  7.         def->width = 0;  
  8.         def->height = 0;  
  9.         def->format = PF_R8G8B8;  
  10.     }  
  11.     {  
  12.         CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("rt1");  
  13.         def->width = 0;  
  14.         def->height = 0;  
  15.         def->format = PF_R8G8B8;  
  16.     }  
  17.     {  
  18.         CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("rt2");  
  19.         def->width = 0;  
  20.         def->height = 0;  
  21.         def->format = PF_R8G8B8;  
  22.     }  
  23.     {  
  24.         CompositionTargetPass *tp = t->createTargetPass();  
  25.         tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);  
  26.         tp->setOutputName("rt1");  
  27.     }  
  28.     {  
  29.         CompositionTargetPass *tp = t->createTargetPass();  
  30.         tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);  
  31.         tp->setOutputName("rt2");  
  32.     }  
  33.     {  
  34.         CompositionTargetPass *tp = t->createTargetPass();  
  35.         tp->setInputMode(CompositionTargetPass::IM_NONE);  
  36.         tp->setOutputName("rt0");  
  37.         CompositionPass *pass = tp->createPass();  
  38.         pass->setType(CompositionPass::PT_RENDERQUAD);  
  39.         pass->setMaterialName("PostFilters/Bloom/Blur");  
  40.         pass->setInput(0, "rt1");  
  41.     }  
  42.     {  
  43.         CompositionTargetPass *tp = t->createTargetPass();  
  44.         tp->setInputMode(CompositionTargetPass::IM_NONE);  
  45.         tp->setOutputName("rt1");  
  46.         CompositionPass *pass = tp->createPass();  
  47.         pass->setType(CompositionPass::PT_RENDERQUAD);  
  48.         pass->setMaterialName("PostFilters/Bloom/Blur");  
  49.         pass->setInput(0, "rt0");  
  50.     }  
  51.     {  
  52.         CompositionTargetPass *tp = t->getOutputTargetPass();  
  53.         tp->setInputMode(CompositionTargetPass::IM_NONE);  
  54.         { CompositionPass *pass = tp->createPass();  
  55.         pass->setType(CompositionPass::PT_RENDERQUAD);  
  56.         pass->setMaterialName("PostFilters/Bloom/Final");  
  57.         pass->setInput(0, "rt2");  
  58.         pass->setInput(1, "rt1");  
  59.         }  
  60.     }  
  61. }  
// bloom CompositorPtr comp = CompositorManager::getSingleton().create("Bloom", "TLBB"); { CompositionTechnique *t = comp->createTechnique(); { CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("rt0"); def->width = 0; def->height = 0; def->format = PF_R8G8B8; } { CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("rt1"); def->width = 0; def->height = 0; def->format = PF_R8G8B8; } { CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("rt2"); def->width = 0; def->height = 0; def->format = PF_R8G8B8; } { CompositionTargetPass *tp = t->createTargetPass(); tp->setInputMode(CompositionTargetPass::IM_PREVIOUS); tp->setOutputName("rt1"); } { CompositionTargetPass *tp = t->createTargetPass(); tp->setInputMode(CompositionTargetPass::IM_PREVIOUS); tp->setOutputName("rt2"); } { CompositionTargetPass *tp = t->createTargetPass(); tp->setInputMode(CompositionTargetPass::IM_NONE); tp->setOutputName("rt0"); CompositionPass *pass = tp->createPass(); pass->setType(CompositionPass::PT_RENDERQUAD); pass->setMaterialName("PostFilters/Bloom/Blur"); pass->setInput(0, "rt1"); } { CompositionTargetPass *tp = t->createTargetPass(); tp->setInputMode(CompositionTargetPass::IM_NONE); tp->setOutputName("rt1"); CompositionPass *pass = tp->createPass(); pass->setType(CompositionPass::PT_RENDERQUAD); pass->setMaterialName("PostFilters/Bloom/Blur"); pass->setInput(0, "rt0"); } { CompositionTargetPass *tp = t->getOutputTargetPass(); tp->setInputMode(CompositionTargetPass::IM_NONE); { CompositionPass *pass = tp->createPass(); pass->setType(CompositionPass::PT_RENDERQUAD); pass->setMaterialName("PostFilters/Bloom/Final"); pass->setInput(0, "rt2"); pass->setInput(1, "rt1"); } } }

 

// 做一次,清晰不少:

 

[cpp] view plain copy print ?
  1. // bloom   
  2. CompositorPtr comp = CompositorManager::getSingleton().create("Bloom""TLBB");  
  3. {  
  4.     CompositionTechnique *t = comp->createTechnique();  
  5.     {  
  6.         CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("");  
  7.     }  
  8.     {  
  9.         CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("");  
  10.     }  
  11.     {  
  12.         CompositionTargetPass *tp = t->createTargetPass();  
  13.         tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);  
  14.         tp->setOutputName("");  
  15.     }  
  16.     {  
  17.         CompositionTargetPass *tp = t->createTargetPass();  
  18.         tp->setInputMode(CompositionTargetPass::IM_NONE);  
  19.         tp->setOutputName("");  
  20.         CompositionPass *pass = tp->createPass();  
  21.         pass->setType(CompositionPass::PT_RENDERQUAD);  
  22.         pass->setMaterialName("PostFilters/Bloom/Blur");  
  23.         pass->setInput(0, "");  
  24.     }  
  25.     {  
  26.         CompositionTargetPass *tp = t->getOutputTargetPass();  
  27.         tp->setInputMode(CompositionTargetPass::IM_NONE);  
  28.         { CompositionPass *pass = tp->createPass();  
  29.         pass->setType(CompositionPass::PT_RENDERQUAD);  
  30.         pass->setMaterialName("PostFilters/Bloom/Final");  
  31.         pass->setInput(0, "");  
  32.         pass->setInput(1, "");  
  33.         }  
  34.     }  
  35. }  
// bloom CompositorPtr comp = CompositorManager::getSingleton().create("Bloom", "TLBB"); { CompositionTechnique *t = comp->createTechnique(); { CompositionTechnique::TextureDefinition *def = t->createTextureDefinition(""); } { CompositionTechnique::TextureDefinition *def = t->createTextureDefinition(""); } { CompositionTargetPass *tp = t->createTargetPass(); tp->setInputMode(CompositionTargetPass::IM_PREVIOUS); tp->setOutputName(""); } { CompositionTargetPass *tp = t->createTargetPass(); tp->setInputMode(CompositionTargetPass::IM_NONE); tp->setOutputName(""); CompositionPass *pass = tp->createPass(); pass->setType(CompositionPass::PT_RENDERQUAD); pass->setMaterialName("PostFilters/Bloom/Blur"); pass->setInput(0, ""); } { CompositionTargetPass *tp = t->getOutputTargetPass(); tp->setInputMode(CompositionTargetPass::IM_NONE); { CompositionPass *pass = tp->createPass(); pass->setType(CompositionPass::PT_RENDERQUAD); pass->setMaterialName("PostFilters/Bloom/Final"); pass->setInput(0, ""); pass->setInput(1, ""); } } }

 

 

你可能感兴趣的:(OGRE,图形图像,游戏引擎,图形引擎,游戏开发,引擎开发)