Home Technical Talk

Multiple detail maps in one material. Possible?

polycounter lvl 5
Offline / Send Message
gem2492 polycounter lvl 5
The idea is to have at most 4 detail maps and one detail weight map that has 4 channels: R, G, B, and Alpha. Each channel will be controlling the weight of one detail map. For detail maps, that are directional, we can also have a detail direction map (similar to that of anisotropic shaders).

For example, a head has different types of pores. Instead of sculpting them, we can just apply them as detail maps, which means that it won't get blurry or pixelated, even in super close-up shots. Since the details are on the detail maps, the textures for the head itself don't need to be high-resolution anymore, and the detail maps can just be 128x128 pixels each. 

I'm not a programmer or a material author, but it seems simple enough. Is there a way to implement it on Marmoset Toolbag or Unreal?

Replies

  • Butthair
    Options
    Offline / Send Message
    Butthair polycounter lvl 11
    You can do this in any game engine, just so long as you can write a shader to blend channels per channel. Unreal's material editor exposes these channels - RGBA - so they can be manipulated. Further on, you can control tiling scale for each detail map.

    However, for the purposes of rendering, it might be better to check Marmoset's website and see if it allows or if people have managed something similar.
  • gem2492
    Options
    Offline / Send Message
    gem2492 polycounter lvl 5
    Hi @Butthair ! Thanks for your response. After posting the question, I realized that Marmoset Toolbag only has Detail Normal Map. However, it would be nice if we could have Detail AO and Cavity as well, so I don't think I'll be using Toolbag for what I have in mind. Good to know we can do it in Unreal though. Hmm.. I'll have to do a research on what you just said.
  • Axi5
    Options
    Offline / Send Message
    Axi5 interpolator
    @Butthair

    Shader languages don't have any data types above a float4. RGBA and XYZW are interchangeable.

    @gem2492
    You could blend in many different ways, from vertex color to texture map to coordinate based in a shader. You could do this in any software that allows you to transfer a shader to your GPU, so Max, Maya, Unreal, Unity all have support for this. I haven't checked if Marmoset Toolbag 3's shaders are modifiable, or if you can add some but considering how they're some of the best real time visual fidelity shaders on the market, I strongly doubt it. It's also fairly integrated in their interface.

    I would be looking to do this in something more production friendly.
  • gem2492
    Options
    Offline / Send Message
    gem2492 polycounter lvl 5
    @Axi5
    It is possible to make custom shaders for Toolbag, I think, because there's a folder for custom materials somewhere in the installation folder. 

    If it is possible to do this in the softwares you just mentioned, then how come no one is doing it? Or maybe I just haven't encountered one yet. But still, you'd think big developers would implement it because it seems efficient, unless I'm missing something here.

    I'm still yet to try Butthair's suggestion because I'm busy at the moment, but from what I gather, I think four channels would be enough.
  • Axi5
    Options
    Offline / Send Message
    Axi5 interpolator
    Ah yeah, they have the shader source available. That's very nice of them. @EarthQuake Not complaining, but why don't you encode these?

    Unless I'm mistaken about what your idea is, lots of developers/artists do it all of the time. It's something that's typically seen in production more so than portfolio however, which is why you come across it less often here.

    Also, for the example of a face it's not a very decent workflow, since it's creating more work for a (probably) less performant result, thanks to all of the blending math. Which is bad. The results are also going to be very comparable to a similar 4K map for a face for example. So in short:
    • More work
    • Less performance
    • Little gain in visual fidelity

    However, it is used all of the time for large objects such as terrain.
  • EarthQuake
    Options
    Offline / Send Message
    Yes, I can confirm that custom shaders are possible in Toolbag. You can view example shaders in the Toolbag install directory. Multiple detail maps are not currently supported but this is something that should be possible with a custom shader.

    @Axi5 we use human-readable code so it's easy for users to see how they work and make their own custom shaders.
  • Axi5
    Options
    Offline / Send Message
    Axi5 interpolator
    @EarthQuake
    That's really great of you. I'm going to have a play with it after work tonight and see what crazy effects I can do. I was under the assumption that you would hide it since it's fairly useful code!
  • EarthQuake
  • thomasp
    Options
    Offline / Send Message
    thomasp hero character
    Axi5 said:

    Also, for the example of a face it's not a very decent workflow, since it's creating more work for a (probably) less performant result, thanks to all of the blending math. Which is bad. The results are also going to be very comparable to a similar 4K map for a face for example.

    so you think using a 4K map for a face is the more reasonable approach over using something a lot smaller with detail map overlays? are we talking games here?

    now i'm no graphics programmer but those i do know would slap us around the office if we loaded huge textures into memory for an object that covers such a small part of the screen most of the time. not to forget that with detail maps you can adjust the tiling to your liking/based on view distance and fade it with masks whereas if it's a flat texture it'll all be baked in (and subject to compression).

    i may be behind the times but i would consider 1024 to be a current output resolution for a head texture in a shipping product where there's a chance of some semi closeup view, spruced up with detail maps, obviously.

  • Axi5
    Options
    Offline / Send Message
    Axi5 interpolator
    @thomasp

    I'll be honest, I'm not sure. I'm not an experienced graphics programmer but there's a few points I'm going to raise from that side of the fence.

    1) You're essentially pre-computing what the face is going to look like... Every frame. This might not be way too expensive, but it's a lot harder to optimise code that art depends on, than to optimise the art itself. I said 4K but you could easily just author it to 4K and reduce the scale as needed.

    2) I'm unsure of the limit on current gen shader models, but texcoords are probably already near the maximum amount allowable if you're using PBR or some other advanced shader. So any data you might need to pass your vertex colour weight maps to the fragment shader will take up extra texcoords. I'm sure there's probably room currently right now, but if your production relies on special effects being applied that require more data, you'll have to drop some data elsewhere.

    The point is, it's a trade off. This technique could work for some people but it probably wouldn't give a good advantage to all.

    Though everything I said is volatile, someone more experienced than me at graphics programming can tell me I'm wrong.
  • thomasp
    Options
    Offline / Send Message
    thomasp hero character
    Axi5 said:
    The point is, it's a trade off. This technique could work for some people but it probably wouldn't give a good advantage to all.

    indeed, i'd love to have a way of profiling these things myself... :)
  • gem2492
    Options
    Offline / Send Message
    gem2492 polycounter lvl 5
    Thank you @EarthQuake for the link!

    @Axi5 A 4K map isn't comparable to multiple detail maps because it won't be able to capture the very tiny crevices in the skin. This subtlety is important in order to create more believable skin and in turn cross the uncanny valley. It does not have to be implemented in all objects, so the performance loss (if any) probably won't be that much.

    Just a thought: if Toolbag and Unreal can handle complex Substance archives (.sbsar), multiple detail maps may not be that taxing.
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    How are you proposing to place the detail maps so they look good? A bunch of tiling maps slapped over the top isn't going to send you soaring out of the uncanny valley even if you have masked bits out. 

    Assuming you can afford the associated Shader cost the best solution is to use material layering. It requires that you take a fairly holistic approach to material management in your project but that's never a bad thing. 
  • gem2492
    Options
    Offline / Send Message
    gem2492 polycounter lvl 5
    @poopipe
    I apologize if I have wrongly stated what I had in mind. Of course there are a lot of factors to consider in order to actually cross the uncanny valley, and microdetailed skin is one of those. How am I proposing to place the detail maps so they look good? Well, the reason I started this thread is this: http://www.iryoku.com/stare-into-the-future
    They were using only one detail map, and yet the skin is already looking good. Besides, pores and other skin details are just repeating patterns anyway, like this

     

     so why won't it look good? We do the same for brick walls, right? Plus we can put the detail maps on top of each other so there will be more variation. I was thinking of a direction map, but it might not be possible because the maps might not tile when changing directions.

    Anyway, this was just something I had in mind and I was curious why I haven't seen anyone doing it (for characters). I asked because I thought probably because it was too costly, and since some of you think so, then maybe that's why.
Sign In or Register to comment.