test: Add StandardShaderBall test scene and common models directory - #2149
test: Add StandardShaderBall test scene and common models directory#2149jmp-22 wants to merge 4 commits into
Conversation
Add a new testrender-based test scene featuring the ASWF USD Working Group StandardShaderBall asset and scene, rendered using testrender. Scene geometry was converted from USDA format to OBJ format in Blender. The scene uses testrender's support for ShaderGroup/MTL material group name matching to assign shaders to the scene. Lighting is created from scene geometry, with an emission shader applied to planes to mimic the area lights of the USD scene. Camera angle, textures, and lighting have been tweaked to provide a close, but not exact, replica of the USD scene. The new render-shaderball test has been integrated into the testsuite, referencing an image generated at 320x240 px, using setting -aa 4 on the CPU. Signed-off-by: Jonathan Peters <jmp22@sfu.ca>
Add a new directory to store 3D models to be reused amongst tests. Migrated the existing bunny.obj and new shaderball.obj models and updated their respective test scenes to reference the new common/models location. The render-shaderball test's output dimensions were halved to reduce render time. Signed-off-by: Jonathan Peters <jmp22@sfu.ca>
The common/models paths introduced for the bunny and shaderball scenes were written as "data/../common/models/...", which depends on a test's "data" entry being a symlink to its source directory. That holds on Unix, but runtest.py copies the source directory to "data" on Windows, so "data/.." resolves to the test's temporary build directory and the model is never found. Reference the models as "../common/models/..." instead. This also matches how existing tests reference shared assets such as ../common/textures/grid.tx. Signed-off-by: Jonathan Peters <jmp22@sfu.ca>
The StandardShaderBall geometry and textures are licensed under CC BY 4.0, which requires retaining the copyright notice and license reference, and indicating where the material has been modified. Add a README alongside the model recording the upstream authors, the license and its URL, and the changes made in converting the USD scene to OBJ. Add a shorter README alongside the textures noting that they are redistributed unmodified. Embed the same notice as comments at the head of shaderball.obj and shaderball.mtl. Also add the missing copyright and SPDX headers to diffuse_textured.osl and plastic.osl. Assisted-by: Claude Code / Claude Opus 5 Signed-off-by: Jonathan Peters <jmp22@sfu.ca>
|
Hi, just as an aside, your PR description contains this text: I think the use of a Then GitHub would fully understand not just the link, but also that this PR, upon acceptance, should cause automatic closure of the original issue. I think "Fixes #xyzw" also works. But many other phrasings that humans would understand perfectly well, are nonetheless not recognized as being equivalent and will not cause the issue to be closed when this is merged. I think that if you edit the description to say it correctly, it still might establish the link? |
| Note that this is a different license from the BSD-3-Clause license that | ||
| covers OSL's own source code. See the repository's `THIRD-PARTY.md`. |
There was a problem hiding this comment.
The OSL project uses 2 standard licenses: BSD-3-Clause for code, and CC-BY-4.0 for docs and other non-code things. We mention this and link to the CC pages in the main README.md of this project. So you aren't adding any new or different kinds of licenses here, and I think you can just minimally note that the original data the shaderball file is derived from was also CC-BY-4.0 and give a link to the usd-wg repo where it lives.
|
This is great! (And I'm especially happy to see this land clean, well organized, and fully passing CI on the first shot.) I have a feeling that we will use the shaderball for many more tests over time, so I wonder if, just like the shaderball geometry, the shaderball textures should be moved to testsuite/common/textures/shaderball? It seems that the render-shaderball test still contains a lot of .osl files that aren't used by the test. Presumably those were used to generate the examples you posted above in this PR. But probably the final form of this PR should remove the ones that we don't intend to directly use. Really, those two items are about all I can think of suggesting... this is everything I'd hoped for. I do have another question, which may be more revealing of my unfamiliarity with the USD test shaderball than it is about anything you have done: In the first pair of rendered examples above, the testrender image on the left shows polygon faceting of the silhouette -- everywhere, but it's most easily visible in the "corners" of the triangular-ish depression of the outer shaderball surface. (Are there agreed upon names for the different geometric/geographic features of the shader ball?) But in the reference image on the right from Houdini, it has been fully subdivided so that no tessellation artifacts are visible. All the other examples above, which I believe are testrender vs USDView, appear to be about the same level of tessellation as the OSL version. So my questions are:
I think what I'm really getting at is, is this the best tessellation rate that will serve us well for matching MatX and/or USD and testing material behaviors with OSL, versus (obviously) the tradeoff of not wanting a truly ginormous obj file checked into our repo if the increase in quality will never be needed. |
Description
Adds a
render-shaderballtestsuite entry that renders the USD Working Group's StandardShaderBall asset intestrender, and introducestestsuite/common/models/as a home for geometry that more than one test can share.The shader ball is a widely used reference scene for evaluating material response (reflection, transmission, roughness, Fresnel, caustics, subsurface) so having it in the testsuite provides a somewhat realistic comparison against other renderers.
The USD Working Group asset ships as USD with MaterialX shading networks.
testrenderonly reads Wavefront OBJ, so the scene was imported into Blender and re-exported as OBJ + MTL.testrenderalready reads object names and material names out of the.obj/.mtl, which makes it straightforward to rebind the material assignments to OSL shader groups in the scene.xmldescription. All 12 material names map 1:1 onto shader groups inscene.xml.Assisted-by: Claude Code / Claude Opus 5
Used Claude Code to draft the two attribution READMEs and the notices embedded in the OBJ/MTL files.
I verified the licensing facts against the upstream repository and edited the modification statement to correctly describe my changes to the model.
testrendervs USD referenceReference images were rendered in Houdini's Karma renderer unless otherwise noted. Images shown here have been converted from EXR to PNG.
Basic test scene
testrenderShader ball with correct UVs
testrenderShader ball with subsurface geometry
testrenderOther
testrenderoutputsShader ball with various materials
Scene render passes
Added
New test:
testsuite/render-shaderball— 160x120,-aa 8, using the same set of comparison settings asrender-uvandrender-microfacet, withfailthresh=0.01andallowfailures=3.Shared model directory:
testsuite/common/models/.testsuite/commonis already copied into the build tree at configure time bysrc/cmake/testing.cmake, so tests reference models the same way they already reference../common/textures/....render-bunny'sbunny.objmoves here too.Shaders: the ball itself uses a plain grey
glossy(diffuse + GGX dielectric layer), withdiffuse_texturedon the enclosing box walls andemitteron the area-light geometry.matte,emitter,glossyandmetalfollow the existingper-test-directory convention and are unchanged copies of what other
render-*tests already carry.glass.osl,metal.oslandplastic.oslare included but not instantiated inscene.xml. I used these to produce the preview renders above, and chose to include them in therender-shaderballtest directory as a useful starting points for follow-up tests or experimentation. I'm happy to exclude them if reviewers would rather the directory only carry what the test uses.Licensing
I'm not very experienced with asset licensing, so flagging a few things for review. I used Claude Opus 5 to help generate attribution information.
The USD shaderball scene assets is licensed CC BY 4.0, which differs from OSL's BSD-3-Clause. See the USD Working Group's
LICENCEfor the scene.To ensure attribution, I added:
testsuite/common/models/shaderball/README.md: Carries the full attribution to authors (Chris Rydalch, André Mazzone, Thomas Anagnostou), the license and its URL, a link to the upstreamLICENCE, and a description of the modifications made.testsuite/render-shaderball/maps/README.md: Records that the textures are redistributed unmodified.shaderball.objandshaderball.mtl, so attribution travels with the files if they're ever copied out of the repo.CC BY 4.0 imposes no share-alike obligation, so nothing here affects the licensing of OSL's own code. I've left the OSL repo's
THIRD-PARTY.mdalone for now, but I'm happy to add an entry there if maintainers would preferTHIRD-PARTY.mdto list it.The only change to the modeled geometry is the addition of light-emitting planes in place of the upstream USD area lights, which have no OBJ representation and which
testrendercouldn't use anyway. This is all documented in the asset README.Repository Size
The assets add ~7.2 MB: ~6.0 MB of textures, ~1.2 MB of geometry, and a 28 KB reference image. One texture map,
ground.ACEScg.exr, alone is 4.2 MB.The textures are the USD WG files as-published. If this size increase is deemed to be too large for the repo, we could apply compression on the ground texture or remove the three
emitter_*maps anduvgrid.exr(which currently only exist for the previews).Testing
Both tests pass on the CI-OSL reference image aswf/ci-osl:latest:
Note that
render-bunnyneeded re-verifying, since its model moved totestsuite/common/models.Known limitations and follow-ups for review
OPTIXmarker file, so this doesn't currently run under OptiX. I don't have an OPTIX-capable GPU to validate against. Glad to add the marker file if someone with a GPU or CI can confirm it matches, or to leave it as a follow-up. Other platforms may need an alternate reference, asrender-microfacetdoes for Mac ARM.testrenderis difficult to translate exactly from the USD scene. The angle used here is not 100% accurate to the USD camera, but produces a fairly similar image.Checklist:
and if I used AI coding assistants, I have an
Assisted-by: TOOL / MODELline in the pull request description above.
behavior.
PR, by pushing the changes to my fork and seeing that the automated CI
passed there. (Exceptions: If most tests pass and you can't figure out why
the remaining ones fail, it's ok to submit the PR and ask for help. Or if
any failures seem entirely unrelated to your change; sometimes things break
on the GitHub runners.)
fixed any problems reported by the clang-format CI test.