Hello,
I want to apply specific sets of shaders on one object. For example:
Object 1 - displacement, object motion blur.
Object 2 - color pass, object motion blur.
How can I do this ?
Multiple shaders on one object
Re: Multiple shaders on one object
You can either give your object different materials or you can pass per-object parameters to your shaders and switch in there.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Competition winner
- Posts: 523
- Joined: Tue Jan 15, 2013 6:36 pm
Re: Multiple shaders on one object
I was wondering this also I have been making and improving shaders and I did notice that you can not apply more than one shader to an object or 1 node. For example:
Will allow you set apply the shader to different materials on your node. However if you want an object to use another shader for lets say arms and legs, setting will not work I'm not sure why my guess could be that the first line of code is trying to apply that one shader to the whole object, and is overriding the second line of code. Though I have tried , , but that doesn't work either, so I assumed you could only use one shader per node or object.
Code: Select all
node->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType2);
Code: Select all
node>getMaterial(2).setMaterialType((video::E_MATERIAL_TYPE)newMaterialType1);
Code: Select all
node>getMaterial(1).setMaterialType((video::E_MATERIAL_TYPE)newMaterialType1);
Code: Select all
node>getMaterial(2).setMaterialType((video::E_MATERIAL_TYPE)newMaterialType2);
Re: Multiple shaders on one object
Well I see... Its not possible to apply several shaders to one object...
And what about multiple passes?
Shelling requires HLSL script support but as irrlicht will most likely wont support it either, I would like to know if I can make the shader execute multiple passes in one rendering?
And what about multiple passes?
Shelling requires HLSL script support but as irrlicht will most likely wont support it either, I would like to know if I can make the shader execute multiple passes in one rendering?
Re: Multiple shaders on one object
Well, the important code is 'node->render', so if you write your own render loop, you can render multiple times.
But, why do you need more than one shader? Just combine all your shaders into one and set some uniforms.
But, why do you need more than one shader? Just combine all your shaders into one and set some uniforms.
Re: Multiple shaders on one object
Shaders are materials. So I think you can set as many shaders as your project has materials (or meshbuffers).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm