POV-Ray : Newsgroups : povray.general : image based normal maps? : Re: image based normal maps? Server Time
18 Apr 2024 21:50:56 EDT (-0400)
  Re: image based normal maps?  
From: Bald Eagle
Date: 19 Jan 2019 14:45:01
Message: <web.5c437d14e20dd126765e06870@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> 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(?)


I started coding a function this morning, and just got back to it now.
Glad to see ole' Kenneth Walker is keeping his Northern namesake on his toes
with the speedy competition.   ;)

Try some of this out, and see what you think:


#declare Type = 1;
#switch (Type)

#case (0)
box {<0, 0, 0>, <1, 1, 0.1>
  texture {pigment {Blue*0.5} finish {specular 0.4}}
  normal {bump_map {png "PovLogo.png" once} bump_size 2}

 }
#break

#case (1)

#declare BumpMap = function {pigment {image_map {png "PovLogo.png"} }};


box {<0, 0, 0>, <1, 1, 0.1>
  texture {pigment {Blue*0.5} finish {specular 0.4}}
     //normal {function { BumpMap (x, y, z).gray}}
     normal {
      function {
      BumpMap (x, y, z).red +
      BumpMap (x, y, z).green +
      BumpMap (x, y, z).blue}
     }
}

#break
#end


Post a reply to this message

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