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
20 Apr 2024 01:02:18 EDT (-0400)
  Re: Need a script to randomly scatter objects vertically  
From: Bald Eagle
Date: 13 May 2021 07:05:00
Message: <web.609d0778c2ce34cb1f9dae3025979125@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:

> 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.

I just took a brief look at this.

Since your objects get placed using a loop, you can add conditionals and
multipliers.

So maybe have a rand value selecting for each type of object.  Using #switch,
you can do object-specific things like define values, orientation, etc.

In each block of object code you can simply do a calculation on the slope to see
if it's a good value.  If it is, you can just use another rand value and if it's
below a certain threshold, then place your object.  #if (RandVal < 80)  object
{Object} #end  Would place it 80% if the time.

There's a terrain scale that gets used to adjust other calculations in the
scene.  That ought to make the fairly code size independent.

Looks like everything is at the origin, so you'll have to do it and then
translate, or translate to the origin, do it, and then translate back.

That's all I picked up / thought up on a quick read-through.


Post a reply to this message

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