Hi Polycount!
intro: I've been a longtime lurker on Polycount, but haven't ever posted my stuff. I'd like to change that, as I've got a topic i'd love to discuss with the broader game artist community:
Color ID maps (#colorID maps)- why they're possible in other programs such as substance Painter, but not feasible in UE4 (to my knowledge)
What I've tried: I essentially made three scripts which I'll post here:
the first: the Color ID mask:
This gets the texture and the colorID and masks out the area where the color matches (within a threshold)
the second: the texture merger:
the third: the Master material itself- a conglomerate of all materials masked and merged
The Meat:still with me? Essentially the master material uses the texture merger to merge all 5 textures to one based on their masking. it does this for albedo, metalness, etc.
however, It wasn't until i started separating the input names (m1_albedoInput) that i got a fateful warning: "error X4510: maximum ps_5_0 sampler register index (16) exceeded- AKA: HLSL shaders have a maximum of 16 textures usable per material. "UGH"- This renders my entire (albeit HEAVY, still functional) useless since 5 materials would require 25 textures, etc: it's not scalable.
which makes me wonder how it's possible in other applications like substance, and why they're useful if you can't really bring them into engine anyways.
Further thinking: How would you do a mixed material setup without different instance IDs? (without having to model for material painting) - how do programs like substance handle it without being limited?
//Robin Lloyd-Miller AKA ARCADELY
Replies
What you're doing in UE4 is loading everything onto the GPU then combining pixel output to the screen rather than writing a new texture object to memory or disk. Very different limitations.
A colorID map is completely feasible in UE4, but you have to be aware of how you're setting things up and the limitations of realtime hardware.
For your case I'd suggest using the layered material workflow that UE4 has built in
https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/LayeredMaterials/index.html
https://wiki.unrealengine.com/Creating_Layered_Materials_(Tutorial)
It does basically what you're trying to do here but has a lot of existing node support already created.
It may not actually get around the limit you're hitting, though I am curious as to how each material would wind up needing 5 textures? Perhaps you can do more with each texture?
//ARCADELY
https://forums.unrealengine.com/showthread.php?85868-Texture-samplers-limitation-is-still-present-in-4-9