POV-Ray : Newsgroups : povray.general : Request: new simple pattern : Request: new simple pattern Server Time
8 Aug 2024 10:27:09 EDT (-0400)
  Request: new simple pattern  
From: Rune
Date: 7 Jan 2001 07:12:20
Message: <3a585d24@news.povray.org>
The pattern I request here is very simple, and yet something I think would
be very useful, and which I have wanted almost all from the start when I
began to use POV-ray.

The pattern is a bit like gradient and a bit like planar, but more powerful
IMHO. The syntax would be like gradient, only with another keyword of
course.

gradient2 <VECTOR>

...or something like that. gradient2 y would from y=0 to y=1 return 0 to 1.
But unlike regular gradient y it would stay at 1 at y>1 instead of
repeating. At y<0 it would return 0, and that's where it's different from
both gradient and planar. It increases in only the positive <VECTOR>
direction, not both in the positive and negative direction.

Let's take an example. I have a landscape partly under water. Around the
surface of the water I want a sand texture, everywhere above the water I
want soil and everywhere below the water surface I want an under-see
texture. Sure i could use gradient y or planar scaled *very* big and then
use only a tiny fraction of the color_map range. But it would be much more
intuitive with this gradient2 pattern.

There's lot's of other situations where you want one color/pigment/texture
from negative infinite to 0, and another color/pigment/texture from 1 to
positive infinite. The workarounds that can be done with gradient or planar
are not very good.

Another feature of the gradient2 pattern would be that the <VECTOR> could be
not only x, y or z, but any vector.

You may say that that's possible with regular gradient too, but the code
below shows that it doesn't give the expected results:

camera {location 5*y look_at z/8}
plane {y,0
   pigment {gradient x} // regular gradient x.
   // pigment {gradient 3*x} // no change ?
   // pigment {gradient <1,0,1>} // why mirrored ?
   // pigment {gradient <0.1,0,1>} // ???
   finish {ambient 1 diffuse 0}
}

Try to uncomment the different pigments one by one and you see what I mean.
I would want gradient2 to work intuitively with any vector. If
gradient2 -5*z is used the gradient really goes from 0 at z=0 to 1 at z=-5.
And if a vector like <0.1, 2, 10> is used, the gradient will indeed go in
that direction (and will not be mirrored along the axis!)

So, don't you think it would be reasonable with such a pattern? And it's not
like it would be difficult to code.

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 6)
/ Also visit http://www.povrayusers.org


Post a reply to this message

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