Jump to content

Manual material issues


photo

Recommended Posts

Posted (edited)

I am facing some issues handling manual materials. Till Unigine 2.3.1 we always edit the materials manually and when porting to 2.6.1 I have made all individual materials as manual="1", but having some doubts about there use

  • Is it necessary to have "mesh_base" field even if I have mentioned "parent_name" ?
    • <material version="2.6" manual="1" name="abc" parent_name="def">

      def.mat also has manual="1"

    • This shows error "Material::loadXml(): base material not found in material"

  • Is it mandatory to have a parameter in base even if it is not used there?

    • ----------hij.mat------
      <?xml version="1.0" encoding="utf-8"?>
      <material version="2.6" manual="1" name="hij" base_material="klm">
      	<blend src="src_alpha" dest="one_minus_src_alpha"/>
      	<options two_sided="1"/>
      	<shader pass="ambient" node="object_mesh_dynamic" 
      			vertex="shaders/hij.vert"
      			fragment="shaders/hij.frag" />
      	<parameter name="param1" type="slider" shared="1">1</parameter>
      	<options viewport_mask="1"/>
      </material>
      
      ----------klm.basemat------
      
      <?xml version="1.0" encoding="utf-8"?>
      <base_material version="2.6" manual="1" name="klm">
      	<options node="object_mesh_dynamic" transparent="2"  order="1"/>
      	<blend src="src_alpha" dest="one_minus_src_alpha"/>
      	<state name="deferred">0</state>
      	<shader pass="ambient" node="object_mesh_dynamic"
      			vertex="shaders/klm.vert" 
      			fragment="shaders/klm.frag" />
      </base_material>

      In above code I am using "param1" in hij.vert shader

    • This shows error Material::load(): can't find "param1" parameter in "hij" material 

 

 

Please help me understand the concepts. I do not find much of the samples for manual materials and unable to build good understanding by documentation. 

Edited by Priyank.Jain2
removed mesh_base from the abc material
Posted

Hi Priyank,

I'm afraid without a test scene it will be hard to help. Could you please send us minimal required test scene so we can also debug on our side and suggest the right solution for you?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted (edited)

Sure Silent I will provide you with sample code but till then can you please answer this

  • Can we add <shader> element in custom user material? (.mat file with manual="1")
  • Can we add new <parameter> to custom user materials  (.mat file with manual="1") or is it only meant to override the parent materials parameters?
Edited by Priyank.Jain2
Posted

Hi Priyank.Jain2!

To previous post:

1) No, user material can't refer to a shader. user material only can override properties from it base material. The manual user material is the same as uset manual material with small difference: it can be created without editor (no need GUID to specify parent).

2) No, a set of user material properties (states. textures, parameters) cannot differ from properties of the referred base material.

To original post:

1) You should also specify base_material attribute.

2) For you "hij" material you should create base material to refer a shader.

Posted (edited)

Thanks for the clarification Consta,

Does this means If I need to add my custom shader then then I have to create a base_material (.basemat)?

If yes, then it will be unnecessary overhead every time we upgrade to new version of Unigine. Till 2.3.1 I had the flexibility to override only few passes but looks like now on I have to copy-paste rest of the passes from the base_material and change only the desired one.

Edited by Priyank.Jain2
×
×
  • Create New...