PDA

View Full Version : Is LWCameraEvaluationFuncs global and evaluate() function fixed



Sensei
09-21-2006, 02:22 PM
If we're now in bug area, can I ask whether do you know or have fixed LWCameraEvaluationFuncs global and evaluate() function so it doesn't return 0 whatever parameters are passed? I wanted to write Virtual Renderer that render any resolution images, but after writing basic part, realized that it's impossible to calculate in LW9 friendly way where ray starts and it's direction.. Or maybe I do something wrong, need to write custom camera plug-in just to see whether it's evaluation call-back is called by LWCameraEvaluationFuncs->evaluate(), but why to **** is it returning 0 and not filling fields even for 0.0, 0.0 position.. ?!

Jarno
09-21-2006, 11:37 PM
If the camera is set to Classic, then camera evaluation will always return 0. The classic camera doesn't shoot rays in the sense that the other cameras do. You can check if the classic camera is being used through the LWCAMF_USECAMTYPE camera info flag.

---JvdL---

Sensei
10-07-2006, 03:39 PM
Sorry for long time to response..

Thanks! It works fine and as it should :) That's pitty there is no example in LW SDK how to use it properly..

I have one question: in what value space are fx,fy parameters passed to evaluation? I tried passing 0..render camera width,0..render camera height (pixelaccess->sx/sy parameters) and -1.0..1.0 but they don't work..

Using
double fx = pixelaccess->sx / 640.0;
double fy = pixelaccess->sy / 480.0;
fx -= 0.5;
fy -= 0.5;
fx /= 50.0;
fy /= 50.0;
I get some test result proving evaluate() works fine, but still not near perfection..

How to properly calculate fx,fy from sx,sy in render camera pixel space?

Jarno
10-07-2006, 07:21 PM
fpx and fpy are the fpx and fpy given to the camera handler evaluate function. As the camera handler docs explain, these are in filmplane coordinates. That is, the position on the film in metres, measured from the centre.

To convert a pixel position to a filmplane position you need to know the width and height of the film frame in metres. The height can be determined from the zoom and focal length:

filmHeight = 2 * focalLength / zoomFactor
The film width is then:

filmWidth = filmHeight * frameAspectRatio
where

frameAspectRatio = horizontalResolution / verticalResolution * pixelAspectRation

I have no idea why the film width and height aren't directly available in the camera info. I'll fix that.

---JvdL---