esger.abbink_ Posted August 9, 2012 Posted August 9, 2012 Hi, doing an evaluation of Unigine and its suitability for our purposes. At the moment I am still just busy trying to get it to load our existing content. Which goes mostly fine except for some material details. I import everything for now with "mesh_base" as material and set the diffuse texture with Object::setMaterialTexture to whatever our model says it should. (On a sidenote, does this function as a material parameter or does it create a sort of implicitly inherited new material?) I already tried some things with our custom shaders and Object::setMaterialParameter seems to work fine as well. It is with the stuff on the 'common' tab that I run into problems. For instance I have a scene where several objects should be alpha tested. If I load that scene and go into the editor I can set "Alpha Test" to checked for each surface that needs it without it affecting other surfaces using the same material. So similar operation to textures, states and parameters. However, I can't seem to find the appropriate function to do the same from C++ or script? Object::setLightMask, Object::setViewportMask, Object::setCast(World)Shadow are there, but order, offset, and most of the other checkable options seem to be missing?
ulf.schroeter Posted August 9, 2012 Posted August 9, 2012 Use Object::getMaterial(int surface) or Object::getMaterialInherit( int surface) to get the underlying Material instance for attribute modification from UNIGINE script. Unfortunately there is no access to material instance from C++;
esger.abbink_ Posted August 12, 2012 Author Posted August 12, 2012 Thanks!, that works. Is there any difference (performance wise or other) between an instanced/implicitly inherited material and an explicitly inherited material?
ulf.schroeter Posted August 12, 2012 Posted August 12, 2012 Performance-wise only the total number of different used materials has an impact as required state changes increase draw call count. Nevertheless I would expect that usage of explicitly inherited material hiearchies tend to give better performance when reused as much as possible for rendering of multiple objects/surfaces. Implicitly inherited materials might lead to highly increased total number of material instances (= requires state changes, breaks batching, bad performance-wise) without the user really being aware of this fact.
Recommended Posts