Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panoramic camera support #45

Open
kubo-von opened this issue Feb 10, 2020 · 13 comments
Open

Panoramic camera support #45

kubo-von opened this issue Feb 10, 2020 · 13 comments

Comments

@kubo-von
Copy link
Contributor

Cycles in Blender support other camera models like fisheye, mirroball etc, it could be useful to have those in Gaffer as well.

Screenshot from 2020-02-10 22-41-26

Not sure where these settings would live though.
cyclesAttributes or cyclesOptions?

Cheers

@sschwungsau
Copy link

sschwungsau commented Feb 10, 2020 via email

@boberfly
Copy link
Owner

Sure, sounds good.

@boberfly
Copy link
Owner

ddc6b79

I was just using a CameraTweaks node to specify custom options, this is much like how Arnold is treated right now, so no nice UI really (yet) but it did work from what I see.

@boberfly
Copy link
Owner

Hey @kubo-von and @sschwungsau

This build should have a way to set these via a CameraTweaks node:
https://github.com/boberfly/GafferCycles/releases/tag/0.17.0

I was able to do panoramas by adding the string parameter panoramaType and setting it with:
equirectangular, mirrorball, fisheyeEquidistant or fisheyeEquisolid

https://github.com/boberfly/GafferCycles/blob/master/src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp#L137

To set other parameters, it'll be doing a for-loop over custom parameters and will try to set the socket connection if the names match eg. "fisheye_fov" with a float value. They can be found here: https://github.com/boberfly/cycles/blob/74f4cbdee302eaacbdacf513bc76d7fe057bf220/src/render/camera.cpp#L59 ( eg. SOCKET_FLOAT(fisheye_fov, "Fisheye FOV", M_PI_F); ).

Cheers

@sschwungsau
Copy link

coolio ! thanks !

@kubo-von
Copy link
Contributor Author

Awesome, thanks @boberfly !
I'll look into how to add the parameters automatically with python.

@kubo-von
Copy link
Contributor Author

Hey @boberfly
I've been trying to get it work for a while but either I'm not doing it right or something is off.
Without panoramic:
Screenshot from 2020-02-20 21-19-57
With panoramic:
Screenshot from 2020-02-20 21-19-10
camera tweaks node:
Screenshot from 2020-02-20 21-19-23
(these values are only ones where I could actually see the scene in camera, with blender-like values nothing was there.)
Since the camera looks like it's rotated maybe some blender vs gaffer coordinates conversion is not happening?
Scene:
https://drive.google.com/file/d/13XIR7CjZMvDSMKVtFEwFKKJx5MP8qBFw/view?usp=sharing

Cheers

@boberfly
Copy link
Owner

Hey @kubo-von
Can you simply just rotate the camera itself to adjust it? I am doing some funky matrix conversion to get it to work with cameras in general eg.
https://github.com/boberfly/GafferCycles/blob/master/src/GafferCycles/IECoreCyclesPreview/Renderer.cpp#L2641

@kubo-von
Copy link
Contributor Author

Hey @boberfly
Playing with it more I've managed to get the same view by rotating the camera
Screenshot from 2020-02-21 13-21-40
Screenshot from 2020-02-21 13-21-15
But not by any logical values like -90 etc:
Screenshot from 2020-02-21 13-22-07

But at least for the fisheye_fov parameter I figured it expects radians not degrees like in blender UI
For fisheye_lens I have no idea what the conversion is yet, as it doesn't seem to be any metric units.

Updated scene:
panoramic.gfr

Cheers

@boberfly
Copy link
Owner

Ahh radians alright, yeah I have had to make conversions of that in many places I can do this with those values also.

@kubo-von
Copy link
Contributor Author

Cool!
As for the orientation of the camera, this is just a long shot, but maybe the Y and Z axis are not switched ? Because for environment_texture is also rotated like this unless you switch Y and Z axes in the mapping section.

@boberfly
Copy link
Owner

Yeah I am thinking it's this. Not sure what to do about it though without modifying Cycles source code eg. flipping some stuff here:
https://github.com/boberfly/cycles/blob/ac1d47427950769a7b022fdb85fb84d003d3f72a/src/render/camera.cpp#L400

@kubo-von
Copy link
Contributor Author

What about modifying the transform matrix of the camera when it's switched to panoramic before sending it to cycles ? Would that be possible ?

I will try to find some matrix multiplication/modification which would fix the camera angle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants