Hi all,
I've started diving into the wonderful world of PBR, currently my engine uses ‘oldskool’ non-PBR, so my materials have a diffuse map, normal map, metal true/false and a bunch of color values.
Before I dive into updating my shaders, I've tried to define a new data structure for my materials, ready for PBR.
Goal:
- have 1 material data structure I can use for ALL materials
- all being:
1. ‘legacy’ materials for which I don't have the needed maps
2. PBR materials, metal
3. PBR materials, non-metal
Data structure:
Texture: Albedo
Texture: Normal map
Texture RGB grayscales: Roughness/ AO/ displacement(height) + A → metallic (0-1)
Shaderpack reference
The plan I have for the materials that only have albedo/normal map, is to create a full white (metal) or full black (non-metal) metallic map. For the roughness map either black - grey (0.5) or white, depending on the material. By doing this I can use 1 'code path' in the shader to handle them all.
My questions:
- Am I overseeing things in the data structure/ missing stuff?
- Some materials I have don't have an AO or displacement map, I can either leave them out and add some bools if the material has them (if not skip that part of shader) OR create them somehow and process ALL materials the same way. Performance wise I'd say skip them, but what do you think?
- Is there a best practice in creating different shaders/code paths for materials with or without certain maps being available for the material? (or is it common to just make sure you have them all for all materials)
- Some of my materials / texture sets, have a specular map instead of metallic, (how) can I convert those to a metallic map? (I do have all other maps for those materials)
To be sure, I'm going for the metallness workflow (not specular).
Any input is appreciated.