Page 1 of 2
Fisheye OSL lens
Posted: Mon Aug 13, 2018 12:02 pm
by baltort
Hi all,
For anyone that likes funky lenses, here's a quick implementation of a fisheye lens I've written in OSL.
It defaults to a FOV of 180 degrees, an aperture of 1 unit and a focal distance of 5 units. These can be overwritten in the node editor by connecting scalar nodes to those inputs...
Enjoy!
James.
Re: Fisheye OSL lens
Posted: Fri Aug 17, 2018 3:37 am
by Kalua
Thank you
This OSL works great in C4D!
Thanks for sharing.
Cheers!
Re: Fisheye OSL lens
Posted: Fri Aug 17, 2018 7:16 pm
by LightwaveGuru
baltort wrote:Hi all,
For anyone that likes funky lenses, here's a quick implementation of a fisheye lens I've written in OSL.
It defaults to a FOV of 180 degrees, an aperture of 1 unit and a focal distance of 5 units. These can be overwritten in the node editor by connecting scalar nodes to those inputs...
Enjoy!
James.
fisheye dof 1.jpg
Thansk James! Thats great!
snip lwguru
Re: Fisheye OSL lens
Posted: Wed Aug 22, 2018 10:54 am
by noisyboyuk
Hey man!
This is awesome! Do you know if there is an anamorphic lens OSL script anywhere or whether this could be adapted as such?
Cheers

Re: Fisheye OSL lens
Posted: Thu Aug 23, 2018 5:32 am
by pixym
Thanks for that

Re: Fisheye OSL lens
Posted: Sat Aug 25, 2018 8:51 am
by 3dworks
baltort wrote:Hi all,
For anyone that likes funky lenses, here's a quick implementation of a fisheye lens I've written in OSL.
It defaults to a FOV of 180 degrees, an aperture of 1 unit and a focal distance of 5 units. These can be overwritten in the node editor by connecting scalar nodes to those inputs...
Enjoy!
James.
fisheye dof 1.jpg
thank you!!
Re: Fisheye OSL lens
Posted: Tue Aug 28, 2018 10:02 am
by baltort
noisyboyuk wrote:Hey man!
This is awesome! Do you know if there is an anamorphic lens OSL script anywhere or whether this could be adapted as such?
Cheers

Anamorphic lenses... Interesting. I think you could create this effect in native lightwave just by changing the aspect parameter on the camera, but this appears to be ignored by Octane.
What's the appeal of anamorphic lenses? I think the main visual effect is that a wide image is squeezed onto a narrower negative. When this is then stretched back out during projection any optical effects that happen within the lens are stretched too; bokeh and lens flairs become stretched horizontally. I think this is conceptually the same as having an elliptical aperture in the camera. Is that what you're trying to create? Fairly straight forward in OSL.
Cheers,
James.
Re: Fisheye OSL lens
Posted: Mon Sep 10, 2018 1:20 pm
by addol95
Hi!
I'm currently doing RnD for a project, and I stumbled upon this great OSL camera.
However, we'd need full-frame coverage. Is there a way to modify this so that we can crop the image directly in the script and avoid the black parts?
(we don't want to render double resolution and then crop out the area to display)
thanks in advance
Re: Fisheye OSL lens
Posted: Tue Sep 11, 2018 10:31 am
by baltort
Hi,
That's straight forward enough... Here's an updated camera with a pin for cropping. It defaults to not cropped, but you can make it crop by attaching an integer of value 1 to this input.
I've set it up so that we reach full field of view at the mid points of the edge of frame. This means the bits that are now no longer cropped are wider than the FOV of the camera. In short, it's quite likely that the corners of the image will show points behind the camera...
I've also tidied up the DOF calculations, so it's worth switching to v2 of the camera even if people don't want the crop/uncrop functionality.
Let me know how you get on.
Cheers,
James.
Re: Fisheye OSL lens
Posted: Tue Sep 11, 2018 1:27 pm
by frankmci
Nice addition, James. Thanks!
To maybe save somebody a bit of messing around, I've found that a FOV of 127.5 degrees with a standard 16:9 aspect ratio will give you the max fishiness without rendering anything that would actually be behind the camera. I think that's what you'd actually see if you cropped a real world 180 fisheye image. It's simple enough to test this for whatever aspect ratio you need by placing an appropriately obvious textured test plane right behind the camera and perpendicular to the line of sight.
Also, I can confirm this OSL still works fine in C4D.
- Frank