POV-Ray : Newsgroups : povray.newusers : repeat an object with different scaling and position Server Time
31 Oct 2024 21:26:16 EDT (-0400)
  repeat an object with different scaling and position (Message 1 to 7 of 7)  
From: Nikolaj K  Holm
Subject: repeat an object with different scaling and position
Date: 14 Mar 2007 10:31:03
Message: <45f81537@news.povray.org>
Hi there

I'm quite new in povray, so I tried to search the list for this but without 
any luck. Here we go..

I have an object - a sphere - which I want to have repeated at different 
sizes and at different positions to simulate bubbles in water. I got the 
water and a single bubble looking the way I want but is there a simpler way 
to repeat this object making the scale and position changing at random?

Thanks in advance

/Nikolaj


Post a reply to this message

From: Jim Holsenback
Subject: Re: repeat an object with different scaling and position
Date: 14 Mar 2007 10:48:31
Message: <45f8194f@news.povray.org>
"Nikolaj K. Holm" <hej### [at] hotmailcom> wrote in message 
news:45f81537@news.povray.org...
> Hi there
>
> I'm quite new in povray, so I tried to search the list for this but 
> without any luck. Here we go..
>
> I have an object - a sphere - which I want to have repeated at different 
> sizes and at different positions to simulate bubbles in water. I got the 
> water and a single bubble looking the way I want but is there a simpler 
> way to repeat this object making the scale and position changing at 
> random?

check out the thread Objects on a slope in Povray.General you might be able 
to glean something from that.

Jim


Post a reply to this message

From: Warp
Subject: Re: repeat an object with different scaling and position
Date: 14 Mar 2007 12:38:56
Message: <45f83330@news.povray.org>
Nikolaj K. Holm <hej### [at] hotmailcom> wrote:
> I have an object - a sphere - which I want to have repeated at different 
> sizes and at different positions to simulate bubbles in water. I got the 
> water and a single bubble looking the way I want but is there a simpler way 
> to repeat this object making the scale and position changing at random?

  Could you please specify if the problem you are having is copying
objects in general, or just creating some formula which places objects
randomly according to a certain pattern?

-- 
                                                          - Warp


Post a reply to this message

From: Jim Holsenback
Subject: Re: repeat an object with different scaling and position
Date: 14 Mar 2007 14:16:34
Message: <45f84a12@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message 
news:45f83330@news.povray.org...
> Nikolaj K. Holm <hej### [at] hotmailcom> wrote:
>> I have an object - a sphere - which I want to have repeated at different
>> sizes and at different positions to simulate bubbles in water. I got the
>> water and a single bubble looking the way I want but is there a simpler 
>> way
>> to repeat this object making the scale and position changing at random?
>
>  Could you please specify if the problem you are having is copying
> objects in general, or just creating some formula which places objects
> randomly according to a certain pattern?

sounds like he described it pretty clear to me so that's why I pointed him 
at the thread you helped me with ..... part of that code has a little dither 
routine that scales, rotates, and then places it randomly in a given area 
.... just take out the stuff about trace

Jim


Post a reply to this message

From: Christian Froeschlin
Subject: Re: repeat an object with different scaling and position
Date: 14 Mar 2007 14:47:38
Message: <45f8515a$1@news.povray.org>
Nikolaj K. Holm wrote:

> I'm quite new in povray, so I tried to search the list for this but without 
> any luck. Here we go..
> 
> I have an object - a sphere - which I want to have repeated at different 
> sizes and at different positions to simulate bubbles in water. I got the 
> water and a single bubble looking the way I want but is there a simpler way 
> to repeat this object making the scale and position changing at random?

Actually, your search could have turned up my recent
sparkling water experiments:

http://news.povray.org/povray.binaries.images/message/%3C45d0d486%40news.povray.org%3E/#%3C45d0d486%40news.povray.org%3E

Here is a snippet of SDL to show how I generated the bubble object
which is to be subtracted from the liquid). Note that all bubbles
form one blob object, which renders a lot faster but is not really
perceptibly different from using individual bubbles.

