POV-Ray : Newsgroups : povray.newusers : color_map in normals Server Time
1 Nov 2024 21:20:26 EDT (-0400)
  color_map in normals (Message 1 to 2 of 2)  
From: Alex
Subject: color_map in normals
Date: 12 Dec 2004 03:05:01
Message: <web.41bbfa95407c18d0e60059f90@news.povray.org>
hey there,

I need to use something like color_map on normals.

let me explain myself:

let's say I have a texture with:
pigment{ wood scale <.2, .2, 1> }
I get a bunch of concentrical rings, in 2 colors.

now if I change it like this:
pigment{ wood color_map{[0 rgb 0] [1 rgb 1]} scale <.2, .2, 1>}}
I get the same rings, but instead of 2 colors I get a gradient.

now, back to my problem: when I use "wood" in a texture's normal, I get
concentrical rings in 2 "colors", that means I see one ring flat, one right
raised, one flat, one raised, so on..

what I need is something similar to "color_map" in normals, so I can get a
grandient in the mapping. I've tried "normal_map" without any luck... I've
also tried the slope_map but I don't see how that works.


any hints would be really neat! :)

Thanks,
Alex V.


Post a reply to this message

From: Jim Charter
Subject: Re: color_map in normals
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.