POV-Ray : Newsgroups : povray.text.scene-files : Proximity Pattern and 3.5 Server Time
23 Dec 2024 02:11:53 EST (-0500)
  Proximity Pattern and 3.5 (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From:
Subject: Proximity Pattern and 3.5
Date: 7 Feb 2002 12:31:47
Message: <vce56usomp3amfshtgqmhnffmrtekri5a2@4ax.com>
Here is my simplest attempt to achive proximity pattern with 3.5. If there is
anybody interested with more functionality of proximity pattern available in
megapov then tell me. I can extend this macro.

How to use it:
  Call macro where pattern should be called.
  Below script contains both: macro and sample.
Description of parameters:
  Object - base object
  Range - vector with dimensions of smooth area
  Count - number of samples

#version 3.5;
#include "functions.inc"
#macro Proximity_Pattern(Object,Range,Count)
  // by ABX
  #local P=function{pattern{object{Object}}};
  #local Range=Range+0*x;
  #local X=Range.x;
  #local Y=Range.y;
  #local Z=Range.z;
  #local C=max(int(Count)1);
  function{
    (1/C)*(
    #while(C)
      P(
        x+X*(2*f_noise_generator(x+C,y,z,2)-1),
        y+Y*(2*f_noise_generator(x,y+C,z,2)-1),
        z+Z*(2*f_noise_generator(x,y,z+C,2)-1)
      )
      #local C=C-1;
      #if(C)+#end
    #end
    )
  }
#end
plane{
  -z 0
  translate z*3
  pigment{Proximity_Pattern(text{ttf"povlogo""P"9 0},.1,100)}
}
light_source{100*(y-z)1}

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Proximity Pattern and 3.5
Date: 7 Feb 2002 13:46:30
Message: <3C62CB85.EA268CFA@gmx.de>

> 
> Here is my simplest attempt to achive proximity pattern with 3.5. If there is
> anybody interested with more functionality of proximity pattern available in
> megapov then tell me. I can extend this macro.
> 

Interesing, but it looks more like a blur pattern to me, the proximity
pattern uses intersection tests IIRC.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 06 Feb. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Ron Parker
Subject: Re: Proximity Pattern and 3.5
Date: 7 Feb 2002 13:50:21
Message: <slrna65j3g.9qu.ron.parker@fwi.com>
On Thu, 07 Feb 2002 19:46:29 +0100, Christoph Hormann wrote:
> 
> 

>> 
>> Here is my simplest attempt to achive proximity pattern with 3.5. If there is
>> anybody interested with more functionality of proximity pattern available in
>> megapov then tell me. I can extend this macro.
> 
> Interesing, but it looks more like a blur pattern to me, the proximity
> pattern uses intersection tests IIRC.

So does this, essentially.  It effectively returns an approximation of the
fraction of the local region of space that's occupied by the object.  For
a sufficiently small region or a sufficiently large object, that number is
related to the distance to the surface of the object (though part of me 
thinks there should be a cube root involved somewhere...)

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: ingo
Subject: Re: Proximity Pattern and 3.5
Date: 7 Feb 2002 15:32:59
Message: <Xns91AEDB8047B7Dseed7@povray.org>

wrote:

> plane{
>   -z 0
>   translate z*3
>   pigment{Proximity_Pattern(text{ttf"povlogo""P"9 0},.1,100)}
> }
> 

It crashes when Count gets bigger than 441:
pigment{Proximity_Pattern(text{ttf"povlogo""P"9 0},.1,442)}

Win2000 A1800+ 1.5GB POV 3.5-b10 intel.


Interesting pattern though.

Ingo


Post a reply to this message

From:
Subject: Re: Proximity Pattern and 3.5
Date: 8 Feb 2002 04:25:28
Message: <ng576ucr2tsiu0u9cqoqlqgcgmehvoklnb@4ax.com>
On Thu, 07 Feb 2002 19:46:29 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> Interesing,

Thanks

> but it looks more like a blur pattern to me, the proximity
> pattern uses intersection tests IIRC.

Yes, it uses intersection tests. But this intersection test returns distance.
Pattern showed averaged distance for defined number of tests. That's exactly
what my macro does. Here is example of MEGAPOV demo:
http://users.skynet.be/smellenbergh/demopictures/proxistarb.jpg. It's little
grainy but with larger number of samples it could look exactly like blur.

Things to add to my macro to support functionality of proximity pattern

1) additional select() to perform tests only inside/outside object
2) additional calculations to perform tests in direction of bounding box

Both looks easy to add.

ABX


Post a reply to this message

From:
Subject: Re: Proximity Pattern and 3.5
Date: 8 Feb 2002 07:11:44
Message: <upf76ugdq6dlluklhiib1umos8qsk8k7hc@4ax.com>

> 1) additional select() to perform tests only inside/outside object
> 2) additional calculations to perform tests in direction of bounding box

