## Correspondence between exported screenwindow and Luxrender

Discussion related to the 'LuxBlend' Blender 2.4+ python exporter script.

Moderators: Ratow, SATtva, coordinators

### Correspondence between exported screenwindow and Luxrender

I'm interested in understanding which screenwindow values for perspective cameras are actually being used internally in Luxrender. I'm also trying to understand the correspondence between the way LuxBlend and LuxRender compute the screenwindow values.

From what I can tell, LuxRender will compute the screen coordinates in lux/cameras/perspective.cpp (via PerspectiveCamera::CreateCamera) circa v1.0RC2. However, if there is a screenwindow parameter in the LXS file (or parameter set), LuxRender will overwrite it's computation with those values. In my case, I'm using LuxBlend for exporting and screenwindow exists, but it's computed differently than LuxRender would compute it. The code I'm referencing for LuxBlend is properties/camera.py.

Example
For a situation where xresolution=640 and yresolution=480, the aspect ratio is clearly 4/3.

LuxBlend computes and exports:
Code: Select all
screenwindow=[-1 1 -0.75 0.75]

LuxRender computes:
Code: Select all
screenwindow=[-1.333 1.333 -1 1]

which, from what I can tell, is overwritten by the LuxBlend computation in the lines that follow in perspective.cpp. Please forgive me because I know that LuxRender is not PBRT, but given the large amount of inheritance, I figured there would be some correspondence to Pharr and Humphrey's:

For square images, both x and y lie between [−1, 1] in screen space. Otherwise, the direction in which the image is narrower maps to [−1, 1] and the wider direction maps to a proportionally larger range of screen space values.

This appears to be the case for the the LuxRender computations, but not for the LuxBlend computations. I'm sure that I'm missing something as I'm admittedly ignorant of the bigger picture typically. I've kind of hit a wall on my own and figured I'd solicit some knowledge here

Any thoughts?
TemporalBlur

Posts: 17
Joined: Tue Mar 13, 2012 11:29 am

### Re: Correspondence between exported screenwindow and Luxrend

Hi,

It's just a matter of convention, the axis mapping to -1:1 defines the fov. You can have the fov on the narrower or on the wider axis. I guess having it on the wider axis matches Blender viewport, but internally LuxRender inherits PBRT definition.

Jeanphi
jeanphi

Posts: 6624
Joined: Mon Jan 14, 2008 7:21 am

### Re: Correspondence between exported screenwindow and Luxrend

jeanphi wrote:Hi,

It's just a matter of convention, the axis mapping to -1:1 defines the fov. You can have the fov on the narrower or on the wider axis. I guess having it on the wider axis matches Blender viewport, but internally LuxRender inherits PBRT definition.

Jeanphi

That helps me understand the convention a bit more clearly--I think. So if FOV=70, -1 in screen space is a 35 degree offset from center?

I believe I misinterpreted Pharr and Humphreys. Their convention is that the narrower of the two maps to the field of view--more like real cameras. LuxBlend is keeping up with Blender's convention--rightly so.

Thanks Jeanphi!
TemporalBlur

Posts: 17
Joined: Tue Mar 13, 2012 11:29 am