McManning / Coherence

Blender viewport renderer using the Unity Engine
MIT License
30 stars 0 forks source link

Add support for orthogonal cameras #16

Closed McManning closed 3 years ago

McManning commented 3 years ago

Some potentially helpful resources:

https://forum.unity-community.de/topic/15484-blender-camera-matrix-import/ https://developer.blender.org/diffusion/B/browse/master/source/blender/blenkernel/intern/camera.c$363

McManning commented 3 years ago

For future reference - derived the conversion from the following data:

image

McManning commented 3 years ago

Not actually done - seems I didn't take in account viewport dimensions so rescaling the VP screws up all the math. Cool.

McManning commented 3 years ago

projection.size = pow(region3d.window_matrix[1][1], -1) is what I'm looking for here. Do the math on Blender's side and just push that value through interop.

McManning commented 3 years ago

It's better, but the camera will still position itself in front of objects if they're not on an axis plane / in front of a plane. I also see this same behavior in Unity's own orthographic camera in scene view, so that's kinda dumb.

McManning commented 3 years ago

Going to call this done and splitting off a new ticket for handling distance issues.