RendererAlgo::objectSamples : Output single samples for static objects #6655
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've got a task on the task board with a fairly vague description: "Detect static motion in InstancerCapsule.". While doing some initial investigation on this, I was assuming this related the fact that it is possible to trigger Arnold warnings "discarded X duplicate deformation keys". During some quick initial testing, I was unable to find anything specific to InstancerCapsule, but what I did notice is that if I set up an object that does not change with time, but has a hash that does change, then I get that warning ( whether or not is rendered as an InstancerCapsule ).
It seemed like this stuff might be easiest to discuss with some code to look at. I've added two more tests to RendererAlgoTest, one which documents existing behaviour ( outputting a single sample for the range of times if all samples have the same Gaffer hash ), and one that fails with the existing code ( rendering samples which don't have the same Gaffer hash, but are actually identical ).
I've also included a simple possible fix: after checking the Gaffer hashes, also check the Cortex hashes of the objects to see if they're identical - since the Cortex hashes should actually include all data in the object, unlike the Gaffer hashes which just include the parameters contributing to the object's creation.
Possible concerns with this approach:
Anyway, this does appear to fix the issue of getting "duplicate deformation keys" messages from Arnold. Switching to returning a single sample from this method feels a bit dangerous ... except that we're already doing this when the input hashes the same, so any clients of this method must already be able to deal with receiving single samples even if multiple were requested.