#declare GLASS_RADIUS   = 0.70;
#declare WATER_LEVEL    = 2.80;
#declare BUBBLE_COUNT   = 600;
#declare BUBBLE_RADIUS  = 0.03;

#declare R = seed(42);

#declare BUBBLE_SHAPE = blob
{
   #local i = 0;
   #while (i < BUBBLE_COUNT)
     #local phi = 2*pi*rand(R);
     #local d   = rand(R) * GLASS_RADIUS;
     #if (d > GLASS_RADIUS)
       #local d = GLASS_RADIUS; /* 50% of bubbles at rim */
     #end
     #local h   = rand(R) * WATER_LEVEL;
     #local r   = 0.5 + 0.5 * rand(R);
     #local r   = r * r * BUBBLE_RADIUS; /* More small bubbles */

     sphere {d*<cos(phi),0,sin(phi)> + h*y,r,1}

     #local i = i + 1;
   #end
   threshold 0.6
}


Post a reply to this message

From: Christian Froeschlin
Subject: Re: repeat an object with different scaling and position
Date: 14 Mar 2007 14:55:48
Message: <45f85344$1@news.povray.org>
>     #if (d > GLASS_RADIUS)
>       #local d = GLASS_RADIUS; /* 50% of bubbles at rim */
>     #end

Oops, ignore these lines, they actually no longer have any
effect (or insert a factor > 1 in the calculation of d).


Post a reply to this message

From: Nikolaj K  Holm
Subject: Re: repeat an object with different scaling and position
Date: 15 Mar 2007 09:44:02
Message: <45f95bb2$1@news.povray.org>
"Christian Froeschlin" <chr### [at] chrfrde> skrev i en meddelelse 
news:45f8515a$1@news.povray.org...
> Nikolaj K. Holm wrote:
>
>> I'm quite new in povray, so I tried to search the list for this but 
>> without any luck. Here we go..
>>
>> I have an object - a sphere - which I want to have repeated at different 
>> sizes and at different positions to simulate bubbles in water. I got the 
>> water and a single bubble looking the way I want but is there a simpler 
>> way to repeat this object making the scale and position changing at 
>> random?
>
> Actually, your search could have turned up my recent
> sparkling water experiments:
>
>
http://news.povray.org/povray.binaries.images/message/%3C45d0d486%40news.povray.org%3E/#%3C45d0d486%40news.povray.org%3E
>
> Here is a snippet of SDL to show how I generated the bubble object
> which is to be subtracted from the liquid). Note that all bubbles
> form one blob object, which renders a lot faster but is not really
> perceptibly different from using individual bubbles.
>
> #declare GLASS_RADIUS   = 0.70;
> #declare WATER_LEVEL    = 2.80;
> #declare BUBBLE_COUNT   = 600;
> #declare BUBBLE_RADIUS  = 0.03;
>
> #declare R = seed(42);
>
> #declare BUBBLE_SHAPE = blob
> {
>   #local i = 0;
>   #while (i < BUBBLE_COUNT)
>     #local phi = 2*pi*rand(R);
>     #local d   = rand(R) * GLASS_RADIUS;
>     #if (d > GLASS_RADIUS)
>       #local d = GLASS_RADIUS; /* 50% of bubbles at rim */
>     #end
>     #local h   = rand(R) * WATER_LEVEL;
>     #local r   = 0.5 + 0.5 * rand(R);
>     #local r   = r * r * BUBBLE_RADIUS; /* More small bubbles */
>
>     sphere {d*<cos(phi),0,sin(phi)> + h*y,r,1}
>
>     #local i = i + 1;
>   #end
>   threshold 0.6
> }

Thanks a lot - don't know why it didn't came up in my search. Guess it 
depends on what you type in as search terms ;-)
Anyway - it works fine, so I'm one happy little ray-tracer now :o)


Post a reply to this message

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