Bug Incorrect normal map handling

    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    I am no expert, but I believe that StarMade's normal calculation is wrong and nobody noticed, because the default textures are doing it wrong, too.
    • StarMade's hardened hull normal map:
      hardened_hull_norm.png
      You probably all know what this looks like ingame: The normal map will cause the four tiles to render elevated.
    • A normal map of two pipes I generated using Blender:
      pipes_norm.png
      All normals are calculated outside, so one would expect the two pipes to appear as two pipes. However, StarMade will render them as two trenches.
    The inconsistencies in rendering are pretty easily explained, too. If we look carefully at the hardened hull, we will notice a reddish tone on the left of each tile and a blueish one on the right. However, these tones are reversed on the pipe's normal map, so it is not longer surprising that they look differently.

    One could assume that I did something wrong or my view in Blender is misaligned ore something like that. So I took Wikipedia as a reference. They have a very nice sample image there:


    Conclusion: StarMade is doing it wrong. The object on the bottom right shows that the reddish tone belongs to the right of an elevated object, and the blueish one to the left. StarMade is flipping normals horizontally.
     
    • Like
    Reactions: AndyP

    AndyP

    Customer Experience Manager
    Joined
    Aug 15, 2013
    Messages
    1,199
    Reaction score
    264
    • Schine
    • Wired for Logic
    Summoning in the texture deamons on this:

    kupu Crusade Comr4de

    :p

    This is a thing I know roughly, but cant really help you with that. - Forwarding

    - Andy
     
    Last edited by a moderator:
    Joined
    Aug 14, 2013
    Messages
    2,811
    Reaction score
    960
    • Councillor 3 Gold
    • Wired for Logic
    • Top Forum Contributor
    I was going to add normal maps to my texture as soon as I got home. I'll have to look into that too but as far as I am aware you can make both concave and convex shapes with the normal maps.
     
    Joined
    May 26, 2013
    Messages
    1,176
    Reaction score
    939
    • Legacy Citizen 7
    • Modder
    • Top Forum Contributor
    Normal maps are independent to each game. The way Starmade handles them is opposite to most games. However, there is an issue with the top face of cubes. Light on the y axis rotates around it in the wrong direction.

    Kupu, as far as I know, is redoing the normal maps to be correct and more detailed.
     
    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    Kupu, as far as I know, is redoing the normal maps to be correct and more detailed.
    So, just that I'm interpreting this correctly: This doesn't mean that it's going to be consistent with what the rest of the world does, but only that some blocks are expected to change?
    I'm asking because I'm developing a texture preprocessor (to be precise: I am done, quasi), and would find it useful to know if it's worth the trouble to implement something that does the converting from Blender to StarMade.
     
    Joined
    May 26, 2013
    Messages
    1,176
    Reaction score
    939
    • Legacy Citizen 7
    • Modder
    • Top Forum Contributor
    Well it not really the rest of the world. the RGB channels of the images used refer to the x y and z axis of the surface. take the bobby AI front for example:

    This is its normal map.


    This is its red channel (X axis):



    Green channel (Yaxiz):


    And finally, the blue channel (Z axis):




    As you can see, the light shines from the left on the blue axis, top on the y axis and the blue axis as a very faint depth map.

    The shader is written to interpret these normals as they are here. Some of the normals have a flipped red channel.

    If we invert the Red channel on the pipes normal map, we get this:


    As for creating normal maps, I find it best to use a height map put through Crazybump, as it gives you options to change normal map light directions.
     
    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    K, thanks. Although that didn't answer my question directly, I can obviously not expect this behavior to change. No problem, I've already extended my preprocessor with a feature that will flip the normals.

    As for creating normal maps, I find it best to use a height map put through Crazybump, as it gives you options to change normal map light directions.
    Nah, I'll continue using Blender. It's more accurate, and I expect it to be easier to form complex shapes. Also, there's nothing preventing me of using bumpmaps additionally. :)

    Edit: Here's a free like for your quality post. :)
     
    Joined
    May 26, 2013
    Messages
    1,176
    Reaction score
    939
    • Legacy Citizen 7
    • Modder
    • Top Forum Contributor
    Haha, thanks.
    The answer, essentially is that each developer group has the option to use the shaders however they please. -this- is just the was starmade handles it lol.

    As for the quality of mapping, its really a matter of the amount of work you put in.
     
    • Like
    Reactions: AndyP