POV-Ray : Newsgroups : povray.general : Not grokking mesh camera : Re: Not grokking mesh camera Server Time
12 Jun 2024 16:53:38 EDT (-0400)
  Re: Not grokking mesh camera  
From: Josh English
Date: 30 Apr 2023 17:44:13
Message: <644ee12d@news.povray.org>
On 4/30/2023 5:08 AM, Chris Cason wrote:
> 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.

> 
> 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. 
>
http://news.povray.org/povray.binaries.images/thread/%3C500fb7e5%40news.povray.org%3E/
> 
> -- Chris

Thank you.

I was going through Jaime's demo files and just not understanding the 
logic. I still don't but I think my problem may be in my mesh 
generation. I am looping through each row, then each column, and 
creating a triangle, but I was not creating an equilateral triangle and 
I thought that was the problem. I updated my code to match Jaime's but 
the problem remains.

My loops:

// frame for the mesh
#declare UL = <(-image_width/image_height)/2, 2, -4>;
#declare LR = <(image_width/image_height)/2, 1, -4>;

#declare u_vect = <LR.x, UL.y, LR.z> - UL;
#declare v_vect = <UL.x, LR.y, LR.z> - UL;

#declare tr_base_1=<        0,2/3,0>*0.1;
#declare tr_base_2=< 1/2, -1/3,0>*0.1;
#declare tr_base_3=<-1/2, -1/3,0>*0.1;
#declare camera_mesh =
mesh {
   #for(V,0,image_height,1)
     #for(U,0,image_width,1)
       #declare here = (UL+u_vect*(U/image_width)+v_vect*(V/image_height));
       triangle {
         here + tr_base_1, here + tr_base_2, here + tr_base_3
       }
     #end // for U
   #end // for V
} // mesh

The first attachment shows the basic scene, where I've built the mesh 
and what it's looking at. The second attachment shows the results of 
using the mesh with distribution 0. The cylinder is diagonal and repeated.

The mesh camera code itself is
camera {
   mesh_camera { 1 0
     mesh { camera_mesh }
   }
   location <0,0,-.1>
   direction z
   }

I have no idea what's going on with this code.

Josh


Post a reply to this message


Attachments:
Download 'mech_cam_blocking.png' (196 KB) Download 'mesh_cam_wtf.png' (18 KB)

Preview of image 'mech_cam_blocking.png'
mech_cam_blocking.png

Preview of image 'mesh_cam_wtf.png'
mesh_cam_wtf.png


 

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