POV-Ray : Newsgroups : povray.general : Not grokking mesh camera : Re: Not grokking mesh camera Server Time
4 Oct 2023 13:36:34 EDT (-0400)
  Re: Not grokking mesh camera  
From: Chris Cason
Date: 30 Apr 2023 08:08:50
Message: <644e5a52$1@news.povray.org>
On 30/04/2023 12:30, Josh English wrote:
> I am trying to understand the mesh camera and picking apart the demo scenes but I'm
just not getting something.

It's a long time since I wrote the mesh camera code, so please excuse me if my memory
is rusty, but I'll try to answer.

The following applies to distribution methods 0, 1 and 2:

> The normal vector of the triangle determines the direction of the ray for that

Yes, with the consideration that if the camera Z direction is less than 0, the normal
is reversed.

> Does the position of the mesh also determine the location of the ray?

Yes, with the caveat that the Z location of the camera is then used to offset the
ray's origin along its direction.

> A second question: is the first triangle in the mesh the upper left corner of the
image or bottom left corner?

Upper left. The face index is mapped as y * width + x, where y, width and x are all
first mapped to unsigned int.

> A third question: does the ray start at the first vector in each triangle?

No, it's shot from the triangle's centroid.

About mesh selection:

Distribution 0 is single or multiple rays per pixel, with each additional ray going to
the next mesh in the sequence in which they were declared.

Distribution 1 is 1:1 distribution across summed meshes, potentially with multiple
rays per pixel. The faces of all the supplied meshes are logically summed together as
if they were one single mesh. If shooting multiple rays per pixel, the face index is
determined as (width * height * ray_number) + pixel_number.

Distribution 2 is multiple logical cameras, placed side-by-size horizontally, with
mesh #0 being the left-most camera, and mesh #n is the right-most. Rays per pixel is

I won't cover distribution 3 here as it's quite different from the above.

I also suggest that, if you haven't already done so, you take a look at Jaime's mesh
camera page at http://www.ignorancia.org/index.php/technical/mesh-camera/. He's also
posted some other examples here in the groups, e.g.

-- Chris

Post a reply to this message

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