RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
1.02k stars 186 forks source link

OSPRay 2.1.1 Sci-Vis renderer OBJ Material type doesn't honor "ks" and "ns" parameters #429

Closed tachyon-john closed 4 years ago

tachyon-john commented 4 years ago

Although the documentation indicates that the OBJ material works with both the SciVis and pathtracer OSPRay renderers, I find that when using the scivis renderer, I get parameter errors for "ks" and "ns", e.g.: OSPMaterial ospMat = ospNewMaterial("scivis", "obj"); ospSetParam(ospMat, "kd", OSP_VEC3F, kdtmp); // works as expected.... ospSetParam(ospMat, "ks", OSP_VEC3F, kstmp); // generates error ospSetParam(ospMat, "d", OSP_FLOAT, &materialcache[matindex].opacity); // works as expected... ospSetParam(ospMat, "ns", OSP_FLOAT, &materialcache[matindex].shininess); // generates error

The error/status messages generated are: ospray::Material: found unused (or of wrong data type) parameter 'ks' ospray::Material: found unused (or of wrong data type) parameter 'ns'

Nothing I see in the documentation for the OBJ material would indicate that these should not work with the scivis renderer: https://www.ospray.org/documentation.html#materials

paulmelis commented 4 years ago

Looks like the actual implementation of the OBJ material indeed differs between scivis and pathtracer:

https://github.com/ospray/ospray/blob/2a97f95e1726fdbf65e75ef4cc7e50d29b2b5425/ospray/render/registration.cpp#L43-L49

And class ScivisMaterial supports only a small number of parameters as you found:

https://github.com/ospray/ospray/blob/2a97f95e1726fdbf65e75ef4cc7e50d29b2b5425/ospray/render/scivis/SciVisMaterial.cpp#L15-L22

johguenther commented 4 years ago

Supported OBJ parameters in SciVis have been cut down when moving to v2.0, but this should be temporary (albeit quite some time already...).

tachyon-john commented 4 years ago

I knew something was wrong since the images I got from OSPRay 2.x didn't have the correct specular look for a given VMD material, but until I got the error output from the status callback, I wasn't sure why.

For now, I'll just view this as a case where the docs disagree with reality in the code. I leave it up to the OSPRay devs to decide if OBJ will remain as-is or not. I just expected it to do what the docs said it would.

I have been planning to separately support both sci-vis and pathtracer modes for OSPRay, but the OBJ material limitations are problematic for VMD, so this will lead me to ahead and reimplement using pathtracer and revisit a sci-vis implementation after OBJ has been made more comparable to what OSPRay 1.x used to support.

johguenther commented 4 years ago

So, with the re-added lighting in SciVis starting with v2.3 the OBJ material parameters ks and ns work again.