POV-Ray : Newsgroups : povray.newusers : Color encoding of a linear_spline due to z-axis value Server Time
25 Nov 2024 07:41:56 EST (-0500)
  Color encoding of a linear_spline due to z-axis value (Message 1 to 3 of 3)  
From: wollinger
Subject: Color encoding of a linear_spline due to z-axis value
Date: 23 Apr 2006 13:10:00
Message: <web.444bb46e610ddd6d431eceef0@news.povray.org>
Hi,

I want to render a simplistic cave model which is made of a linear_spline. I
can convert the data with some external software so that Povray can read the
data directly. But how can I define that the color of my spline is encoded
due to the y-axis value? In the example added below it would be possible to
add somthing like pigment {Red*current_y/max_y} (at least I could use the
external converter to add a construct like this. I'thing that there is a
better way to do it but I have no idea how to do it.

Kind regards
Wolfgang


example file :

//--------------------------------------
// Globals
//--------------------------------------

global_settings { assumed_gamma 1.6 }

#include "shapes.inc"
#include "colors.inc"
#include "screen.inc"


//---------------------------------------
// Positionen
//---------------------------------------
#declare My_Camera=<424510, 3000, 279020>;  // Ausgangspos Cam
#declare Object_Center=<424780.240000, 1475.530000 , 284518.310000>;  //
Rotationszentrum

#declare Cam_Pos=(My_Camera) ;  // zum transferrieren der Positionen
#declare Cam_Center=(Object_Center) ;
#declare Rot_Angle_Y=-135;

//---------------------------------------
// Lichtquellen
//---------------------------------------
#declare Sun = color rgb <1, 1, 1>*.4;

 light_source { Cam_Pos
                color Sun
                Rotate_Around_Trans(<0,Rot_Angle_Y,0>, Cam_Center)
              }


//---------------------------------------
// Camera
//---------------------------------------


 #declare Trans_Cam= vrotate(Cam_Pos-Object_Center, <0, Rot_Angle_Y,
0>)+Object_Center;
 Set_Camera_Location(Trans_Cam)
 Set_Camera_Look_At(Cam_Center)
 Set_Camera_Aspect(720,576)
 Set_Camera_Angle(15)


//---------------------------------------
// Centerline
//---------------------------------------

sphere_sweep { linear_spline 2,
 <424780.240000, 1475.530000 , 284518.310000>, 10
 <424783.330000, 1487.280000 , 284511.970000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424783.330000, 1487.280000 , 284511.970000>, 10
 <424786.190000, 1488.290000 , 284509.890000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424786.190000, 1488.290000 , 284509.890000>, 10
 <424791.740000, 1480.550000 , 284503.730000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424791.740000, 1480.550000 , 284503.730000>, 10
 <424791.740000, 1477.190000 , 284496.520000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424791.740000, 1477.190000 , 284496.520000>, 10
 <424791.740000, 1501.090000 , 284496.520000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424791.740000, 1501.090000 , 284496.520000>, 10
 <424791.740000, 1505.790000 , 284496.520000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424791.740000, 1505.790000 , 284496.520000>, 10
 <424791.740000, 1510.440000 , 284496.520000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424791.740000, 1510.440000 , 284496.520000>, 10
 <424789.740000, 1518.680000 , 284495.590000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424789.740000, 1518.680000 , 284495.590000>, 10
 <424787.710000, 1518.390000 , 284495.770000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424787.710000, 1518.390000 , 284495.770000>, 10
 <424789.210000, 1521.650000 , 284494.510000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424789.210000, 1521.650000 , 284494.510000>, 10
 <424792.840000, 1523.670000 , 284488.450000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424792.840000, 1523.670000 , 284488.450000>, 10
 <424790.440000, 1522.450000 , 284485.270000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424790.440000, 1522.450000 , 284485.270000>, 10
 <424790.440000, 1531.850000 , 284485.270000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424790.440000, 1531.850000 , 284485.270000>, 10
 <424787.550000, 1540.600000 , 284474.460000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424787.550000, 1540.600000 , 284474.460000>, 10
 <424769.220000, 1547.330000 , 284471.880000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424769.220000, 1547.330000 , 284471.880000>, 10
 <424769.220000, 1662.330000 , 284471.880000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424769.220000, 1662.330000 , 284471.880000>, 10
 <424769.220000, 1676.330000 , 284471.880000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424769.220000, 1676.330000 , 284471.880000>, 10
 <424769.220000, 1676.330000 , 284470.380000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424769.220000, 1676.330000 , 284470.380000>, 10
 <424769.220000, 1695.330000 , 284470.380000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424769.220000, 1695.330000 , 284470.380000>, 10
 <424769.220000, 1726.330000 , 284470.380000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424769.220000, 1726.330000 , 284470.380000>, 10
 <424765.490000, 1726.330000 , 284468.230000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424765.490000, 1726.330000 , 284468.230000>, 10
 <424765.490000, 1743.430000 , 284468.230000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424765.490000, 1743.430000 , 284468.230000>, 10
 <424765.490000, 1771.930000 , 284468.230000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424765.490000, 1771.930000 , 284468.230000>, 10
 <424765.490000, 1786.430000 , 284468.230000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424765.490000, 1786.430000 , 284468.230000>, 10
 <424765.490000, 1790.390000 , 284463.840000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424765.490000, 1790.390000 , 284463.840000>, 10
 <424765.490000, 1797.700000 , 284463.840000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424765.490000, 1797.700000 , 284463.840000>, 10
 <424762.000000, 1804.760000 , 284467.340000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424762.000000, 1804.760000 , 284467.340000>, 10
 <424760.910000, 1806.650000 , 284468.500000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424760.910000, 1806.650000 , 284468.500000>, 10
 <424762.240000, 1805.510000 , 284470.070000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424762.240000, 1805.510000 , 284470.070000>, 10
 <424762.240000, 1828.750000 , 284470.070000>, 10
 pigment {Red}
}
sphere_sweep { linear_spline 2,
 <424762.240000, 1828.750000 , 284470.070000>, 10
 <424765.000000, 1833.000000 , 284476.000000>, 10
 pigment {Red}
}


Post a reply to this message

From: Mr Seb
Subject: Re: Color encoding of a linear_spline due to z-axis value
Date: 23 Apr 2006 14:10:40
Message: <444bc320@news.povray.org>
Try this :
#declare pig=pigment {gradient y color_map{
 [0 Black]
 [1 Red]
 }
 scale 300
 }

(the 300 is approximative, this is the max_y in your example)

and replace pigment {Red} by pigment {pig} in your scene
"


Post a reply to this message

From: wollinger
Subject: Re: Color encoding of a linear_spline due to z-axis value
Date: 23 Apr 2006 15:20:01
Message: <web.444bd23353dc32ba431eceef0@news.povray.org>
Hi,

that was the hint into the right direction! I've added a translate
<0,1450,0> to shift it to y_min.

Thanks a lot
Wolfgang

"Mr Seb" <ban### [at] wanadoofr> wrote:
> Try this :
> #declare pig=pigment {gradient y color_map{
>  [0 Black]
>  [1 Red]
>  }
>  scale 300
>  }
>
> (the 300 is approximative, this is the max_y in your example)
>
> and replace pigment {Red} by pigment {pig} in your scene
> "


Post a reply to this message

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