|
|
Here's an example or two of using full-colour pigment functions. This
example shows how to do a fake MC Escher "Circle Limit" effect, using
stereographic projection. True "Circle Limit" pictures use hyperbolic
(angle-preserving), FWIW.
// Persistence of Vision Ray Tracer Scene Description File
// File: PigFunc.pov
// Vers: 3.6
// Desc: Pigment function demo
// Date: 2005.02.19
// Auth: PM 2Ring
//
// -D +A0.1 +AM2 +R4
// -F -A0.4 +AM2 +R1
//
#version 3.6;
global_settings {
assumed_gamma 1
}
camera {
location <0, 5, -1> * 2.4
look_at 0
direction z
angle 40
}
light_source {
<0, 2, -1> * 50
rgb 1.75 // 2.25
}
//---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 R2 = 8.8;
#declare f_proj = function(x,z){R2/sqrt(R2 - min(R2-1E-12, x*x+z*z))}
#declare TestPig = pigment{hexagon rgb<1 .9 .5>, rgb <.85 .5 .6>, rgb <0 0
...8>}
#declare f_Pig = function{pigment{TestPig}}
#declare f_Pig1 = f_Pig;
//Turn a pigment function into a real-live pigment!
#declare PigRGB0 =
pigment{
average
pigment_map {
[1 function{f_Pig(x,y,z).red} CMFull(red 3)]
[1 function{f_Pig(x,y,z).green} CMFull(green 3)]
[1 function{f_Pig(x,y,z).blue} CMFull(blue 3)]
}
}
//And now, with projection!
#declare f_X = function{x*f_proj(x,z)}
#declare f_Y = function{y}
#declare f_Z = function{z*f_proj(x,z)}
#declare PigRGB1 =
pigment{
average
pigment_map {
#if(0)
[1 function{f_Pig(f_X(x,y,z), f_Y(x,y,z), f_Z(x,y,z)).red} CMFull(red
3)]
[1 function{f_Pig(f_X(x,y,z), f_Y(x,y,z), f_Z(x,y,z)).green}
CMFull(green 3)]
[1 function{f_Pig(f_X(x,y,z), f_Y(x,y,z), f_Z(x,y,z)).blue} CMFull(blue
3)]
#else
[1 function{f_Pig(x*f_proj(x,z), y, z*f_proj(x,z)).red} CMFull(red 3)]
[1 function{f_Pig(x*f_proj(x,z), y, z*f_proj(x,z)).green} CMFull(green
3)]
[1 function{f_Pig(x*f_proj(x,z), y, z*f_proj(x,z)).blue} CMFull(blue 3)]
#end
}
}
//---Scene--------------------------------
cylinder{
-.1*y, .1*y, 3
//open
pigment{
PigRGB1
//PigRGB0
//TestPig
}
}
background{
//rgb<0.035, 0.27, 0.67>
rgb 0
}
//-------------------------------------------------------
Post a reply to this message
Attachments:
Download 'pigfuncda0.jpg' (106 KB)
Preview of image 'pigfuncda0.jpg'
|
|