Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GafferUSD : Added Cycles-specific light parameters to USD Lux lights #6249

Open
wants to merge 1 commit into
base: 1.5_maintenance
Choose a base branch
from

Conversation

boberfly
Copy link
Collaborator

Generally describe what this PR will do, and why it is needed

  • Adds Cycles-specific schema to the USD Lux lights
  • Had this one around for awhile but forgot to make it an official PR

Related issues

  • N/A

Dependencies

  • N/A

Breaking changes

  • N/A

Checklist

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have tested my change(s) in the test suite, and added new test cases where necessary.
  • My code follows the Gaffer project's prevailing coding style and conventions.

Copy link
Member

@johnhaddon johnhaddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alex - would be great to get this merged. I've noted a couple of issues inline, and it would also be great to get the new parameters registered in the LightEditor's USD section, in the same way the Arnold ones are.

When we introduced the Arnold parameters, we were a bit concerned about what the UI would look like when we added other renderers. And I'm about to add RenderMan too. So I think we'll need to do a bit of head-scratching about how to filter them for what the user most cares about. That can be done separately from this PR though.


bool inputs:cycles:use_mis = true (
displayGroup = "Refine"
displayName = "Multiple Importance (Cycles)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and several other labels are too wide for the NodeEditor in Gaffer. Could we shorten them to fit while keeping them intelligible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, maybe a little vague but it isn't too much different to Arnold now.

Comment on lines 44 to 47
bool inputs:cycles:use_camera = true (
displayGroup = "Refine"
displayName = "Visible to Camera (Cycles)"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with a RectLight in Gaffer's viewer, and it didn't seem to have any effect? Is there some plumbing we need in the Cycles backend to pass the values through?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh silly me I forgot the important part in ShaderNetworkAlgo that takes away the namespace prefix, fixed and should work now.

@boberfly boberfly force-pushed the features/cyclesUSDLightSchema branch from 19f264d to bda649a Compare February 11, 2025 01:35
@boberfly
Copy link
Collaborator Author

Thanks Alex - would be great to get this merged. I've noted a couple of issues inline, and it would also be great to get the new parameters registered in the LightEditor's USD section, in the same way the Arnold ones are.

When we introduced the Arnold parameters, we were a bit concerned about what the UI would look like when we added other renderers. And I'm about to add RenderMan too. So I think we'll need to do a bit of head-scratching about how to filter them for what the user most cares about. That can be done separately from this PR though.

Oh yeah I found that and added into this PR, I shuffled the USD Lux lights metadata to the top of the file also, as it looks like the metadata gets modified after for Arnold but Cycles was above the USD Lux declarations.

Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alex! A few comments inline, mostly nitpicks about the schema.

"use_mis", "use_camera", "use_diffuse", "use_glossy", "use_transmission", "use_scatter", "use_caustics",
"spread", "map_resolution", "max_bounces"
] ) :
Gaffer.Metadata.registerValue( GafferUSD.USDLight, f"parameters.cycles:{parameter}", "layout:index", 2000 + i )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be worth respecting GAFFERCYCLES_HIDE_UI and hiding these plugs if the user has decided to opt out of Cycles in the UI. I think we could do this with a visibility activator doing the usual Cycles environment variable checks along the lines of:

Gaffer.Metadata.registerValue( GafferUSD.USDLight, "parameters", "layout:activator:cyclesUIEnabled", lambda x : os.environ.get( "CYCLES_ROOT" ) and os.environ.get( "GAFFERCYCLES_HIDE_UI", "" ) != "1" )
Gaffer.Metadata.registerValue( GafferUSD.USDLight, "parameters.cycles:*", "layout:visibilityActivator", "cyclesUIEnabled" )

)
{

float inputs:cycles:spread = 1.0 (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't matching the default spread value on a Cycles light, is that intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch I forgot we went to degrees on this one.


float inputs:cycles:spread = 1.0 (
displayGroup = "Geometry"
displayName = "Spread"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Spread (Cycles).

)
{

float inputs:cycles:spread = 1.0 (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the above, this also isn't matching the Cycles default.

)
{

int inputs:cycles:map_resolution = 0 (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also isn't matching the Cycles default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking the original source code and it has it set to 0 for automatic, I didn't realise it is set to 1024 on the Gaffer-end - best to not deviate away, and the user can always opt for 0.

Now that I think about it, I think John must've set this for speeding up the viewport from what I remember, so that Cycles doesn't generate ungodly-sized resolutions and slow the viewport up.

{

int inputs:cycles:map_resolution = 0 (
displayGroup = "Refine"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Arnold, we've put this in "Sampling". Might be worth keeping them together?

@boberfly boberfly force-pushed the features/cyclesUSDLightSchema branch from bda649a to 1b4ea61 Compare February 15, 2025 02:15
@boberfly boberfly force-pushed the features/cyclesUSDLightSchema branch from 1b4ea61 to 3d5916c Compare February 15, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants