POV-Ray : Newsgroups : povray.advanced-users : Need a script to randomly scatter objects vertically : Re: Need a script to randomly scatter objects vertically Server Time
19 Nov 2026 06:28:54 EST (-0500)
  Re: Need a script to randomly scatter objects vertically  
From: Alain Martel
Date: 12 May 2021 10:19:27
Message: <609be3ef$1@news.povray.org>
Le 2021-05-11 à 17:16, Mike Horvath a écrit :
> I finally got around to this. Thanks!
> 
> I don't quite understand the code yet. A few questions:
> 
> 1. How do I make it so that the probability is lower depending on the
>     slope of the terrain? This should vary depending on the type of
>     object. For instance, the sphere might not like a high slope. The
>     spike might not care very much.
> 2. The spikes seem to point in the direction of the normal. Can I
>     disable this? I want them to always be vertical.
> 3. Is there a way to round the y coordinate to the nearest 8 units and
>     the x and z coordinates to the nearest 10 units? I am working with
>     virtual LEGO and the precision is very coarse.
> 
> Thanks again!
> 
> 
> Michael
> 
> 
For the spikes. You just need to ignore the normal returned by the trace 
function when placing them.
So, remove any vrotate or vorient.

For the rounding... I would try using the modulo function.
Something like this :
#declare LEGO_Position = <Position.x-mod(Position.x, 10), 
Position.y-mod(Position.y, 8), Position.z-mod(Position.z, 10)>


Post a reply to this message

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