Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MeshLab normalmap

Tags:

meshlab

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?

like image 203
Mercury Avatar asked Aug 24 '17 19:08

Mercury


1 Answers

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.

like image 138
Atekihcan Avatar answered Oct 21 '22 06:10

Atekihcan