Heya!
I have a 3D model with PBR material that contains a few textures (emissive, albedo,…) and a black and white image that represents areas on the albedoTexture that can change color (white=color can change, black = transparent);
My goal is to find a way to apply this mask onto the material or texture in a way that doesn’t overwrite the original material.
That way one can obtain the same mesh with the same materials and textures, except some regions of the albedoTextures can have dynamic colors.
In Unreal there is the ability to multiply the textures together and allocate the result to the baseColor.
Cheers @carolhmj that’s helpful, although I’m not an expert in the field, might take me a while to understand what to do;
On similar topic, If I go with this route and ever decide to export the model using GLTFExporter, do you think the second color from the mask will export with it?
Heya, IDK any way to export this kind of custom behavior to GLTF, but here’s a simple material plugin you can play with that applies the mask while leveraging the existing PBR material.
Crap that’s amazing! Thanks a lot Blake;
I was gonna spend the day on this and you saved me so much time.
Yeah I’m definitely not 100% sure how such custom behavior can be interpreted when exporting.
Cheers for the help!
Edit:
how would this work with a similar mask but made for Emissive? I have a similar mask and tried to apply the same process for the emissive layer: but I don’t see any of the white spots change color; Note that only some of the white spots should change color https://playground.babylonjs.com/#YI8A3U#8
The shader code for the emissive texture is a bit different, like below… And you could also apply both plugins to the material, but would have to change the uniform names, etc to be unique.
PS I noticed you’re using the same texture for both emissive and mask so all the white parts are changing color, but if you copy the texture and blacken some of the white spots for the mask texture then they should stay white rather than being changed to the replacement color…