|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
If I use the "planar" map, I get a texture that goes from one colour, to
another, and back to the first again, creating a thin band of the alternate
colour. How do I make it so that everything above the line is one colour and
everything below it is another? (Still with the nice smooth transition in
between.)
What I want is for all points where y >= +100 to be red, all points where y
<= -100 to be blue, and the points inbetween to be linearly interpolated. I
can get red -> blue -> red, and I can get blue -> red -> blue, but how do I
get red -> blue?
Thanks.
Andrew.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Andrew Coppin" <orp### [at] btinternetcom> wrote in message
news:3eda6530@news.povray.org...
> If I use the "planar" map, I get a texture that goes from one colour, to
> another, and back to the first again, creating a thin band of the
alternate
> colour. How do I make it so that everything above the line is one colour
and
> everything below it is another? (Still with the nice smooth transition in
> between.)
>
> What I want is for all points where y >= +100 to be red, all points where
y
> <= -100 to be blue, and the points inbetween to be linearly interpolated.
I
> can get red -> blue -> red, and I can get blue -> red -> blue, but how do
I
> get red -> blue?
I think you're describing the reversal of the pattern, opposite on either
side of the y plane. I can't think of any workaround except to translate and
scale (or vice versa).
Bob H.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3eda6530@news.povray.org>,
"Andrew Coppin" <orp### [at] btinternetcom> wrote:
> What I want is for all points where y >= +100 to be red, all points where y
> <= -100 to be blue, and the points inbetween to be linearly interpolated. I
> can get red -> blue -> red, and I can get blue -> red -> blue, but how do I
> get red -> blue?
You could use the object pattern with a plane to remove the undesired
portion. Something like:
pigment {
object {plane {y, 0}
pigment {color Red},
pigment {planar
color_map {[0 color Blue] [1 color Red]}
}
}
}
I've been thinking of a generalization of the waveform feature that
would make this a lot easier, it would be done with a gradient pattern
and a clamp waveform.
You could also do it with a simple function pattern:
#include "math.inc"
pigment {function {clip(y, 0, 1)}
color_map {[0 color Red] [1 color Blue]}
}
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> What I want is for all points where y >= +100 to be red, all points where
y
> <= -100 to be blue, and the points inbetween to be linearly interpolated.
I
> can get red -> blue -> red, and I can get blue -> red -> blue, but how do
I
> get red -> blue?
If all else fails:
function {
select(y-100,
// if y < 100
select(y-(-100),
0 // if y < -100
(y-(-100))/200 // else (y >= -100)
),
1 // else (y >= 100)
)
}
color_map {
[0 rgb <0,0,1>]
[1 rgb <1,0,0>]
}
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3edae66e@news.povray.org>, "Slime" <slm### [at] slimelandcom>
wrote:
> function {
> select(y-100,
> // if y < 100
> select(y-(-100),
> 0 // if y < -100
> (y-(-100))/200 // else (y >= -100)
> ),
> 1 // else (y >= 100)
> )
> }
I think select() is a bit overkill for this. My suggestions were more
general, but if you want something that fits this precise situation:
function {max(-100, min(100, y))/200 + 0.5}
Plus, I think you're missing a comma in the inner select().
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> What I want is for all points where y >= +100 to be red, all points where y
> <= -100 to be blue, and the points inbetween to be linearly interpolated. I
> can get red -> blue -> red, and I can get blue -> red -> blue, but how do I
> get red -> blue?
I would take a checker and scale it so large that only two cubes are
in the visible scene, their frontier being at y=100. One of the
patterns I would make red, for the other I repeat the trick for a
second frontier at y=-100. One of those textures I make blue, the
other will be a gradient or however that was called.
Probably NOT the best solution.
--
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}// Mark Weyer
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> function {max(-100, min(100, y))/200 + 0.5}
That's right... I could tell I was overcomplicating it, but I couldn't tell
how.
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> You could use the object pattern with a plane to remove the undesired
> portion.
Well, it's the best idea I've heard so far...
> I've been thinking of a generalization of the waveform feature that
> would make this a lot easier, it would be done with a gradient pattern
> and a clamp waveform.
Yeah, I thought it should be possible... I thought that changing from
triangle_wave to ramp_wave would do it, but no...
Thanks.
Andrew.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
// Hi Andrew,
//
// if your object(s) is/are not infinite in the direction of the
// gradient (y in your case), a simple gradient pattern will suffice.
// If the range (along the direction of the gradient) of the object(s)
// to be textured is completely contained in Bottom ... Top and the
// range where blending is desired is Min ... Max, then the macro call
//
// Blending_pigment (Direction, Bottom, Top, Min, Max, Color_min, Color_max)
//
// creates a pigment with Color_min for Y<Min, Color_max for Y>Max and
// linearly blending from Color_min to Color_max in the y-range Min to
// Max if Direction=y, similar for other directions. This pattern repeats
// above Top and below Bottom. The range Bottom to Top should be slightly
// larger than the dimensions of the object(s) in the given direction to
// give rounding errors no chance.
// Because this pigment is a single gradient pattern with a very simple
// color_map, it should be faster than all other solutions.
//
// The same principle can be used with pigments or textures instead of
// colors; then it will be helpful for waterline texturing and the like.
//
// In case of infinite objects (like planes), it usually is acceptable
// to use very large values for Bottom and Top, the coloring errors
// in such a large distance will almost certainly be invisible.
//
// I'll post the picture created by the following demo code to p.b.i.
//
// Sputnik
//
// --
// ----------------------------
// fr### [at] computermuseumfh-kielde
// ----------------------------
//===== macro for pigment with blending colors ============================
#macro Blending_pigment (
Direction, // direction of blending
Bottom, Top, // usable y-range
Min, Max, // range of colors blending from Color_min to Color_max
Color_min, // color for y=Bottom .. Min
Color_max // color for y=Max .. Top
)
pigment {
gradient Direction
color_map {
[ (Min-Bottom)/(Top-Bottom) Color_min ]
[ (Max-Bottom)/(Top-Bottom) Color_max ]
}
scale Top-Bottom
translate Bottom*Direction
}
#end//macro Blending_pigment
//===== examples ==========================================================
// create a box, Y=-400 to 400, blue to red from -100 to 100
box { <-1200, -400, -300>, <-600, 400, 300>
texture {
// give it a pigment covering a little more than its y-range
// which is blue below y=-100, red above y=100 and
// linearly blending in the range between
Blending_pigment ( y, -401,401, -100,100, rgb<0,0,1>,rgb<1,0,0> )
finish {
ambient .4
diffuse .6
}
}
}
// another box, Y=-400 to 600, light blue to orange from -300 to 0
box { <-300, -400, -300>, <300, 600, 300>
texture {
Blending_pigment ( y, -401,601, -300,0, rgb<.2,.6,1>,rgb<1,.6,.2> )
finish {
ambient .4
diffuse .6
}
}
}
// bad example: large parts of box are outside Bottom ... Top
box { <600, -400, -300>, <1200, 400, 300>
texture {
Blending_pigment ( y, -81,81, -40,40, rgb<0,1,0>,rgb<1,1,0> )
finish {
ambient .4
diffuse .6
}
}
}
// infinite plane, blending in z-direction
plane { y, -400
texture {
Blending_pigment ( z, -1E7, 1E7, -1000,1000, rgb<0,1,1>,rgb<1,0,1> )
finish {
ambient .4
diffuse .6
}
}
}
light_source { <-1000, 3500, -2000>, color rgb 1 }
camera { location -6000*z look_at 300*y angle 30
rotate <12, -20, 0>
}
// END ==================================================================
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'll have a look into this... (when my mum stops pestering me! *sigh*)
Thanks.
Andrew.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|