DoF follows Target.

Forums: DoF follows Target.
A public forum for discussing and asking questions about the Octane for Unity Alpha

Moderator: ChrisHekman

DoF follows Target.

Postby Wolfnimations » Wed May 29, 2019 1:12 pm

Wolfnimations Wed May 29, 2019 1:12 pm
I am trying to make a camera follow a target while the depth of field adjusts to the target.
I found out that I am not able to keyframe the depth of field property (or any property) from the PBR render target object in a Unity timeline.

Is there any way i can get this to work?
Or any pointers to a script where i can set a unity object to adjust the focal depth on the PBR render target settings based on the distance of the camera to the object?
Wolfnimations
 
Posts: 8
Joined: Fri Feb 22, 2019 11:39 am

Re: DoF follows Target.

Postby ChrisHekman » Wed Jun 05, 2019 11:55 am

ChrisHekman Wed Jun 05, 2019 11:55 am
Yes, you will need to make a scrip.

The PBRRenderTargetComponent has a member called RenderTarget.
That class has member called Camera.

Quick dirty code:
Code: Select all
RTComp = GetComponent<PBRRenderTargetComponent>();
if(RTComp.RenderTarget)
    RTComp.RenderTarget.Camera.SetPinFloat(Octane.P_FOCAL_DEPTH, depth);
ChrisHekman
OctaneRender Team
OctaneRender Team
 
Posts: 968
Joined: Wed Jan 18, 2017 3:09 pm

Re: DoF follows Target.

Postby Wolfnimations » Wed Jun 05, 2019 12:17 pm

Wolfnimations Wed Jun 05, 2019 12:17 pm
ChrisHekman wrote:
Quick dirty code:
Code: Select all
RTComp = GetComponent<PBRRenderTargetComponent>();
if(RTComp.RenderTarget)
    RTComp.RenderTarget.Camera.SetPinFloat(Octane.P_FOCAL_DEPTH, depth);


Thank you for the reply. I'll pass this on to some people that i work with that know more about coding.

For any other people that also have the same question I found another workaround that might work.
-You can create a plane, parent it to the camera and give it a completely transparent material with a refraction of 1. And move that plane further and closer to the camera with autofocus enabled. This will work in a decent amount of cases, except when a different object moves in front of the middle of the screen.
Wolfnimations
 
Posts: 8
Joined: Fri Feb 22, 2019 11:39 am

Return to Octane for Unity


Who is online

Users browsing this forum: No registered users and 6 guests

Thu Mar 28, 2024 8:47 pm [ UTC ]