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

How to correctly create cylinder geometry using OSP_DISJOINT curve Type? #507

Open miro-cd opened 3 years ago

miro-cd commented 3 years ago

Hi all, I am trying to render a simple cylinder by following the documentation presented in https://www.ospray.org/documentation.html In order to verify if I could render just one cylinder, I started by defining the following parameters for a "curve" geometry: -->"vertex.position_radius" -->"vertex.color" --> "index" --> "type" --> "basis"

For that I modified the tutorial that comes with the OSPray package (ospTutorial.c) which I include in attachment as a .txt file.

The "type" was set to "OSP_DISJOINT" and the basis was set to "OSP_LINEAR" accordingly with the documentation. However, I just cannot render any cylinder as two displaying errors (Embree internal error 3 : invalid vertex buffer format) and (Embree internal error 3 : invalid index buffer format) keep appearing when I run the .exe file. with the --osp:debug option.

At this point I don't understand if I am defining the variables in a wrong way or if there is an issue when the Intel Embree is required by the process. The relevant changes to the original ospTutorial.c file are presented in the images below:

image image ospTutorial.txt

johguenther commented 3 years ago

The type and basis parameters are not strings, but the defined enums, so use

ospSetParam(curve, "type", OSP_UCHAR, OSP_DISJOINT);
ospSetParam(curve, "basis", OSP_UCHAR, OSP_LINEAR);

Here you can find example code how to set-up curves, which is exercised with ospExamples when switching the scene to "curves" and then curveVariant to "cones".

miro-cd commented 3 years ago

Thank you @johguenther for your prompt reply. I tried modifying those lines as you suggested but now after compiling the code, the .exe stops running abruptly and the scene is not even rendered. I am only working with the C version because I had problems with the C++ version.

Is there a simple way to compile and run the example code you mentioned?