|
|
I just can't memorize how to get back the colors from a pigment function let
alone transparency. I think it was possible with splines... anyway, this
should at least handle the mapping issue:
//start code
camera {
location <-25,50,-150>
look_at <0,0,-75>
angle 65
}
light_source {
<50,25,-150>
rgb <1.7,1.4,1.2>
}
#declare r=75; //minor radius
#declare R=100; //major radius
#declare f_pigm = function { pigment { image_map { png "testimage.png"
interpolate 2 }}};
//replace with your testimage
#declare f_pigm2 = function {
f_pigm((x-r)/(R-r),(y+.375*(R-r))/(.75*(R-r)),z) };
//scaled and translated function which matchs the radii of the ring
#declare f_rad = function { sqrt(x*x+y*y+z*z) } //returns the distance from
origin
disc {
0, y, R, r
pigment {
function {
f_pigm2(f_rad(x,y,z),0,0).gray
//this is where it happens, no more colors here :(
}
}
}
polygon { //displaying the test image
4,
<0,0,0>,
<0,1,0>,
<1,1,0>,
<1,0,0>
pigment {
image_map {
png "testimage.png" interpolate 2 transmit all .5
}
}
finish { ambient 1 diffuse 0 }
scale <R-r,.75*(R-r),1>
translate <r,-.375*(R-r),0>
rotate y*60
no_shadow
}
//end code
Hope this helps!
Regards Roman
Post a reply to this message
|
|
|
|
45254e09$1@news.povray.org...
>
> Would anyone be so kind as to show me a simple example of how to
effectively
> use these images to map onto a disc (or similar)?
>
> - How (?)
This way ;-)
camera {
location <0.0, 15, -30>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
angle 5
}
light_source {
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1>*1.5 // light's color
translate <-30, 3, -30> *1000
}
#declare Int_radius =1; //disc minor radius
#declare Ring_width= 0.2; //disc width
#declare Lum=3; // color luminance
#declare T_factor=0.5; //transparency map amount
// functionalization of the colormap
#declare img =
pigment{
image_map{
png"sat_ring_color.png"
}
scale Ring_width
}
#declare f_img =
function{
pigment{ img }
}
// functionalization of the transparency map
#declare trans =
pigment{
image_map{
png"transparency.png"
}
scale Ring_width
}
#declare f_trans =
function{
pigment{ trans }
}
//recombination of color componants in a concentric way
#declare Ring_pig =
pigment{
average
pigment_map{
[1 function{ f_img(sqrt(x*x+y*y)-Int_radius,0,0).x } color_map{[0 rgb
0][1 rgb x*Lum]} ]
[1 function{ f_img(sqrt(x*x+y*y)-Int_radius,0,0).y } color_map{[0 rgb
0][1 rgb y*Lum]} ]
[1 function{ f_img(sqrt(x*x+y*y)-Int_radius,0,0).z } color_map{[0 rgb
0][1 rgb z*Lum]} ]
[1 function{ f_trans(sqrt(x*x+y*y)-Int_radius,0,0).z } color_map{[0 rgb
0][1 rgbt<0,0,0,1>*T_factor ]} ]
}
}
disc { <0, 0, 0>, z,Int_radius+Ring_width, Int_radius texture {pigment
{Ring_pig }finish{ambient 0 diffuse 1 brilliance 0.2}}rotate x*90}
sphere{0,Int_radius*.8 texture{pigment{color rgb 1} finish {ambient 0
diffuse .6 }}}//place holder
HTH
Marc
Post a reply to this message
|
|
|
|
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "How Camp" <hac### [at] gmailcom> wrote:
> Interesting. I don't think any of the map_types will give you what you are
> looking for. The way I understand it, the strips represent one radial line
> of the ring, and it needs to be swept around the origin. You likely need to
> use user-defined functions to transform the images into a radial pattern.
> If I get time, I'll try to throw together an example for you unless someone
> else has a better idea how to do it.
>
> -tgq
Here's an attempt at mapping the rings and texture properties using the
given images. (I didn't map the underside image though)
//START
global_settings {
assumed_gamma 1
}
#declare CamLoc= <200,50,200>;
#declare SunLoc= <5000,2000,-5000>;
camera {
right x*image_width/image_height
location CamLoc
look_at 0
}
#declare LB=
sphere{0 500 hollow no_image
photons {collect off pass_through}
texture{pigment{rgb 1} finish{ambient 25}}
}
light_source{0
rgb 2
looks_like{LB}
fade_power 2
fade_distance 5500
translate SunLoc
}
#local PIMAGEb000 = function {pigment{image_map {png "SRb000.png"
interpolate 2}}} //back scattered light (0 deg)
#local PIMAGEb139 = function {pigment{image_map {png "SRb139.png"
interpolate 2}}} //forward scattered light (139 deg)
#local PIMAGEc = function {pigment{image_map {png "SRc.png" interpolate 2}}}
//colour map
#local PIMAGEt = function {pigment{image_map {png "SRt.png" interpolate 2}}}
//transparency
#macro CMap(C,T) color_map{[0 rgbt <0,0,0,T>][1 rgbt C*3+<0,0,0,T>]} #end
#declare RingIR=74.510; //inner ring radius
#declare RingOR=140.390; //outer ring radius
#declare FUNKY=function{(sqrt(x*x+z*z)-RingIR)/(RingOR-RingIR)}
#declare
FRe=function{select(FUNKY(x,y,z),0,select(1-FUNKY(x,y,z),0,PIMAGEc(FUNKY(x,y,z),0,0).red))}
#declare
FGr=function{select(FUNKY(x,y,z),0,select(1-FUNKY(x,y,z),0,PIMAGEc(FUNKY(x,y,z),0,0).green))}
#declare
FBl=function{select(FUNKY(x,y,z),0,select(1-FUNKY(x,y,z),0,PIMAGEc(FUNKY(x,y,z),0,0).blue))}
#declare
FTr=function{select(FUNKY(x,y,z),1,select(1-FUNKY(x,y,z),1,PIMAGEt(FUNKY(x,y,z),0,0).gray))}
#declare CL=vnormalize(<CamLoc.x,CamLoc.z>); //camera loc normalized
#declare SL=vnormalize(<SunLoc.x,SunLoc.z>); //sun loc normalized
#declare PA=degrees(acos(vdot(CL,SL)));//phase angle
#declare
FBr000=function{select(FUNKY(x,y,z),1,select(1-FUNKY(x,y,z),1,PIMAGEb000(FUNKY(x,y,z),0,0).gray))}
//brightness at 0deg
#declare
FBr139=function{select(FUNKY(x,y,z),1,select(1-FUNKY(x,y,z),1,PIMAGEb139(FUNKY(x,y,z),0,0).gray))}
//brightness at 139deg
#declare
FBr=function{FBr000(x,y,z)+(FBr139(x,y,z)-FBr000(x,y,z))*(PA)/(139)};
//interpolate brightness at phase angle (assume
linear)
#declare B=3;//ring brightness factor
#declare RCola=//fully opaque
pigment{average
pigment_map {
[function{FRe(x,y,z)*FBr(x,y,z)} CMap(<B,0,0>,0)]
[function{FGr(x,y,z)*FBr(x,y,z)} CMap(<0,B,0>,0)]
[function{FBl(x,y,z)*FBr(x,y,z)} CMap(<0,0,B>,0)]
}
}
#declare RColb=//fully transparent
pigment{average
pigment_map {
[function{FRe(x,y,z)*FBr(x,y,z)} CMap(<B,0,0>,1)]
[function{FGr(x,y,z)*FBr(x,y,z)} CMap(<0,B,0>,1)]
[function{FBl(x,y,z)*FBr(x,y,z)} CMap(<0,0,B>,1)]
}
}
#declare RCol2=//map colour to transparency
pigment{
function{FTr(x,y,z)}
pigment_map{
[0 RCola]
[1 RColb]
}
}
disc {
<0, 0, 0> // center position
y, // normal vector
RingOR, // outer radius
RingIR // optional hole radius
pigment{RCol2} finish{diffuse 0.5}
}
sphere{0 1
texture{
pigment{image_map{jpeg "saturn.jpg" interpolate 2 map_type 1}}
finish{diffuse 0.6}
}
scale<60.268,54.362,60.268>
}
//END
Post a reply to this message
|
|