# Radiosity Mesh Baking : Camera Up vectors

## Recommended Posts

akhin    104
Hi ,

I am using hemicubes to compute incident light ( form factors ) in my radiosity renderer.
So my renderer requires up vectors ( for creating view matrices for cameras per patch)
along with normal vectors per surface.

Considering model files ( x,3ds,obj etc) which ones supply those up vectors ?
Or if they not , how can I calculate an up vector by using center of a patch
(averaging 3 vertices of a polygon-patch) and the polygon normal ?

thanks

##### Share on other sites
B_old    689
I don't know which model formats specifically allow to store this, but I guess you could use the tangent vector as an up direction for the camera. If you don't have access to the tangent from the model, you can calculate it yourself, using a method like [url="http://www.terathon.com/code/tangent.html"]this[/url].
I am curious btw how important the choice of up vector is in this scenario, because it seems like it should not matter as long the camera is pointing in the right direction.

##### Share on other sites
MJP    19786
If you really need a consistent frame of reference you can use the tangent frame, but typically you only need this if you're baking to a basis that's oriented about a hemisphere (like H-basis, or HL2 basis). For most cases you can just generate an up vector by picking a direction perpendicular to the normal.

##### Share on other sites
akhin    104
[quote name='MJP' timestamp='1314040282' post='4852455']
If you really need a consistent frame of reference you can use the tangent frame, but typically you only need this if you're baking to a basis that's oriented about a hemisphere (like H-basis, or HL2 basis). For most cases you can just generate an up vector by picking a direction perpendicular to the normal.
[/quote]

Yes I see , as long as up vector is perpendicular to the normal it will be ok

but now then my question is how can I calculate those perpendicular vectors ?

##### Share on other sites
MJP    19786
[url="http://www.gamedev.net/topic/445164-how-to-get-a-direction-vector-perpendicular-to-a-direction-vector-/"]http://www.gamedev.net/topic/445164-how-to-get-a-direction-vector-perpendicular-to-a-direction-vector-/[/url]