Page 1 of 2
OSL Til Shift Lense
Posted: Wed Sep 12, 2018 3:42 pm
by KeeWe
Hey guys,
I'm referring to this thread where baltort provided the code for a tilt shift lense:
viewtopic.php?f=36&t=68668
Copy/pasting it to the c4d octane OSL option, the whole thing works, BUT:
As you can see in the other topic, controls where added to the rig and thats where I stuck in c4d. I tried to do it with xpresso but couldn't figure out the right connections. Can anyone help me out on this?
Gav Grant kindly supplied a c4d scene which you can download here (OSL Camera setup):
https://goo.gl/c1JCLr
Ahmet: wouldn't it be possible to add a tilt shift lense right into the plugin?
Cheers

Re: OSL Til Shift Lense
Posted: Wed Sep 12, 2018 4:12 pm
by aoktar
KeeWe wrote:
Ahmet: wouldn't it be possible to add a tilt shift lense right into the plugin?
OSL scripts and nodes are for user my friend, not developers. What's tilt shift? What's different from camera's offsetX/Y parameter?
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 12:21 pm
by KeeWe
Sry, i thought it would be a more or less simple thing to implement the OSL code to a integrated preset.
Have you checked the linke thread in the Lightwave forum? The biggest benefit would be to to change the plane of focus.
Maybe you can help us out how to set up a xpresso rig to have similar controls to the example posted in the lightwave thread?

Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 2:36 pm
by bepeg4d
Hi,
please try with the attached scene:
Slightly move and rotate the FocalPoint object to change the focus plane.
Note that I have tested it in c4d R19 and c4doctane v3.08.3 or v4RC2-R1, it doesn't seem to work with R20 yet.
ciao Beppe
p.s. big thanks to baltort for sharing the osl script
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 2:45 pm
by baltort
Hi Beppe,
It looks like you're on the right lines. I presume your spy node lets you peep at a value in the node graph. Can you add spies to each of the vector inputs so we can see what's going on?
Cheers,
James.
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 3:22 pm
by bepeg4d
Hi James,
yes sure, here it is:
ciao Beppe
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 3:34 pm
by baltort
Hi Beppe,
I've had a look in C4D Lite (which I found hidden in my After Effects install). I don't have Octane running in it, but Xpresso seems fully functional...
I would try the following setup:
Put a single null in the scene called focalPoint. Don't parent it to anything, but position it where you want something to be in focus and then rotate it a bit on heading and/or pitch.
Then in the Xpresso editor which exposes your OSL camera, do the following:
1) Add an object reference node which references 'focalPoint'.
2) Expose the Global Matrix socket.
3) Create a Matrix2Vectors node.
4) Connect the Global Matrix output from the object reference to the Matrix2Vectors node.
5) Connect Offset to FocusPoint on the OSL camera.
5) Connect V1 to FocusRight on the OSL camera.
6) Connect V2 to FocusUp on the OSL camera.
This should give you something like:
Keep your FOV nodes as you have them.
That should do it. We might have a flip somewhere (not sure if c4d uses the same coordinate system as LW), but we should be able to sort that if this bit works.
Let me know how you get on.
Cheers,
James.
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 4:05 pm
by bepeg4d
Hi James,
here is the modified version:
Now it seems to work well with position and H rotation, but the P rotation works only between -1 and +1, B rotation has no effect.
ciao Beppe
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 4:21 pm
by baltort
Well done Beppe!
Looking good. Bank shouldn't have any effect because spinning the plane on it's z-axis isn't really changing the plane at all...
Not sure about the pitch limitations. Do bear in mind that this rig lets you push the focal plane much further than you could with a physical tilt lens attached to a real camera. For example, you can rotate the focus plane so that you can see it's edge (although the plane is infinitely big, you can rotate it so you're looking down it very obliquely and see it's 'horizon'). Other factors like the FOV will push in to remove this effect.
Do you have an aperture input on the OSL camera? This should let you control how much blur you get.
Cheers,
James.
Re: OSL Til Shift Lense
Posted: Mon Sep 17, 2018 4:27 pm
by milanm
No time to go in depth but Z is flipped and scale is 100x. You guys will figure out the rest. This worked for the original not the latest, modified one.
This one is very cool James!
Also, for extra weirdness try playing with different aperture values for X and Y.
Cheers
Milan