How can I set PBR Unity Light Component properties by script

Forums: How can I set PBR Unity Light Component properties by script
A public forum for discussing and asking questions about the Octane for Unity Alpha

Moderator: ChrisHekman

How can I set PBR Unity Light Component properties by script

Postby neitron » Fri Jul 19, 2019 4:02 pm

neitron Fri Jul 19, 2019 4:02 pm
Hi!
I want to set a few properties for Octane Light via PBR Unity Light Component by c# script, just before rendering the final image by Octane renderer.
The options:

// Octane light options available via the editor
Blackbody type
Power for the light
Temperature for the light
IES file for light distribution

// IES options are able to set from Octane but not by the PBR component in the editor. Please provide it through unity component
The 'Gama' for the IES file node
The 'Power' For the IES file node
The 'Projection' for the IES file node

In future, I wish to edit other options as well.
Is there any way to set it without reflection?
Last edited by neitron on Fri Jul 19, 2019 9:14 pm, edited 1 time in total.
neitron
 
Posts: 3
Joined: Fri Jul 19, 2019 3:42 pm

Re: Whow can I set PBR Unity Light Component properties by scrip

Postby jakemetz » Fri Jul 19, 2019 9:13 pm

jakemetz Fri Jul 19, 2019 9:13 pm
+1 to this. The ability to use IES files from the Unity Editor to Octane would be a great boost to our pipeline!
jakemetz
 
Posts: 4
Joined: Tue Oct 16, 2018 10:49 pm

Re: How can I set PBR Unity Light Component properties by script

Postby ChrisHekman » Tue Jul 23, 2019 3:52 pm

ChrisHekman Tue Jul 23, 2019 3:52 pm
We have made PBR Unity Light Components public in the upcomming build. Which will allow you to access Octane.UnityLight and and OctaneUnity.PBRUnityLightComponent.
You should be able to retrieve the emissive node and the ies light node from C#.
ChrisHekman
OctaneRender Team
OctaneRender Team
 
Posts: 968
Joined: Wed Jan 18, 2017 3:09 pm

Re: How can I set PBR Unity Light Component properties by script

Postby neitron » Wed Jul 24, 2019 10:25 am

neitron Wed Jul 24, 2019 10:25 am
Thank you very much for that!
But how about the projection node?
Could you please provide some examples of how to retrieve exact nodes?
Or maybe there is one tiny example that shows how to edit at least one property of unity light (temperature for example).
neitron
 
Posts: 3
Joined: Fri Jul 19, 2019 3:42 pm

Re: How can I set PBR Unity Light Component properties by script

Postby jakemetz » Wed Jul 24, 2019 7:55 pm

jakemetz Wed Jul 24, 2019 7:55 pm
That's great news! Thanks for including that Chris. Much appreciated.

Out of curiosity (so that we can plan), do you have an estimate for when the upcoming build might be released?
jakemetz
 
Posts: 4
Joined: Tue Oct 16, 2018 10:49 pm

Re: How can I set PBR Unity Light Component properties by script

Postby neitron » Fri Jul 26, 2019 4:05 pm

neitron Fri Jul 26, 2019 4:05 pm
neitron wrote:Thank you very much for that!
But how about the projection node?
Could you please provide some examples of how to retrieve exact nodes?
Or maybe there is one tiny example that shows how to edit at least one property of unity light (temperature for example).


Please unswerv to this one
neitron
 
Posts: 3
Joined: Fri Jul 19, 2019 3:42 pm

Re: How can I set PBR Unity Light Component properties by script

Postby ChrisHekman » Tue Jul 30, 2019 3:35 pm

ChrisHekman Tue Jul 30, 2019 3:35 pm
neitron wrote:
neitron wrote:Thank you very much for that!
But how about the projection node?
Could you please provide some examples of how to retrieve exact nodes?
Or maybe there is one tiny example that shows how to edit at least one property of unity light (temperature for example).


Please unswerv to this one


In the upcomming build you should be able to do something like this:

Code: Select all
Gameobject targetgameobject; //Your game object
var pbrLight =  targetgameobject.GetComponent<PBRUnityLightComponent>();
Octane.UnityLight OctaneLight = pbrLight.OctaneLight;
Octane.Node MaterialNode = OctaneLight.GetMaterial();
Octane.Node EmissionNode = MaterialNode.GetConnectedNode(Octane.P_EMISSION);
EmissionNode.SetPinFloat(Octane.P_POWER, 400);
ChrisHekman
OctaneRender Team
OctaneRender Team
 
Posts: 968
Joined: Wed Jan 18, 2017 3:09 pm

Re: How can I set PBR Unity Light Component properties by script

Postby mathaig » Wed Jul 31, 2019 6:52 am

mathaig Wed Jul 31, 2019 6:52 am
Hello, could we have an approximate date for the upcoming release ?
mathaig
 
Posts: 21
Joined: Fri Jun 14, 2019 11:06 am

Return to Octane for Unity


Who is online

Users browsing this forum: No registered users and 6 guests

Thu Mar 28, 2024 10:02 am [ UTC ]