PBR materials, data structure

Started by
2 comments, last by cozzie 3 years ago

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:

  1. Am I overseeing things in the data structure/ missing stuff?
  2. 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?
  3. 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)
  4. 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.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Advertisement

cozzie said:
have 1 material data structure I can use for ALL materials

Basically i have the same plan than you, but i'm unsure how practical this is. So i'd like to add to the question what materials still need custom shaders / textures usually. E.g. anisotropy for hair, or SSS extra data for skin…. what else?

Quick update, I think this structure should cover it all:

  • PBR material data-structure
  • Shaderpack override
  • Texture: diffuse/albedo
  • Texture: normal map
  • Texture: roughness/AO/disp + metallic (RGB grayscale, A on/off)
  • Bool fullMetal (false -> no need to fetch metallic map)
  • Bool fullNonMetal (false -> no need to fetch metallic map)
  • Specular, float (non metals)
  • Bool hasDisplacementMap (skip displacement in shader, mainly old non PBR materials)
  • Bool hasAOmap (skip A.O. in shader, mainly old non PBR materials)

This should cover all materials including the ones for which I don't have a full PBR maps set. The minimum amount of maps is 3 (albedo/normal/roughness), max 6 (all of them). I can still skip normal mapping if their's none set for the material.

The only thing I need to figure out is how to get 3 (or 4) source images into 1 DDS texture. Won't work with texconv, probably need gimp or something for that. If someone knows a tool that'll work, let me know (tried dxtex, but there you can only load an image onto the alpha surface, not R/G/B individually).

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement