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

Arnold camera projection #16

Closed
wants to merge 6 commits into from
Closed

Conversation

johnhaddon
Copy link
Owner

No description provided.

This avoids exceptions in ScenePathPlugValueWidget, which may not always be able to find a suitable ScenePlug to show.
We do this by accepting StringData parameters with the path to a node, and then resolving that to a `NODE *` at the very last minute in `ArnoldRenderer::render()`. This is robust to the targeted node being deleted or replaced. In an ideal world, Arnold's `camera_projection` shader would just have a string parameter instead, like its `toon.lights` parameter.

We do the resolution to `NODE *` in our ShaderCache, which means there are currently a couple of caveats :

- Shaders inside procedurals are not supported, because ProceduralRenderer uses its own ShaderCache which is destroyed after expansion. We do want procedurals to share the main caches in future anyway, at which point this would "just work".
- Light shaders are not supported, because they're not stored in the cache because lights need unique ownership. Hopefully this isn't a likely use case. One potential solution might be to have ArnoldLight pull from the ShaderCache, but passing an argument that always uniquefies the hash.
This is just a case of setting the `gaffer.plugType` to "StringPlug" and letting the recently added `NodeParameter` mechanism do the rest in `ArnoldRenderer`.

Also added a nice camera browser using ScenePathPlugValueWidget. I was unsure what to do for this in ArnoldShaderUI, as the "camera" value for "widget" isn't part of the OSL standard. The other option would have been to support three new Gaffer-specific metadata entries for `gaffer.plugValueWidget.type`, `scenePathPlugValueWidget.setNames` and `scenePathPlugValueWidget:setsLabel`. But that seemed quite faffy when we don't have any other use cases for them at present, and "camera" seems like something that could reasonably be supported by other DCCs.
@johnhaddon johnhaddon closed this Dec 6, 2023
@johnhaddon johnhaddon deleted the arnoldCameraProjection branch December 6, 2023 14:39
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.

1 participant