Search Unity

Bump map acting strangely

Discussion in 'General Graphics' started by Fennec_Fyre, Aug 19, 2019.

  1. Fennec_Fyre

    Fennec_Fyre

    Joined:
    Oct 28, 2016
    Posts:
    16
    Hi, this is my first major project and my first time asking the forums for help, so apologies if I get anything wrong. I'm trying to create a simple 2.5D platformer (3D models for characters, 2D assets for environment) and I'm currently trying to create an alpha build with the very basics. I created a deer model to serve as the player character in 3DSMax, it has been fully modeled, textured, and animated. Now I'm trying to get it working in the Unity engine itself.

    This is the model in Max, along with the textures that make up it's material. It has a diffuse map, a bump map for some extra texture, and a specular map to provide a little sheen on the eyes and nose as well as some gloss on the fur.

    This is the model when I try to put it in Unity:


    And this is the material assigned to the model:


    The diffuse map seems to be working okay, but when I try to add in the bump map as a height map I get problems, with the material ending up heavily distorted as you can see. The bump map was originally a png done in greyscale, but when I try to set it as a normal map and check the "create from greyscale" box, it glitches out.

    Ultimately, the player isn't going to see the model very close up, so I guess I could get away with not having a bump map, but darn it, I worked hard on it, I wanna use it.

    I'm also not sure how to add the specular map in, since I would like the eyes and nose to have a bit of highlight to them to look more lively.

    Any help is appreciated.
     
  2. mouurusai

    mouurusai

    Joined:
    Dec 2, 2011
    Posts:
    350
  3. Fennec_Fyre

    Fennec_Fyre

    Joined:
    Oct 28, 2016
    Posts:
    16
    That fixed my bump problem, thank you so much. I'm still trying to figure out the specular map.
    This is my new configuration for the material, and this is what the model looks like now. It's closer to what I want, but the eyes and nose (where I wanted more reflectiveness) are now pitch black.

    Edit: Outside the prefab editor, the model instead has a pale washed-out look, although I assume that that's just a matter of lighting differences.
     
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Looks like it's washed out because the whole thing is shining and reflecting like some chrome rims. Are you using the alpha channel of your specular map to control how shiny everything is? I imagine you want the eyes and nose to be shiny but the fur to be much less shiny than it is now.
     
    Fennec_Fyre likes this.
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    For non-metal PBR materials the "specular color" should basically be a flat grey 56, 56, 56. I would recommend sticking to the Standard shader with the metallic settings for now, and set the metallic to zero. Most of the real work for getting PBR materials to look good should be done with smoothness, which is stored in the alpha of the specular, metal, or albedo textures depending on the shader and "source" selected. It's good to know that nothing in the real world has a smoothness of "1.0", even a nice wet eye or polished chrome should probably be no more than 0.95 or so.

    https://docs.unity3d.com/Manual/StandardShaderMaterialParameterSmoothness.html
    https://docs.unity3d.com/Manual/StandardShaderMaterialCharts.html

    Hair is especially hard to do with Unity's Standard shader as you really need an anisotropic specular to handle that, and Unity does not provide one. You could get one from the store, or try this free example, but generating good anisotropic maps is a difficult task. I would just try to stick to a smoothness around 0.5 or less.

    As for why things are looking so different between the prefab viewer and your scene, looks like the lighting in the prefab preview scene isn't great. Specifically it does not have a which is used for anything that's especially shiny, and is why things are going black when you have a bright specular color. In your actual scene you have no skybox, which means the background is a solid grey color, and so the reflection probe is the same solid grey. Try using the default skybox in your scene and test the look of your in the scene view rather than in the prefab view.
     
    Fennec_Fyre likes this.
  6. Fennec_Fyre

    Fennec_Fyre

    Joined:
    Oct 28, 2016
    Posts:
    16
    I think I've figured it out, the alpha was where I was having problems. The specular map was saved as a png, so even when I went back and tried to make a proper alpha channel it didn't work. I imported it as a psd instead and it looks like it's behaving as it should. Thanks for the advice.
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Keeping alpha as a separate channel is definitely a good way to go. PNG files are fine, but if you're using Photoshop the built in PNG handling is really bad for this. I highly recommend using SuperPNG.
    https://www.fnordware.com/superpng/

    Installing it is a little clunky as it doesn't come with an installer. You have to just copy the appropriate file to the right folder, and then the additional options it adds to PNG requires you hold down the shift button when opening a PNG file to access. But the control you have over PNG opening and saving is really needed for this kind of work.

    Basically Photoshop deletes the color from any pixels with an alpha of zero when saving a PNG, and always opens a PNG as a layer with alpha. SuperPNG lets you choose whether or not to delete the color data (which is good for web use cases as it makes the files smaller), or keep it, as well as if you want to open the PNG with the alpha as a transparency on a layer or as a separate channel.

    Personally I do just use PSD files with an explicit alpha channel as the in-project file format has no impact on the in game file size.
     
    Fennec_Fyre likes this.