POV-Ray : Newsgroups : povray.binaries.images : Displace warp/gradient pattern (27+31k) Server Time
19 Aug 2024 02:23:39 EDT (-0400)
  Displace warp/gradient pattern (27+31k) (Message 1 to 7 of 7)  
From: Christoph Hormann
Subject: Displace warp/gradient pattern (27+31k)
Date: 18 Feb 2001 17:50:33
Message: <3A9051B7.EC1A5EF2@gmx.de>
Some time ago (6. 1. 2001) i posted a macro for a 2d gradient pattern.  I
now made a povray pattern calculating this in 3d based on Chris Huff's 
type 1 displace warp code.  

I also added a third type of displace warp similar to the second one. 
Type 1 has an undocumented additional parameter specifying the distance
used for calculating the gradient.  When changing this parameter, the
amount of displacement also changes, which seems not very useful to me. 
See the first attached picture for illustration:

from left to right:
displace pigment 
displaced pigment
type 1, 0.005
type 1, 0.05 (default)
type 1, 0.15

the second line is the new type 2.

For the new gradient pigment I used the keyword 'grad', because 'gradient'
is already occupied:

pigment {
  grad {
    [pigment]
    distance [float]
    range [float]
  }
}

distance has the same effect as the additional parameter in displace
warps, range is a scaling factor.  Since gradient values larger than 1 are
clipped, this can be useful when working with high gradients.  I added the
same to the type 2 displace warp.  

The second attached picture shows some samples for the 'grad' pattern, the
leftmost objects show the plain pigment, the others are the 'grad' pattern
with decreasing 'distance' from left to right.  The first line uses 'range
0.45', the second 'range 0.9'.  

Any comments and suggestions welcome of course.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message


Attachments:
Download 'grad_01.jpg' (27 KB) Download 'grad_02.jpg' (31 KB)

Preview of image 'grad_01.jpg'
grad_01.jpg

Preview of image 'grad_02.jpg'
grad_02.jpg


 

From: Chris Huff
Subject: Re: Displace warp/gradient pattern (27+31k)
Date: 19 Feb 2001 19:18:52
Message: <chrishuff-A3D5B1.19183119022001@news.povray.org>
In article <3A9051B7.EC1A5EF2@gmx.de>, Christoph Hormann 
<chr### [at] gmxde> wrote:

> Some time ago (6. 1. 2001) i posted a macro for a 2d gradient pattern.  I
> now made a povray pattern calculating this in 3d based on Chris Huff's 
> type 1 displace warp code.  

What exactly does this new gradient pattern do? Is it just a pattern 
version of the displace warp?
Hmm, "grad" doesn't seem like a good keyword, but as you mentioned, 
"gradient" is already taken...and so is "slope". Maybe 
"amount_of_change_of_pigment_color_intensity". ;-)
How about "derivative"? Not as intuitive unless you already know what 
"derivative" means...and it would probably be better as a new math 
function.


> I also added a third type of displace warp similar to the second one. 
> Type 1 has an undocumented additional parameter specifying the distance
> used for calculating the gradient.  When changing this parameter, the
> amount of displacement also changes, which seems not very useful to me. 
> See the first attached picture for illustration:

I think your third type is what I intended my second type to 
be...unfortunately, I didn't heavily test the effect of the sample 
distance parameter. It shouldn't affect anything except the accuracy and 
detail of the warp.
Are you going to release the source code to your patches?

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Christoph Hormann
Subject: Re: Displace warp/gradient pattern (27+31k)
Date: 20 Feb 2001 04:09:33
Message: <3A92344F.46672CDA@gmx.de>
Chris Huff wrote:
> 
> What exactly does this new gradient pattern do? Is it just a pattern
> version of the displace warp?

That's right, i just copied the code.  I also wrote a warp_pattern using a
warp directly, but i did not yet check for any difference in speed.  

> Hmm, "grad" doesn't seem like a good keyword, but as you mentioned,
> "gradient" is already taken...and so is "slope". Maybe
> "amount_of_change_of_pigment_color_intensity". ;-)
> How about "derivative"? Not as intuitive unless you already know what
> "derivative" means...and it would probably be better as a new math
> function.

Since it calculates the length of the gradient vector, i think derivative
would not be very good.  If it would only calculate the change in one
direction (the partial derivative), which could be an interesting
addition, this would probably be a better name.  

I don't think 'grad' is that bad, because in mathematics  

