POV-Ray : Newsgroups : povray.general : How to place objects randomly in the visible area of image? : Re: How to place objects randomly in the visible area of image? Server Time
5 Nov 2024 03:16:37 EST (-0500)
  Re: How to place objects randomly in the visible area of image?  
From: ABX
Date: 22 Jul 2003 07:44:22
Message: <758qhvolh9p5a5f4crfoqjorbn20o38aes@4ax.com>
On Fri, 18 Jul 2003 15:32:24 +0300, "Janne" <kos### [at] kolumbusfi> wrote:
> Hi,
> How can I test if a randomly selected point is visible to my camera? I need
> to place a lot of objects in my scene, but I run out of memory if I place
> objects over the whole scene.


Here is simple method:

 1. Get camera location in point L
 2. Get rectangle of screen in scene coordinates - vertices at P1,P2,P3,P4
 3. Declare mesh M with triangle T1=P1-P2-P3 and T2=P1-P3-P4 to mimic screen

 loop:

    4. Get random location in point A
    5. Use trace function with ray from L to A.
    6. Check if sended ray intersected mesh M.
    7. If intersected then use point A to locate object.
    8. If not enough founded locations then repeat loop.

 9. Render
10. Show result in povray.binaries.images

ABX


Post a reply to this message

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