Ok, I've made simple form of above.
New parameter Inside with yes/no value.
- no - leave inside of object empty
- yes - leave inside of object solid
To achive proximity pattern of both - inside and outside - it requires combination
of patterns with normal and inverted object.
Here is new version of macro:

#macro Proximity_Pattern(Object,Range,Count,Inside)
  #local P=function{pattern{object{Object}}};
  #local N=function{2*f_noise_generator(x,y,z,2)-1};
  #local Range=Range+0*x;
  #local X=abs(Range.x);
  #local Y=abs(Range.y);
  #local Z=abs(Range.z);
  #local Inside=(Inside?1:0);
  #local
B=function{pattern{object{box{min_extent(Object)-<X,Y,Z>max_extent(Object)+<X,Y,Z>}}}};
  #local C=max(int(Count)0);
  #local Proximity=function{
    (1/C)*(
    #while(C)
      P(
        x+X*N(x+C,y,z),
        y+Y*N(x,y+C,z),
        z+Z*N(x,y,z+C)
      )
      #local C=C-1;
      #if(C)+#end
    #end
    )
  };
  function{select(B(x,y,z),0,0,select(P(x,y,z),0,Proximity(x,y,z),Inside))}
#end

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: Proximity Pattern and 3.5
Date: 8 Feb 2002 20:23:20
Message: <chrishuff-7EBB20.20253808022002@netplex.aussie.org>
In article <slr### [at] fwicom>,
 Ron Parker <ron### [at] povrayorg> wrote:

> So does this, essentially.  It effectively returns an approximation of the
> fraction of the local region of space that's occupied by the object.  For
> a sufficiently small region or a sufficiently large object, that number is
> related to the distance to the surface of the object (though part of me 
> thinks there should be a cube root involved somewhere...)

It is affected by proximity, but has no direct relation to it. The 
geometry of the surface is more important than distance...a very thin 
cylinder compared to a plane for example. And objects without insides 
will be invisible to it, since they contain no volume. It's really 
nothing like the proximity pattern, more of a blurred object pattern.

Hmm, I'm going to have to try using smooth noise instead of random 
samples in the patch...I think it would eliminate a lot of granyness.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Proximity Pattern and 3.5
Date: 8 Feb 2002 20:36:03
Message: <chrishuff-FBDE99.20382208022002@netplex.aussie.org>
In article <ng576ucr2tsiu0u9cqoqlqgcgmehvoklnb@4ax.com>,
 W?odzimierz ABX Skiba <abx### [at] babilonorg> wrote:

> Yes, it uses intersection tests. But this intersection test returns distance.
> Pattern showed averaged distance for defined number of tests.

Actually, the most commonly used mode used the minimum distance, but it 
did support the average distance.


> That's exactly what my macro does.

No, your macro returns the percentage of the surrounding space occupied 
by the object, which is quite different though it gives a similar 
effect. It is just a blurred object pattern...hmm. Your macro could be 
modified to blur almost any pattern or function...just remove the 
definition of P and pass it in as a parameter, replacing "Object".

BTW, why use "(1/C)*(...)" instead of just "(...)/C"? And 
"max(int(Count)1)" should be "max(int(Count), 1)".

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Proximity Pattern and 3.5
Date: 10 Feb 2002 15:31:25
Message: <3C66D808.B664D528@hotmail.com>
Christopher James Huff wrote:
> 
>...
> BTW, why use "(1/C)*(...)" instead of just "(...)/C"? And
> "max(int(Count)1)" should be "max(int(Count), 1)".

Have you tried to do that Christopher  ?

I too wondered about that. - And then I
tried it, but then I got different
results (with beta 9).

I haven't checked with any later betas,
so I have not filed a bug report yet.


Tor Olav


Post a reply to this message

From:
Subject: Re: Proximity Pattern and 3.5
Date: 11 Feb 2002 03:47:45
Message: <411f6ukkqp1uplrl14b1sn582vk372o0hb@4ax.com>
On Fri, 08 Feb 2002 20:38:22 -0500, Christopher James Huff <chr### [at] maccom>
wrote:
> > That's exactly what my macro does.
>
> No, your macro returns the percentage of the surrounding space occupied 
> by the object, which is quite different though it gives a similar 
> effect. It is just a blurred object pattern...hmm. Your macro could be 
> modified to blur almost any pattern or function...just remove the 
> definition of P and pass it in as a parameter, replacing "Object".

Yes, I know, but then speed optimization with boundary will not work.

> BTW, why use "(1/C)*(...)" instead of just "(...)/C"?

Becouse C is index for loop and after loop it has value 0.
Afaik 1/C is optimized to one float at parse time so it not the problem for
parser.

> "max(int(Count)1)" should be "max(int(Count), 1)".

It's result of shortest code contest :-)

ABX


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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