-
Notifications
You must be signed in to change notification settings - Fork 8
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
Per-instance materials #101
Comments
The short answer is that alternate methods of associating materials with geometries isn't inherently blocked by ANARI's API design -- OSPRay certainly can implement any additional material assignment possibilities it wants. I am about to argue against the need for override-based approaches for material/geometry association, but that is purely from the perspective of it being a core extension that other vendors are expected to implement. I am skeptical for it to be necessary to do instance based overrides in general, including materials, because the original reason that was invented for OSPRay was to deal with a problem that ANARI does not have: renderer-specific materials. For years OSPRay required that materials must be compatible with the renderer that is currently in-use: the ANARI doesn't have this limitation in that all materials are supposed to be compatible with all renderers (though shading choices may differ, of course). If you want to change an object's material, you swap it out on the surface you want to modify. Philosophically, we have very much held to doing things only one way when this has come up in various other places (instancing, volumes/fields, lights, etc.) -- so the way ANARI would solve having a single geometry use different materials is for the geometry to be shared between different surfaces each in their different groups/instances. This avoids creating "implicit surface objects" by ensuring that the lifetime of |
Thank you for your exhaustive answer. I fully agree with the majority of opinions expressed in it. The only one I have mixed feelings is this statement: "so the way ANARI would solve having a single geometry use different materials is for the geometry to be shared between different surfaces each in their different groups/instances" For raytracing engines like OSPRay the most intuitive place to keep object local BVH is That is why I initially thought about the new |
That's a fair point and enough of an argument to keep the idea moving forward. There's a related issue in the wild with an existing ANARI backend implementing per-primitive materials as well (Cycles in the context of Blender). Proceeding with any material list extensions should make sure that these two ways of indexing into a material list (primID, geomID, instID, explicit parameter indexing, other schemes...) are designed together so that they are cohesive and don't make subtle differences in design choices. After the v1.0 release, I think this would make a fine topic to put on the list for v1.1. Thanks! |
A couple of comments:
|
I have faced a problem in OSPRay and just would like to make sure it is not an issue for ANARI. Let’s assume we want to create a scene with two objects that share geometry but have different position and material (e.g. wooden teapot and gold teapot). We want to use a single geometry and thus construct a single BVH. This means we will have a single
anari::Group
object. In the current 1.0 ANARI version there is no way we can specify per-instance material. Will it be solved by defining another instance sub-type e.g.KHR_INSTANCE_TRANSFORM_AND_MATERIAL
which would additionally contain index into some material array? But then, where to store this material array, inanari::Surface
?The text was updated successfully, but these errors were encountered: