1
\$\begingroup\$

At the moment I am contemplating adding character customisation to my game, however I am unsure what approaches are available when it comes to using textures/decals to add facial features (like facial hair, hairstyle, scars/blemishes etc).

The character in question is stylised with a cel shader like effect.

So what are some approaches to take? Should I be using shaders to blend textures together by having the normal diffuse texture and then a mask texture to add facial hair or are there better more efficient results to achieve what I want?

Would another possibility be to use a shader and then bake the resultant blended texture to a new diffuse texture and use that?

To clarify, the customisation will be through textures only and not through adding/changing meshes

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Those approaches both sound viable. Which one is better suited to your game's needs is a question that you are in a better position to answer than we are at present. Since our Q&A format isn't well-suited to open-ended lists of suggestions, I expect you'll get better answers if you can narrow this down to a specific problem to solve. Like "I tried using method C, but my framerate suffered in this particular way according to the profiler" or "When I have 50 customized characters in a scene the memory use is too high." \$\endgroup\$
    – DMGregory
    Commented Jan 4, 2018 at 8:28
  • \$\begingroup\$ Ah, well that was what I was kind of getting at, I am struggling to think of what would be reasonably efficient methods of creating this customisation \$\endgroup\$ Commented Jan 4, 2018 at 13:46
  • \$\begingroup\$ "Efficient" by what metric? Have you encountered an inefficiency that's impacting your game negatively? If not, then it's hard to say whether overdraw, fragment shader complexity, texture memory, or something else entirely is the limiting factor we need to optimize for. Or maybe your target hardware can handle all of the above without breaking a sweat, and it's actually code complexity for the programmer or asset creation pipelines for the artist that need the most love. This is why it's important to prototype & profile, to identify what specific problems need to be solved. \$\endgroup\$
    – DMGregory
    Commented Jan 4, 2018 at 13:59

1 Answer 1

3
\$\begingroup\$

For "efficiency" in broad strokes, you generally want to avoid state changes where possible and reduce your draw calls as much as possible.

For a feature-customization implementation that does not rely on any additional geometry and is handled entirely via textures, that probably means you want to avoid switching textures often (in other words, probably not baking a bunch of per-character textures).

Which means you'll likely want to group each character into two logical draws: the one drawing the part of the characters that cannot be customized, and the one drawing the parts that can be.

You'd likely want to pack as many different possible features into one texture as you can get away with given your desired quality bar. You might stuff all the beards into one column, for example, all the sideburns into another, and so on. Kind of like a sprite sheet.

That way you can represent the customization as texture coordinate offsets (directly in prepared vertex buffers, or via instance attributes, whichever works better for you) and still draw lots of it in one go.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You could also use texture packing to do more of this as well right (assuming you are using a black white mask in the shape of the beard to render for example) meaning you could layer different beard types in each channel and color the beard using a shader or an additional texture map \$\endgroup\$ Commented Jan 5, 2018 at 0:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .