POV-Ray : Newsgroups : povray.binaries.images : Flower generation macro test #3 Server Time
5 Nov 2024 11:16:12 EST (-0500)
  Flower generation macro test #3 (Message 1 to 7 of 7)  
From: Dan Byers
Subject: Flower generation macro test #3
Date: 10 Jul 2009 17:40:23
Message: <4a57b547@news.povray.org>
Flowers randomly placed upon a height_field using trace().  Still needs 
tweaking, as the flowers are running into each other.

-- 
Dan
GoofyGraffix.com


Post a reply to this message


Attachments:
Download 't0120033.png' (286 KB)

Preview of image 't0120033.png'
t0120033.png


 

From: Alain
Subject: Re: Flower generation macro test #3
Date: 10 Jul 2009 23:11:50
Message: <4a5802f6$1@news.povray.org>

> Flowers randomly placed upon a height_field using trace().  Still needs 
> tweaking, as the flowers are running into each other.
> 
> 
> ------------------------------------------------------------------------
> 
I suggest 3 options for your colliding flowers:
  - change the random seed.
  - slightly increase the spacing of the flowers. Just miltiply the 
horizontal locations by 1.03-1.05 before tracing.
  - add an exclusion cylinder centered around each flower, binded in an 
union. The cylinders radius will dictate the minimum distance between 
two flowers. You perform an insideness test on that union before you 
place a new flower.


Alain


Post a reply to this message

From: Dan Byers
Subject: Re: Flower generation macro test #3
Date: 11 Jul 2009 11:20:45
Message: <4a58adcd$1@news.povray.org>
Alain wrote:
> I suggest 3 options for your colliding flowers:
>  - change the random seed.
>  - slightly increase the spacing of the flowers. Just miltiply the 
> horizontal locations by 1.03-1.05 before tracing.
>  - add an exclusion cylinder centered around each flower, binded in an 
> union. The cylinders radius will dictate the minimum distance between 
> two flowers. You perform an insideness test on that union before you 
> place a new flower.
> 
> 
> Alain
> 

Option 1 may fix the currently colliding flowers, but may create new 
collisions to take their place.

Option 3 is part of a solution I've got working in the back of my brain 
(see my latest blog post on my website).  For most scenes in my movie, 
the flowers will either be behind a wall of focal blur or zipping past 
the camera fairly quickly, so I may not worry too much about collisions.

Thanks for the suggestions :)

-- 
Dan
GoofyGraffix.com


Post a reply to this message

From: Alain
Subject: Re: Flower generation macro test #3
Date: 11 Jul 2009 21:32:57
Message: <4a593d49@news.povray.org>

> Alain wrote:
>> I suggest 3 options for your colliding flowers:
>>  - change the random seed.
>>  - slightly increase the spacing of the flowers. Just miltiply the 
>> horizontal locations by 1.03-1.05 before tracing.
>>  - add an exclusion cylinder centered around each flower, binded in an 
>> union. The cylinders radius will dictate the minimum distance between 
>> two flowers. You perform an insideness test on that union before you 
>> place a new flower.
>>
>>
>> Alain
>>
> 
> Option 1 may fix the currently colliding flowers, but may create new 
> collisions to take their place.
> 
> Option 3 is part of a solution I've got working in the back of my brain 
> (see my latest blog post on my website).  For most scenes in my movie, 
> the flowers will either be behind a wall of focal blur or zipping past 
> the camera fairly quickly, so I may not worry too much about collisions.
> 
> Thanks for the suggestions :)
> 
Effectively, in situations like those, you can afford to be lenient 
about collisions.
And, looking into some real world situations, there are cases of 
colliding flowers. The only thing is that the petals never intersect but 
pass between those of neiboring flowers.


Alain


Post a reply to this message

From: Tim Attwood
Subject: Re: Flower generation macro test #3
Date: 11 Jul 2009 23:50:11
Message: <4a595d73$1@news.povray.org>
I wrote a collision macro a while back,
you could populate an array with the flowers
and check that they don't collide. The rez
number could be quite small (faster) since it
doesn't matter too much if the flowers just
touch a bit.

#include "rand.inc"
#macro collision(A B rez)
   #local result = false;
   #if (((min_extent(A).x > max_extent(B).x ) |
         (min_extent(B).x > max_extent(A).x ) |
         (min_extent(A).y > max_extent(B).y ) |
         (min_extent(B).y > max_extent(A).y ) |
         (min_extent(A).z > max_extent(B).z ) |
         (min_extent(B).z > max_extent(A).z ))=false)
      #local AB = intersection{object{A} object{B}};
      #local Mn = min_extent(AB);
      #local Mx = max_extent(AB);
      #local S1 = seed(1);
      #local cnt = 0;
      #while ((result = false) & (cnt < rez))
         #local Pt = VRand_In_Box(Mn, Mx, S1);
         #local Norm = <0,0,0>;
         #local Hit = trace(AB,<Pt.x,Mn.y-0.1,Pt.z>,y,Norm);
         #if (vlength(Norm)!=0)
            #local result = true;
         #else
            #local Hit = trace(AB,<Mn.x-0.1,Pt.y,Pt.z>,x,Norm);
            #if (vlength(Norm)!=0)
               #local result = true;
            #else
               #local Hit = trace(AB,<Pt.x,Pt.y,Mn.z-0.1,>,z,Norm);
               #if (vlength(Norm)!=0)
                  #local result = true;
               #end
            #end
         #end
         #local cnt = cnt + 1;
      #end
   #end
   (result)
#end


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Flower generation macro test #3
Date: 12 Jul 2009 06:05:53
Message: <4a59b581$1@news.povray.org>
Another option is to generate them without collision in the
first place. Instead of placing them at random location, go
through a grid of points with twice the necessary spacing and
decide randomly whether to place an object (or semi-randomly,
you can control the probability using a pattern function).

To avoid too regular placing, you can then add some random
offset or turbulence to the grid position (which is why you
need more than the maximum spacing in the initial grid).


Post a reply to this message

From: Dan Byers
Subject: Re: Flower generation macro test #3
Date: 14 Jul 2009 20:42:15
Message: <4a5d25e7$1@news.povray.org>
Thanks for all the good ideas.  What's probably going to happen is, for 
shots with the flowers playing a prominent visual role, the flowers will 
be manually placed and tweaked to avoid any petal/leaf collision. 
Flowers relegated to background status behind a wall of focal blur... 
well, we'll just leave them to chance ;)  As I've mentioned before, I 
don't want to spend a thousand hours to cure a ten-second headache...


-- 
Dan
GoofyGraffix.com


Post a reply to this message

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