POV-Ray : Newsgroups : povray.advanced-users : Pixel Mapping : Pixel Mapping Server Time
1 Jul 2024 06:17:07 EDT (-0400)
  Pixel Mapping  
From: Captain Jack
Date: 2 Nov 2009 10:22:27
Message: <4aeef933$1@news.povray.org>
Is there a formula somewhere already worked out where I can plug in the 
parameters to a camera object and an arbitray point in space, and determine 
which is the nearest pixel corresponding to it in the image plane? Ideally, 
I'd like to be able to do it with SDL inside a scene. I know that I can't 
extract certain things from the camera object, but I don't have a problem 
with loading them into variables first, then accessing them after the camera 
declaration.

More specifically, this is (ideally) the sort of thing I want to do:

----------------------------------------
#declare Camera_Type = 1; // Perspective
#declare Camera_Location = 6*y-12*z;
#declare Camera_Look_At = 0*x;
#declare Camera_Right = image_width/image_height*x;
#declare Camera_Up = y;
#declare Camera_Angle = 45;

camera {
    // Use vars above
}

#macro PixelAt(Point_Vector)
    // Code goes here that takes that point and the camera
    // settings, and calculates a 2D vector that corresponds
    // to the nearest pixel in the output.
#end
----------------------------------------

A couple of the things I want to be able to do with it are to generate 
images that occupy specific portions of the screen, and to be able to map a 
"hot point" of a moving object in an animtion to apply other effects in 
other software.

I've done some digging in the source code, but I haven't figured it out yet. 
If somebody knows which source file and which functions I should be looking 
at, that would be helpful as well.

Thanks in advance,
Jack


Post a reply to this message

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