OSL Til Shift Lense

Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderators: ChrisHekman, aoktar

User avatar
KeeWe
Licensed Customer
Posts: 295
Joined: Wed Nov 27, 2013 11:32 am

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 :)
6850k // 32 GB // 1080, 1080 Ti, 2080 Ti // Win 10 // C4D 19.068
User avatar
aoktar
Octane Plugin Developer
Posts: 16063
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

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?
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
User avatar
KeeWe
Licensed Customer
Posts: 295
Joined: Wed Nov 27, 2013 11:32 am

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? :)
6850k // 32 GB // 1080, 1080 Ti, 2080 Ti // Win 10 // C4D 19.068
User avatar
bepeg4d
Octane Guru
Posts: 10321
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi,
please try with the attached scene:
TiltCameraOSL.zip
(86.89 KiB) Downloaded 271 times
Capture_08.PNG
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
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

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.
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

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:
c4d tilt lens setup.jpg
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.
User avatar
bepeg4d
Octane Guru
Posts: 10321
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi James,
here is the modified version:
TiltCameraOSL2.zip
(83.36 KiB) Downloaded 292 times
Capture_09.PNG
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
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

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.
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

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
Last edited by milanm on Tue Sep 18, 2018 3:21 pm, edited 1 time in total.
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
Post Reply

Return to “Maxon Cinema 4D”