grad( f(x,y,z) )

stands for the gradient vector.  

> 
> I think your third type is what I intended my second type to
> be...unfortunately, I didn't heavily test the effect of the sample
> distance parameter. It shouldn't affect anything except the accuracy and
> detail of the warp.

I already supposed that, although by dividing through Warp->dist the
amount of displacement becomes quite high with a range of 1.  

warp { 
  displace {
    [Pigment] 
    type 1     
  }
}

would be equivalent to:

warp { 
  displace {
    [Pigment] 
    type 2
    range 0.05
  } 
}

so if default for 'range' is 0.05, the type 1 could be replaced without
any effect on existing scenes using displace warps as long as they don't
change the default distance.

> Are you going to release the source code to your patches?
> 

I'm going to, but i'm planning to add some more things:

- the 'project' pattern (i renamed it to 'visibility' according to your
suggestion)

- Maybe a slope pattern that works for any specified object and not only
for the object it is applied to.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Chris Huff
Subject: Re: Displace warp/gradient pattern (27+31k)
Date: 20 Feb 2001 06:36:42
Message: <chrishuff-F92225.06360420022001@news.povray.org>
In article <3A92344F.46672CDA@gmx.de>, Christoph Hormann 
<chr### [at] gmxde> wrote:

> I also wrote a warp_pattern using a warp directly, but i did not yet 
> check for any difference in speed.  

I almost wrote that pattern...does it just take the length of the warp 
vector?
I don't think the difference in speed will be very significant.


> I don't think 'grad' is that bad, because in mathematics  
> grad( f(x,y,z) )
> stands for the gradient vector.  

Oh, ok...I didn't know it was a word used in mathematics.


> - Maybe a slope pattern that works for any specified object and not only
> for the object it is applied to. 

I don't understand what you mean...

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Christoph Hormann
Subject: Re: Displace warp/gradient pattern (27+31k)
Date: 20 Feb 2001 06:55:04
Message: <3A925B1C.CD85ADFE@gmx.de>
Chris Huff wrote:
> 
> I almost wrote that pattern...does it just take the length of the warp
> vector?

Yes, although a version calculating the dot product with another vector
could also be interesting.

> I don't think the difference in speed will be very significant.
> 

Probably not, although memory use will also be slightly higher, because it
needs a TPATTERN structure.

> 
> > - Maybe a slope pattern that works for any specified object and not only
> > for the object it is applied to.
> 
> I don't understand what you mean...
> 

A pattern giving the slope of an object just like the slope pattern right
now, but that can be applied to any other object too.  The value would be
constant in direction of the slope vector.  Don't know if that would be of
much practical use, but you could for example have a CSG of a heightfield
and some objects with a slope texture of the plain heightfield.  It would
also be possible to use 'eval_pattern' on this.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Chris Huff
Subject: Re: Displace warp/gradient pattern (27+31k)
Date: 20 Feb 2001 07:46:49
Message: <chrishuff-DCF129.07461320022001@news.povray.org>
In article <3A925B1C.CD85ADFE@gmx.de>, Christoph Hormann 
<chr### [at] gmxde> wrote:

> Yes, although a version calculating the dot product with another vector
> could also be interesting.

Too bad this stuff can't (yet) be done with function patterns...if the 
available information was expanded from just xyz coordinates to include 
surface normal and ray direction, you could do most of this stuff as a 
function. Maybe someone will write that patch after POV 3.5 is released.


> A pattern giving the slope of an object just like the slope pattern 
> right now, but that can be applied to any other object too.  The 
> value would be constant in direction of the slope vector. 

If the point being evaluated isn't on the object, how does it get the 
normal? Does it search for the nearest point on the object?


> It would also be possible to use 'eval_pattern' on this.  

It should also work for media density.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Christoph Hormann
Subject: Re: Displace warp/gradient pattern (27+31k)
Date: 20 Feb 2001 08:48:32
Message: <3A9275B0.A9215832@gmx.de>
Chris Huff wrote:
> 
> > A pattern giving the slope of an object just like the slope pattern
> > right now, but that can be applied to any other object too.  The
> > value would be constant in direction of the slope vector.
> 
> If the point being evaluated isn't on the object, how does it get the
> normal? Does it search for the nearest point on the object?
> 

It will search in direction of the slope vector which leads to a pattern
constant in that direction.  Of course i could also take the distance into
account (for example for slope dependant fog being more dense on flat
areas).

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

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