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 OSL lens
Moderator: juanjgon
- Attachments
-
- fisheyeCamDOF.zip
- (638 Bytes) Downloaded 761 times
Thank you
This OSL works great in C4D!
Thanks for sharing.
Cheers!
This OSL works great in C4D!
Thanks for sharing.
Cheers!
C4D 2025.1.1 Octane 2025.2.1 v1.5.1, <<2 X 3090 + NVlink>>, Windows 10, X399, AMD TR 1950X, 128 GB RAM, NVIDIA SD 552.22
https://www.behance.net/PaperArchitect
https://www.behance.net/PaperArchitect
- LightwaveGuru
- Posts: 487
- Joined: Wed Jun 25, 2014 9:34 am
- Location: Germany
- Contact:
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.

Thansk James! Thats great!
snip lwguru
http://www.neotek.laboratories.de or http://www.youtube.com/c/Lightwaveguru or http://www.facebook.com/safarifx 4x Titan X 12 GB watercooled / 6x 2080 ti air cooled / 2x 980 ti watercooled
- noisyboyuk
- Posts: 103
- Joined: Thu Apr 21, 2016 5:28 am
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
This is awesome! Do you know if there is an anamorphic lens OSL script anywhere or whether this could be adapted as such?
Cheers

Thanks for that 

Work Station : MB ASUS X299-Pro/SE - Intel i9 7980XE (2,6ghz 18 cores / 36 threads) - Ram 64GB - RTX4090 + RTX3090 - Win10 64
NET RENDER : MB ASUS P9X79 - Intel i7 - Ram 16GB - Two RTX 3080 TI - Win 10 64
NET RENDER : MB ASUS P9X79 - Intel i7 - Ram 16GB - Two RTX 3080 TI - Win 10 64
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.
thank you!!
Specs: Apple MacBook Pro M1 max 64GB 2TB, MacOS 12.5 / MacPro 5,1 with NVIDIA GeForce GTX 1080 8G, MacOS 10.13.6 / Mac Pro 5,1 with AMD RX5700 8G, MacOS 12.3.1 / HP Z600 with NVIDIA 3060 RTX 12G, Windows 10 pro + Netstor GPU box, 4 x NVIDIA GTX 980ti 6G.
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.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
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.
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
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
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.
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.
- Attachments
-
- fisheyeCamDOF v2.zip
- (734 Bytes) Downloaded 395 times
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
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
Animation Technical Director - Washington DC