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

Nested models not supported? #256

Closed
favreau opened this issue May 23, 2018 · 1 comment
Closed

Nested models not supported? #256

favreau opened this issue May 23, 2018 · 1 comment

Comments

@favreau
Copy link

favreau commented May 23, 2018

Hi,
I recently tried to use nested models by using the following API / pseudo-code:

model1 = ospNewModel();
model2 = ospNewModel();
...
instance2 = ospAddInstance(model2, (osp::affine3f&)ospcommon::one);
ospAddGeometry(model1, instance2);
instance1 = ospAddInstance(model1, (osp::affine3f&)ospcommon::one);
ospAddGeometry(rootModel, instance1);
...
ospCommit(rootModel);
The rendering unfortunately fails in the following line of model.ih:
geom->postIntersect(geom,model,dg,ray,flags);
In the model.ih file, the comments make it pretty clear that the feature is not yet supported.

Note that if I do not have more that 1 level of children under the 'root' model, things work fine.

Will nested models be fully supported in the future? In OSPRay 2.0?

Many thanks for you help there.
Cyrille

@favreau favreau changed the title Nested models are not supported Nested models not supported? May 23, 2018
@jeffamstutz
Copy link
Contributor

Hi Cyrille,

You are correct, nested instancing is not support in OSPRay. The API, as it is currently expressed, leads you to believe that nested instancing is supported, but we intend to change that.

We've decided to stick with single-level instancing in OSPRay API itself, though we support multi-level instancing in ospray_sg (our scene graph which continues to mature). After some discussion with the team, multi-level instancing is somewhat at-odds with the spirit of the OSPRay API. OSPRay does not want to get in the business of allowing client applications to query information which the application set (i.e. values of parameters). This is fine when there's a 1:1 mapping of objects/parameters to API calls. However, multi-level instancing would start creating additional objects on behalf of the application, which begs for additional functionality to allow querying of those objects and setting parameters on them.

Thus, we still do deliver that functionality (not withstanding future improvements), but deliver it in a place which makes more sense: a traversable representation of a scene.

In OSPRay v2.0, we will make the API more obvious to the single-level instancing design decision. It won't require too much of a change from the current API, but it will be spelled differently...perhaps by introducing an OSPWorld for the root-level scene.

FWIW, this decoupling also lets us consider potential differences in the roles of the OSPRay API and the scene graph. (ex: instancing lights inside models)

Hope that helps!

Cheers,
Jeff

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

No branches or pull requests

2 participants