[Solved] Default material fallback for material schemes?
Posted: Sun Apr 06, 2008 7:00 am
Hi
I didn't know wether to post this in Developer Talk or here, but I think its more of a debate than a bug, so I decided to post here.
The subject is materical schemes, more specifically, how objects without scheme-specific data deal with them.
Currently, in order for a material scheme to work properly, all renderables in the scene need to implement this scheme. Renderables that don't are rendered normally. Lets say I want to do something like a depth pass from the camera's POV. I would need for all of the objects to have a "Depth Render" scheme defined. This either means re-writing the depth definition (bad) or inheriting from a base interface (better).
This means that in order for the scheme to work properly, all materials have to inherit from a shared material.
This works, but the entire application has to be aware of the potential schemes that are in use. Programatically created materials, for example, now also have to be aware of this base materials. And what happens when I want to have more than one scheme? It quickly becomes annoying to maintain, and isn't modular in my opinion.
I would prefer something more along the lines of how shadows work. There is a default shadow caster / shadow receiver material that can be set globally, and materials that don't define custom behavior get it.
This model should be used with material schemes in my opinion. There should be a function along the lines of
We would then be able to set a shared material (used material and not technique for capability fallback purposes) for a scheme, without the other objects having to know about it. They can still implement custom functionality by implementing a technique for this scheme, but there will be a more suitable fallback than their default rendering material.
What do you guys think?
I might implement this locally. If I do I'll post a wiki entry or something. But the question is, should this be in the main Ogre branch?
I didn't know wether to post this in Developer Talk or here, but I think its more of a debate than a bug, so I decided to post here.
The subject is materical schemes, more specifically, how objects without scheme-specific data deal with them.
Currently, in order for a material scheme to work properly, all renderables in the scene need to implement this scheme. Renderables that don't are rendered normally. Lets say I want to do something like a depth pass from the camera's POV. I would need for all of the objects to have a "Depth Render" scheme defined. This either means re-writing the depth definition (bad) or inheriting from a base interface (better).
This means that in order for the scheme to work properly, all materials have to inherit from a shared material.
Code: Select all
material BaseMaterial
{
technique
{
//Original technique
}
technique DepthTechnique
{
scheme DepthRender
//....
}
}
I would prefer something more along the lines of how shadows work. There is a default shadow caster / shadow receiver material that can be set globally, and materials that don't define custom behavior get it.
This model should be used with material schemes in my opinion. There should be a function along the lines of
Code: Select all
MaterialManager::setDefaultSchemeMaterial(const Ogre::String& schemeName, const Ogre::String& defaultMaterialName)
What do you guys think?
I might implement this locally. If I do I'll post a wiki entry or something. But the question is, should this be in the main Ogre branch?