|
|
Here's the mathematically correct version:
// Persistence of Vision Ray Tracer Scene Description File
// File: PigFunc.pov
// Vers: 3.5+
// Desc: Pigment function demo
// Date: 2005.02.19
// Auth: PM 2Ring
//
// -D +A0.01 +AM2 +R4 +W640 +H640
// -F -A0.4 +AM2 +R1
//
global_settings {assumed_gamma 1}
//---Color Maps--------------------------------------------
//Make a color_map from a0 to a1
#macro CMRange(a0, a1)color_map{[0 a0][1 a1]}#end
//Make a color_map from Black to a
#macro CMFull(a)CMRange(rgb 0, a)#end
//---Stereographically projected
pigment!-----------------------------------------
#declare R = 3; //Radius of projection
#declare R2 = R*R;
#declare f_proj = function(x,z){1/sqrt(1 - (x*x+z*z)/R2)}
#declare TestPig = pigment{hexagon rgb<1 .9 .5>, rgb <.85 .5 .6>, rgb <0 0
...8> scale .5}
#declare f_Pig = function{pigment{TestPig}}
#declare Brite = 3;
#declare PigRGB =
pigment{
average
pigment_map {
[1 function{f_Pig(x*f_proj(x,z), y, z*f_proj(x,z)).red} CMFull(red
Brite)]
[1 function{f_Pig(x*f_proj(x,z), y, z*f_proj(x,z)).green} CMFull(green
Brite)]
[1 function{f_Pig(x*f_proj(x,z), y, z*f_proj(x,z)).blue} CMFull(blue
Brite)]
}
}
//---Scene--------------------------------
cylinder{
-.1*y, .1*y, R
pigment{
PigRGB
//TestPig
}
finish{ambient 1 diffuse 0}
}
camera {
orthographic
location y * R * 4
look_at 0
right x*image_width/image_height up y
direction z
angle 30
}
background{rgb .5}
//-------------------------------------------------------
Post a reply to this message
Attachments:
Download 'pigfuncha2.png' (139 KB)
Preview of image 'pigfuncha2.png'
|
|