Integrating shaders into a pipeline
Integrating shaders into a pipeline
I've done a lot of searching on the forums and Google, and I haven't found an answer.
DirectX .x files have the ability to save shader information into them, but from a bunch of tests and browsing the source code, it doesn't look like Irrlicht loads them. How can you integrate shaders in such a way that you don't need to explicitly specify them for specific objects in code?
It would be ideal to be able to model everything in Max/Maya and export the model as a .x (which they already can), and have Irrlicht load up the shader information so that the shaders can be specified via Max & Maya (which I don't think it can).
Is there any best way to handle attaching shaders to models without having to specify them myself in code? (so that artists can model and attach the shaders themselves)
Any help is greatly appreciated!
Edit: If there are any other formats that save shader information (the only one I know of is .x) it would be useful to know also. However, the .x format would be ideal.
DirectX .x files have the ability to save shader information into them, but from a bunch of tests and browsing the source code, it doesn't look like Irrlicht loads them. How can you integrate shaders in such a way that you don't need to explicitly specify them for specific objects in code?
It would be ideal to be able to model everything in Max/Maya and export the model as a .x (which they already can), and have Irrlicht load up the shader information so that the shaders can be specified via Max & Maya (which I don't think it can).
Is there any best way to handle attaching shaders to models without having to specify them myself in code? (so that artists can model and attach the shaders themselves)
Any help is greatly appreciated!
Edit: If there are any other formats that save shader information (the only one I know of is .x) it would be useful to know also. However, the .x format would be ideal.
I've asked this similar question in the past, I think what you are thinking of is a shader parser, where Irrlicht reads the materials on an object and if say Fur shader was applied to material index 0 then Irrlicht would setup a shader for that materal and faces only and perhaps you'd applied glow to another set of faces/materal, so you end up with a multi-shader object. This is what next gen engines do and something noone has done on here, I tried but simply couldn't wrap my head around it.
Irrlicht's per-face texturing from .x files is borked.
As a result, since THAT'S something that I don't want to fix, I'll only be adding the ability to add one shader per mesh. I don't think that's so bad though--I hear from artists that it's bad practice to use materials on a per-face basis on a mesh anyway. The preferred way is to have a single material that completely UV maps onto a model.
As a result, since THAT'S something that I don't want to fix, I'll only be adding the ability to add one shader per mesh. I don't think that's so bad though--I hear from artists that it's bad practice to use materials on a per-face basis on a mesh anyway. The preferred way is to have a single material that completely UV maps onto a model.
yeah it's ideal to have one texture for as much of a model as possible, but as slaine says it's useful to be able to have different parts of a model with different materials.
take the fur shader example, you may have a bear model and you might want a fur shader to cover its body, but you wouldnt want that fur to cover, say, its teeth and eyes etc so you'd need different shaders/materials for those.
as hybrid says though, it's possible, you just have multiple mesh buffers. each mesh buffer has one material so if you want more than one material you seperate each face into the required mesh buffer with that material, the .x loader does all this for you.
take the fur shader example, you may have a bear model and you might want a fur shader to cover its body, but you wouldnt want that fur to cover, say, its teeth and eyes etc so you'd need different shaders/materials for those.
as hybrid says though, it's possible, you just have multiple mesh buffers. each mesh buffer has one material so if you want more than one material you seperate each face into the required mesh buffer with that material, the .x loader does all this for you.
I haven't yet gotten Irrlicht to load up a .x file with textures applied to specific faces of the mesh using 3ds max and Panda exporter. Some vertices are out of wack and go to either 0 or infinity.
Maybe I'm missing something big, but I'm looking at the source for the x. loader, and it doesn't parse "EffectInstance" blocks at all from .x files, meaning that you can't parse .fx files that have been linked to parts of the mesh.
@ hybrid: I know you can do this through the code, but I'm trying to get this done with the pipeline
max/maya => .x exporter => Irrlicht
instead of specifying materials, even shader materials, explicitly through code. Specifying non-.fx materials works for some formats in Irrlicht, like .3ds, but NOT for .x files judging from the 10 or so quick tests that I did.
@ JP: The .x loader doesn't do anything with EffectInstance blocks, which is responsible for specifying .fx shaders.
Maybe I'm missing something big, but I'm looking at the source for the x. loader, and it doesn't parse "EffectInstance" blocks at all from .x files, meaning that you can't parse .fx files that have been linked to parts of the mesh.
@ hybrid: I know you can do this through the code, but I'm trying to get this done with the pipeline
max/maya => .x exporter => Irrlicht
instead of specifying materials, even shader materials, explicitly through code. Specifying non-.fx materials works for some formats in Irrlicht, like .3ds, but NOT for .x files judging from the 10 or so quick tests that I did.
@ JP: The .x loader doesn't do anything with EffectInstance blocks, which is responsible for specifying .fx shaders.
Yeah the multi shader system is imperative, I've worked in the games industry for years and the engines they use do this. The bear example is a classic You simply can't do cutting edge effects with Irrlicht yet, until someome writes what JP said, a system which reads the seperate objects into a buffer, reads it's information on what shader it uses, then creates it in Irrlicht, this is something which IrrEdit is crying out for! Just applying lightmapping to a level just isn't enough, this has been done for years.
Another example, and really quite serious is level creation! How do you apply the correct shaders for seperate areas of your level, you can't, hense it looks naff compared to modern games! If someone writes this system for Irrlicht it will make a MASSIVE jump.
Another example, and really quite serious is level creation! How do you apply the correct shaders for seperate areas of your level, you can't, hense it looks naff compared to modern games! If someone writes this system for Irrlicht it will make a MASSIVE jump.
I think it can be done...if they can be broken down into code-able pieces, though.
The Shader model I know is basically a rip-off from Maya. But I'm guessing there are others out there that have better shader models. For example, ATI's RenderMonkey or Nvidia's (can't remember it at the moment). I'm using a 3850 at home and an 8500 at work.
I know in Irrlicht a material type can be set to a shader, the default is basically setting a shader to all materials of a node.
I remember playing around with materials in Blender 2.45, I was able to define material names like head, left_arm, right_arm, torso, left_leg, etc. Then I was able to set attributes to it later. Exported it to obj, loaded it in Irrlicht and set the material type to them.
The Shader model I know is basically a rip-off from Maya. But I'm guessing there are others out there that have better shader models. For example, ATI's RenderMonkey or Nvidia's (can't remember it at the moment). I'm using a 3850 at home and an 8500 at work.
I know in Irrlicht a material type can be set to a shader, the default is basically setting a shader to all materials of a node.
I remember playing around with materials in Blender 2.45, I was able to define material names like head, left_arm, right_arm, torso, left_leg, etc. Then I was able to set attributes to it later. Exported it to obj, loaded it in Irrlicht and set the material type to them.
Yeah definatly, but this needs to be done within a 3D app, like Milkshape, 3dsmax, Maya, not with code. Elseways you'd have to hard code your characters and levels to have multi suface effectsdlangdev wrote:Maybe the shader demo can be modified to show two sides of a cube having a blinn shader and the other side a lambert.hybrid wrote:You can apply materials - even shader based ones - to only parts of a mesh. Even if the examples don't show it, it's still possible.
Hi Slaine,
Good luck on Ogre, hope you get what you're looking for. I wish I had the time to play with Ogre.
I'm still doing research about shader-material binding on Irrlicht. I think a visor (that's what they call it in Maya) is needed so that I can pull-up the shader and attach it to an attribute. The thing is, the Irrlicht object model has no attributes. Big problem right there.
Once I get a good view of how it fits nicely it will eventually come together. I need more time to know the finer details.
Good luck on Ogre, hope you get what you're looking for. I wish I had the time to play with Ogre.
I'm still doing research about shader-material binding on Irrlicht. I think a visor (that's what they call it in Maya) is needed so that I can pull-up the shader and attach it to an attribute. The thing is, the Irrlicht object model has no attributes. Big problem right there.
Once I get a good view of how it fits nicely it will eventually come together. I need more time to know the finer details.