POV-Ray : Newsgroups : povray.newusers : color_map in normals : Re: color_map in normals Server Time
30 Jul 2024 00:22:51 EDT (-0400)
  Re: color_map in normals  
From: Jim Charter
Date: 13 Dec 2004 00:11:39
Message: <41bd248b$1@news.povray.org>
Alex wrote:


Okay, there are a few things with your question.

First, you may actually be mis-interpreting what you are seeing with your
color_map example.  The wood pattern uses, by default, a triangle_wave 
which gives a symmetrical result over one unit.  So you are actually 
getting a
result that could be duplicated by
pigment{ wood  ramp_wave color_map{[0 rgb 0] [.5 rgb 1][1 rgb 0]} scale 
<.2, .2, 1>}

Now, to control the result of the pattern when used in a normal, you 
were on the right track with the using the slope_map, you just have to 
think very carefully about how it is working.  With the triangle_wave 
default, the value of 1 is returned at a distance of .5 when there is no 
scaling applied.  Suppose you applied max height and zero slope at that 
point and put a steep slope at the terminal points
normal { wood slope_map { [0 <0,2>][1 <1,0>] } scale <.2, .2, 1>}
Would this be closer to the result you hoped for?

Finally, if the behavior of the color_map is easier for you to 
understand, you can define the pattern as a pigment function then use it 
in the normal.  I will let you investigate the documentation on that.


-Jim

tested with the following sdl:
cylinder { z*0 z*1 1
  pigment{ wood
	color_map{
		[0 rgb 0]
		[1 rgb 1]
	}
	scale <.2, .2, 1>
  }

}
cylinder { z*0 z*1 1
  pigment{ wood
	ramp_wave
	color_map{
		[0 rgb 0]
		[.5 rgb 1]
		[1 rgb 0]
	}
	scale <.2, .2, 1>
  }
  translate y*-2
}
cylinder { z*0 z*1 1
  pigment { rgb .8 }
  normal { wood
	slope_map { [0 <0,2>][1 <1,0>]
	}
	scale <.2, .2, 1>
  }
  translate x*2
}


Post a reply to this message

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