-
Notifications
You must be signed in to change notification settings - Fork 218
Replace SplineDefinition with IECore::Ramp, and Store RampData in Shaders #6717
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
base: main
Are you sure you want to change the base?
Conversation
0c8defb to
2939020
Compare
johnhaddon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Daniel! There's a colossal amount of change here (it pretty much brought my web browser to its knees), but I think it all makes sense. Let's chat about what we want to do with ColorSpline.osl/ColorRamp.osl compatibility in our meeting later today...
| Gaffer.SplineffPlug.__getitem__ = __getitemWrapper( Gaffer.SplineffPlug.__getitem__ ) | ||
| Gaffer.SplinefColor3fPlug.__getitem__ = __getitemWrapper( Gaffer.SplinefColor3fPlug.__getitem__ ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think removing this is OK - out intention has always been to remove compatibility configs after a grace period has elapsed. Looks like its version 0.40.0.0 and earlier that we're breaking from, which seems reasonably far in the past. We'll need to note this in Changes.md.
Once this is merged we should probably also have a quick look through the other compatibility files, and removing anything supporting a version earlier than 0.40.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put up a first pass PR addressing other early compatibility files: #6735
src/IECoreArnold/Renderer.cpp
Outdated
| writeAccessor->second = new ArnoldShader( shader, m_nodeDeleter, m_universe, nameFormat, m_parentNode ); | ||
| // Make sure we don't leave empty entries in the cache | ||
| m_cache.erase( writeAccessor ); | ||
| throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is it that is getting thrown, and where is it ending up? Generally speaking we don't throw from the Renderer API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now fixed the specific issue that was triggering this in Cortex. Does this mean I should discard this commit, since in theory nothing should be throwing exceptions here? ( As discussed, there are in fact still a bunch of ways that expandRamps can throw exceptions, but I guess we're planning on fixing those )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd be inclined to remove it, but I could probably be persuaded either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now removed.
| "Pattern/FloatSpline" : "Pattern/FloatRamp", | ||
| "Pattern/ColorSpline" : "Pattern/ColorRamp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's worth not having this, since we're keeping the old shaders around. It would let us make what would otherwise be breaking changes in the new shaders (like the parameter name change proposed above). I wonder if there are any other changes you'd make if you were rewriting ColorRamp from scratch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our conversation offline, I've currently gone in the other direction - adding an additional compatibility shim for the parameter name change proposed, and adding a test: 7f6b70f
Everything seems to be working fine.
|
Currently working through the details of these comments, mostly pretty straightforward. While looking at your comments about renaming "spline" -> "ramp" in variable names, I did some grepping for "spline" ... there are actually a bunch more places where a rename makes sense ... not going to help if your browser was struggling with the size of this PR before, but it does make sense to address them at the same time. The only things that came up potentially needing discussion:
|
|
I think I've now addressed all comments ... hopefully it doesn't bog your browser down too much, since you were saying this PR was already giving you issues for some reason. If it would help, I can try to pull anything that isn't a simple rename out of the big rename commit - though I'd probably do that after squashing 59f2572 into the big rename. |
b67c436 to
4cbd7e5
Compare
4cbd7e5 to
7b76754
Compare
|
Squashed last round of fixes, added changelog entries, switched dependencies to Cortex-10.7.0.0a1. I should mention one fix that I've squashed that wasn't in the last round of fixes to review: I must not have tested the most recent version of IECoreArnoldTest, because the last round of tests of testOSLShaders were trying to compare the addresses of shaders connected to the duplicated endpoints, and that was failing - I've switched to checking that the properties of the connected shaders are correct, and that seems to be working fine now. This should be good for interactive testing, and as far as I know, basically ready to merge. |
Linear splines in OSL only need 1 extra endpoint. This test had linear splines with 2 extra endpoints, because it started from a Cortex representation that already had an extra endpoint - that's conceptually wrong, IECore::Spline only uses duplicate end points for curve types where it is required for evaluation, not for linear.
Previously, connections to color components in OSL shaders would fail in 3Delight
IECoreScene::ShaderNetworkAlgo::expandSplineParameters was the deprecated way to handle spline parameters. IECoreArnold::ShaderNetworkAlgo is now doing the up to date approach - there is a call to IECoreScene::ShaderNetworkAlgo::convertToOSLConventions in preprocessedNetwork, which will have already converted splines. As far as I can tell, this means that expandSplineParameters was currently not doing anything, and the fact it was still being called was simply an oversight.
baddb88 to
dfe1d95
Compare
|
I've removed the platform23 test. Unfortunately still got two test failures, but they seem unrelated. |
In combination with the recent Cortex PR: ImageEngine/cortex#1499,
this implements the new way of working with shader ramp parameters that we've been discussing.
There are a lot of changes here, but most are quite trivial - it all follows pretty directly from the Cortex changes. A lot of just renaming things, though there are a few places where I was actually able to cut down on code duplication.
The commit sequence is structured so that after the first 5 commits, this will build against the new Cortex, while having made as few changes as possible ( this was handy when checking behaviour changes ).
The piece I'm most skeptical of is "FIX : ColorRamp and FloatRamp : Fix actual default value", which is why I made it a separate commit ... maybe that's getting too tricksy with the compatibility config? The advantage of this approach is that once all production files have been produced with new Gaffer, we could get rid of the compatibility config, and things would be clean, rather than needing to keep around splineUIMetadata.py for eternity.