POV-Ray : Newsgroups : povray.advanced-users : Need a script to randomly scatter objects vertically Server Time
20 Apr 2024 06:22:13 EDT (-0400)
  Need a script to randomly scatter objects vertically (Message 21 to 30 of 30)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 13 May 2021 15:41:20
Message: <609d80e0$1@news.povray.org>
On 5/13/2021 2:55 PM, Bald Eagle wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
> 
>> Could I create a slope map or object pigment? That would be a lot
>> smoother gradient I think than doing a few checks here and there using
>> conditionals.
> 
> Not having implemented any of this in a working scene, I don't presently have
> any practical knowledge of everything that's going on.  As it appeared to me,
> there were a few pigments/functions that governed stuff, and a trace to get a
> normal at a point.  I'm not sure why more maps or pigments would be required or
> how they would be used.
> 

The clutter script already determines the probability of placing an 
object using a grayscale pigment. I am thinking I could leverage that by 
supplying a grayscale pigment representing the slope of the terrain 
object. Not sure how though.

Any heightmap will do right now such as this one:

https://en.wikipedia.org/wiki/File:Heightmap.png

I have attached the code I am working on right now.


Mike


Post a reply to this message


Attachments:
Download 'clutter_001.zip' (105 KB)

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 13 May 2021 15:58:21
Message: <609d84dd$1@news.povray.org>
Alternatively I can render an overhead shot of the terrain with a 
grayscale pigment determined by slope, and feed the resulting image back 
into the macro as an image map.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 13 May 2021 21:48:59
Message: <609dd70b@news.povray.org>
This version should work better.

It adjusts the probability of the spheres based on:

1. slope of terrain
2. altitude of terrain

Low flat areas have more spheres.

Cones are evenly distributed.


Mike


Post a reply to this message


Attachments:
Download 'clutter_002.zip' (306 KB)

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 21 May 2021 04:02:41
Message: <60a76921@news.povray.org>
This version generates a heightmap from the original vertex data, that 
is then fed into the main script. I think I made some small tweaks to 
the probability functions too. I am pretty happy with the results.


Mike


Post a reply to this message


Attachments:
Download 'clutter_005.zip' (1673 KB) Download 'makescene.png' (650 KB)

Preview of image 'makescene.png'
makescene.png


 

From: Thomas de Groot
Subject: Re: Need a script to randomly scatter objects vertically
Date: 21 May 2021 08:06:59
Message: <60a7a263@news.povray.org>
Op 21-5-2021 om 10:02 schreef Mike Horvath:
> This version generates a heightmap from the original vertex data, that 
> is then fed into the main script. I think I made some small tweaks to 
> the probability functions too. I am pretty happy with the results.
> 
This looks very good!

-- 
Thomas


Post a reply to this message

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 25 May 2021 13:44:55
Message: <60ad3797$1@news.povray.org>
On 5/21/2021 8:06 AM, Thomas de Groot wrote:
> Op 21-5-2021 om 10:02 schreef Mike Horvath:
>> This version generates a heightmap from the original vertex data, that 
>> is then fed into the main script. I think I made some small tweaks to 
>> the probability functions too. I am pretty happy with the results.
>>
> This looks very good!
> 


Thanks! Jonathan Rafael Ghiglia created an awesome script!


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects horizontally
Date: 27 May 2021 07:37:08
Message: <60af8464$1@news.povray.org>
Just realized the title of this thread should be, "Need a script to 
randomly scatter objects horizontally". Oops!


Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: Need a script to randomly scatter objects horizontally
Date: 27 May 2021 10:52:49
Message: <60afb241$1@news.povray.org>
Op 27-5-2021 om 13:37 schreef Mike Horvath:
> Just realized the title of this thread should be, "Need a script to 
> randomly scatter objects horizontally". Oops!
> 
LOL yes, but the vertical differentiation you were also after, validated 
the title anyway.

-- 
Thomas


Post a reply to this message

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 27 May 2021 16:58:14
Message: <60b007e6@news.povray.org>
This version has some changes to the arrays, as well as the option to 
round values to within a certain threshold. For instance, I am working 
with LDraw models, so I round to the nearest 20 horizontal units, 8 
vertical units, and 90 degree rotation increments.

Also, the script outputs data to a TSV file you can then import into a 
spreadsheet.


Mike


Post a reply to this message


Attachments:
Download 'clutter_dv_006.zip' (1085 KB)

From: Mike Horvath
Subject: Re: Need a script to randomly scatter objects vertically
Date: 27 May 2021 18:09:41
Message: <60b018a5@news.povray.org>
Screenshot after importing the generated coordinates into LDraw.


Mike


Post a reply to this message


Attachments:
Download 'ldview_screenshot_024.fs.png' (792 KB)

Preview of image 'ldview_screenshot_024.fs.png'
ldview_screenshot_024.fs.png


 

<<< Previous 10 Messages Goto Initial 10 Messages

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