Home Adobe Substance

Substance Designer: height to world normals respecting UV orientation?

polycounter lvl 15
Offline / Send Message
dimwalker polycounter lvl 15

I want to add details baked into diffuse map. Dents, cracks that sort of things.

For this I planned to make a height map A, convert it to world normals and run it through Light node. Problem is UVs are usually packed to optimize texture space usage. Shells can be rotated, flipped or just curved surface flattened like in this example.

Result is my shadows are off as in C and I want them to look closer to D.

I have proper position and world normal maps for this mesh, but have no idea how to use them in process of converting heoght map to world space normals. How can I solve this or maybe there is a better way to achieve same goal?



Replies

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter

    You could do it for some situation but a good general solution is probably not viable since you don't have enough reliable information about your mesh in designer (specifically going fro tangent space to world space and back will be a problem)

    Personally I'd do this bit in painter since it'll do all the work for you.

  • dimwalker
    Options
    Offline / Send Message
    dimwalker polycounter lvl 15

    Not sure I understand. Designer should have all available info. I might have phrased original question in confusing way, but I have the mesh in designer. Can bake any proper map from it.


    Was thinking about hacky ways of doing it, though none seems like it would work. For example, I can convert height map with these details into fake world normals, combine it with proper world normals map and plug result into Light node. In this case shadows from details would be as I want them to be, but mixed with "global" shadows generated by proper world normals - at the bottom of donut detail-shadows would always be in the dark and I won't be able to control them separately.

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter

    To do the sort of thing you're asking you need to shift from tangent to world space and back again - to do that you need information about the mesh that isn't available to the material graph and afaik cannot be baked in designer.

    You could bake the missing information into texture/vertex color using another app and import / bake it .


    Personally, I'd run it through painter cos the hard bit is all done for you

  • gnoop
    Options
    Offline / Send Message
    gnoop polycounter

    Why cannot ? SD baker could bake all same maps Painter does. With a minor differences . World space normal map for sure . Or world directions map where you can set up vector manually and even bake world space normals to tangent space or whatever space you want. I mean if you have the mesh.


    But the task to get proper shadows from shadow node is the real issue. I see it sets rays origin, a sun by 3 values in value processor. XY of texture plane and Z for sun height my guess. Perhaps it could work sampling a sort of normal map as a vector source but not through value processor. I personally couldn't even make unlocked copy to try something for some uncertain reason. I think there are some cross references inside the node that doesn't alloW it.

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter

    The baker is irrelevant (Painter can't bake the information needed either) .

    The issue the OP is having is that they can't composite a heightmap with a world space normal map within designer and get 'correct' results.

    Painter generates the information required for this using a combination of bakes and the mesh itself - it then passes that information through to the layer stack in the form of a texture (one that the user doesn't see).

    Designer does not (and cannot afaik) do the first step.

  • gnoop
    Options
    Offline / Send Message
    gnoop polycounter

    Perhaps I still don't understand , not sure. But to me it seems like baking light vector to rotated UV islands and "world direction map" does it in SD imo. You can set the vector in world coordinates, and it bakes it into RGB colors for each island according to UV rotation. If I understand it right? I never tried to use it for shadows although because can't even disassemble that RT shadow node properly.

    It takes sun position as 3 values from value processor but my guess should be able to do so per pixel too.

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter

    the shadow node requires world space position and normals to work.


    to get world space position you need to convert height into tangent space normals (easy) and transform those normals from tangent space to world space.

    This requires that you bugger around with 3d matrix transforms - you can build nodes to do this in Designer but you have to do it manually.

    What's missing - as far as I know - is enough information about tangent space to feed that transform - If you can in fact generate that information from baked maps now then I am wrong - it was not feasible last time I tried but that was a few years ago.


    Even if it's possible, the amount of work required is very non-trivial and since you don't have to pay extra for painter anymore it's a huge waste of time unless you have a lot of assets to process and want to automate it (even then, I'd just write the code in something more suited to the task)

  • gnoop
    Options
    Offline / Send Message
    gnoop polycounter

    I stopped to follow new nodes SD is adding lately so maybe it's a new one.

    But old "RT shadows" node I sometimes use needs only height and some manual sun position input. Not from a texture, just same vector for every pixel .

Sign In or Register to comment.