I would like to add color ID maps to three.js, similar to the technique available in Substance Painter:
The result must also be composited with the MeshStandardMaterial, such that the color map is added, then multiple layers of id maps are applied on top of that. (then the subsequent PBR elements added as standard).
I envisage that up to 4 id maps could be contained (per channel) in a single jpg image. Each channel being the alpha value of the applied color where 0x00 is invisible and 0xFF is fully visible. A color parameter would then be passed (per channel) and applied to the fragment shader, altering the color at runtime.
Here is some pseudo code for the API that might make sense:
// load an id map with 4 separate channels
IdMapTexture texture = (IdMapTexture)mTextureLoader.load(path, callback);
MeshStandardIdMapMaterial material = new MeshStandardIdMapMaterial();
material.idMaps[0] = texture;
// apply colors to the channel via the fragment shader
material.idMaps[0].color0 = new Color(0x336699);
material.idMaps[0].color1 = new Color(0xFF0099);
material.idMaps[0].color2 = new Color(0x640971);
material.idMaps[0].color3 = new Color(0x216647);
// apply the material to the mesh
mesh.material = material;
My question boils down to 3 main topics (Highest == best).
- Is there anything like this already available?
- Is there any compositing technique that could make building this more structured/simplistic?
- Is there a standard way/tools for extending MeshStandardMaterial for three.js?
Regards