POV-Ray : Newsgroups : povray.general : image based normal maps? : Re: image based normal maps? Server Time
2 Jun 2024 02:21:23 EDT (-0400)
  Re: image based normal maps?  
From: Kenneth
Date: 19 Jan 2019 14:00:01
Message: <web.5c43731ce20dd126cd98345b0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:

> >
> Following up on the initial query by cloudyroo, I tried to get this to
> work as a function pattern in a normal block but without success... :-/
>
> I must admit that something escapes me and/or I misunderstand the
> docs... Neither found any info in the forum posts... I seem not to have
> my day ;-)
>

Try this set-up (using the image_map that the OP linked to in his original
post):

#declare NORM_FUNCTION =
function{
     pigment{image_map{png "D9AsKLH.png" interpolate 2} scale 2}
        };

box{0,1.5
     texture{
           pigment{rgb .5}
           finish{ambient .1 diffuse .7 phong .7 phong_size 5}
           normal{
                function{NORM_FUNCTION(x,y,z).blue} // also try (y,y,x)
           normal_map{
                 [0.5 bumps scale .15 bump_size 5]
                 [0.5 granite scale .2 bump_size 5]
                     }
                  }
            }
     }

Some of these values are exaggerated, for effect. I do see the normal pattern on
the box, but only on the front face; a function made from an image_map is only
meaningful in x and y, not z, since the image_map is not '3-dimensional' like
POV-Ray's built-in patterns are.

Since the use of the function requires a color component to be chosen, I used
      .blue
because the blue color in this particular image_map is the dominant one, with
the most gradations. Using .red, .green, or .gray  shows practically no effect.

I don't presently know how to use the *complete* range of colors in the image,
as a way to pick out the normal patterns in the normal_map-- like, red for
bumps, green for granite, and blue for a third normal pattern. It would *seem*
to be possible, though, with some SDL/function tricks(?)


Post a reply to this message

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