POV-Ray : Newsgroups : povray.advanced-users : New random distribution macros : Re: New random distribution macros Server Time
25 Feb 2024 08:07:16 EST (-0500)
  Re: New random distribution macros  
From: Kenneth
Date: 4 Mar 2021 09:05:07
Message: <web.6040e7d8296d8a3bd98418910@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> And then, as I discovered, after hunting down a curious line of code in Ingo's
> vrand on sphere macro, that there's the matter of not just randomly
> placed - but EVENLY placed.   The distributions can be quite tricky.
> Lets say we take a landscape heightfield and try to place objects onto
> it.   If we just trace() straight down from an imaginary rectangle of
> ray starting coordinates, then the regions of rapidly changing elevation
> don't get as much arc-length coverage as the flat parts.

Yeah, that little problem has always been a thorny one to try and solve. But I
just had a wild idea (possibly a naive one):
It seems to me that the pixel positions of a *u-v map* of a HF might somehow be
used to generate the trace-from points. Since the u-v map is by nature a
'stretched-out' representation of the HF itself-- covering all of the HF's area,
and with more points or pixel positions than a typical
'trace-down-from-rectangular-area' scheme -- the uv-map's points or pixels could
then be correlated (somehow) with the corresponding points on the HF... the
result being to 'evenly' cover the HF with trace rays, even on steep elevations.
That's what I see in my minds eye, anyway.

In "shapes.inc", there are macros for creating mesh HFs in various shapes-- I'm
thinking of HF_Square() there, which then uses HF_Create() to produces u-v
coordinates, I think. (It has been awhile since I've used them.) Maybe the code
there would give a clue as to how this scheme could be implemented, in concert
with trace.

Post a reply to this message

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