POV-Ray : Newsgroups : povray.advanced-users : Using POV-Ray to generate an RGB normal map? : Re: Using POV-Ray to generate an RGB normal map? Server Time
4 May 2024 07:11:10 EDT (-0400)
  Re: Using POV-Ray to generate an RGB normal map?  
From: Fingers
Date: 7 Sep 2006 16:45:00
Message: <web.4500845a5dce606226c7adc80@news.povray.org>
OK, now I feel really stupid... All I kept thinking was, "average is going
to make it all 1/3 the brightness and that'll destroy the accuracy if I
just blend three slopes together". Just putting "ambient 3" in the final
texture makes it work perfectly and I can render any shapes into a normal
map just like I wanted.

Here's a sphere with a "normal map" pigment. It produces <128,128,255> in
the +Z direction.

#declare RedX = pigment
{
  slope x
  color_map
  {
    [ 0 color rgb <0, 0, 0> ]
    [ 1 color rgb <1, 0, 0> ]
  }
}

#declare GreenY = pigment
{
  slope y
  color_map
  {
    [ 0 color rgb <0, 0, 0> ]
    [ 1 color rgb <0, 1, 0> ]
  }
}

#declare BlueZ = pigment
{
  slope z
  color_map
  {
    [ 0 color rgb <0, 0, 0> ]
    [ 1 color rgb <0, 0, 1> ]
  }
}


sphere
{
 <0, 0, 0>, .25
  texture
  {
    pigment
    {
      average
      pigment_map
      {
        [1 RedX ]
        [1 GreenY ]
        [1 BlueZ ]
      }
    }

    finish { ambient 3 diffuse 0 }
  }
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.