Search code examples
meshlab

MeshLab normalmap


In the previous(1.3.3) Meshlab version,when choosing Render->shaders->normalmap, the normal map with the familiar blue-purple colormap would show the correct normal map: enter image description here In the current (2016.12) version, the normal map is not shown,only the texture overlay: enter image description here enter image description here How can I show the normal colormap in the current version?


Solution

  • Although there is a predefined shader named "normalmap" available under Render -> Shaders menu, it will not render the model as you think it would ("familiar blue-purple colormap").

    But you can modify those shaders to achieve what you are looking for.

    1. Take a back up of the following files. You can find them in C:\Program Files\VCG\MeshLab\shaders or wherever you have installed meshlab

      • normalmap.vert
      • normalmap.frag
    2. Edit the above files as follows. You can keep the comments.

      • normalmap.vert

        varying vec4 baseColor;
        void main(void)
        {
            gl_Position = ftransform();
            baseColor = vec4(gl_Normal, 1.0);
        }
        
      • normalmap.frag

        varying vec4 baseColor;
        void main(void)
        {
            gl_FragColor = baseColor;
        }
        
    3. From Render menu, select Render -> Shaders -> normalmap.gdp

    4. There you go! But remember this is a very simple shader to show normal map. If you want lighting and other effects you have to further edit the shaders.