support for multi-pass shader
-
- Posts: 70
- Joined: Sat Dec 17, 2005 4:43 pm
- Location: licata (AG) italy
- Contact:
support for multi-pass shader
is irrlicht able to process multi-pass shader?
Bye all,
Mancuso Raffaele (Ares FPS game)
Mancuso Raffaele (Ares FPS game)
-
- Posts: 135
- Joined: Thu Oct 30, 2008 11:56 am
- Location: UK
- Contact:
Well, how do you think I implemented this fur multipass shader in Irrlicht, like three years ago?thespecial1 wrote:not yet ;0)
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
Maybe show us some code how is this done?
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Without giving you code (I'm about to leave for somewhere at the moment), basically you render your object to a render target texture. Then you set that texture to the material of a quad (a pair of triangles), and you set your second pass shader to the material type of that quad. If you need additional passes, you just keep rendering to a render target texture and applying it to a quad, then re-rendering.
Isn't that how post-effect shaders are done?
What if I'd like to use 2 shaders: one for terrain rendering and another one for lighting? I assume you have to do at least 2 passes, one for every shader. But then, how do you combine the two resulting textures? Do you just take pixel[0,0] from first texture, then the same pixel from second texture and just * them? Or is this blending done in next, third shader pass?
What if I'd like to use 2 shaders: one for terrain rendering and another one for lighting? I assume you have to do at least 2 passes, one for every shader. But then, how do you combine the two resulting textures? Do you just take pixel[0,0] from first texture, then the same pixel from second texture and just * them? Or is this blending done in next, third shader pass?
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
The only poblem is that this is slower thandefault multipassing or backbuffer acess.
Here is Sio2's examples:
http://sio2.g0dsoft.com/modules/wmpdown ... .php?cid=1
Some are open sourced, other are not.
Here is Sio2's examples:
http://sio2.g0dsoft.com/modules/wmpdown ... .php?cid=1
Some are open sourced, other are not.
OK, so I'm trying to do a very simple thing: draw entire scene onto a plane before the camera. But it somehow does not render the plane, or the plane is transparent. The plane is right before the camera, I checked.
Code: Select all
class CRenderer{
private:
ISceneManager* smgr;
IVideoDriver* video;
IGPUProgrammingServices* gpu;
ISceneNode* plane;
ITexture* finalRender;
public:
CRenderer(stringc folderPath, ISceneManager* nsmgr)
{
smgr= nsmgr;
video= smgr->getVideoDriver();
gpu= video->getGPUProgrammingServices();
finalRender= video->addRenderTargetTexture(video->getCurrentRenderTargetSize());
SMaterial* planeMat= new SMaterial;
planeMat->setTexture(0, finalRender);
IMesh* planeMesh= smgr->getGeometryCreator()->createPlaneMesh(dimension2d<f32>(1.94,1.94* (3.0/4.0)), dimension2d<u32>(1,1), planeMat, dimension2d<f32>(1,1));
plane= smgr->addMeshSceneNode(planeMesh, smgr->getActiveCamera());
plane->setMaterialFlag(EMF_LIGHTING, false);
plane->setPosition(vector3df(0, 0, 1));
plane->setRotation(vector3df(-90, 180, 0));
}
void render()
{
//array<ISceneNode*>nodes;
//smgr->getSceneNodesFromType(ESNT_ANY, nodes);
video->beginScene(true, true);
video->setRenderTarget(finalRender, true, true, SColor(255,100,0,0));
plane->setVisible(false);
smgr->drawAll();
video->setRenderTarget(0, true, true, SColor(255,0,0,100));
plane->setVisible(true);
plane->render();
smgr->getGUIEnvironment()->drawAll();
video->endScene();
}
};
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Could this be caused by 'Unsupported texture format' which is printed out when trying to do finalRender= video->addRenderTargetTexture(video->getCurrentRenderTargetSize());
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
NO! I used a mulipass material. I even put it in bold!ACE247 wrote:Render Targets...
NO RENDER TARGETS.
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781