Closed JimCR-Lin closed 4 years ago
Hi,
using the 4th component of a vec3fa
for the radius does not work yet for "streamlines
" (it works for "spheres
", and we are currently working on making this more general). The radius is taken from the radius
array (a std::vector<float>
in your code snippet?).
If this clarification did not address your issue, can you please say what you expect, and maybe add a screenshot of the artifacts?
Best regards, Johannes
johannes, he is setting vertex.radius array explicitly. I tried to replicate his code but with different vertex positions (didn't want to figure out a correct camera). I will try it again with his vertex positions, though I'm not sure why that should matter. Possibly it would affect an epsilon.
I put your code snippet in as best as I could figure out into our existing testing suite in tests/sources/ospray_test_geomoetry.cpp under ::getStreamlines(). It seems to run fine, what is the exact issue you are running into with this?
float vertex[] = {
2.0f, -1.0f, 3.0f, 0.0f, 0.4f, 0.5f, 8.0f, -2.0f, 0.0f, 1.0f, 3.0f, 0.0f};
float color[] = {
0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f};
int index[] = {0, 1};
float radii[] = {.1f, .3f, .5f};
int nvert = 2;
OSPGeometry mLine = ospNewGeometry("streamlines");
OSPData ldata = ospNewData(nvert, OSP_FLOAT3A, vertex);
ospCommit(ldata);
ospSetData(mLine, "vertex", ldata);
ospRelease(ldata);
ldata = ospNewData(nvert, OSP_FLOAT, radii);
ospCommit(ldata);
ospSetData(mLine, "vertex.radius", ldata);
ospRelease(ldata);
ldata = ospNewData(2, OSP_FLOAT4, color);
ospCommit(ldata);
ospSetData(mLine, "vertex.color", ldata);
ospRelease(ldata);
ospSet1f(mLine, "radius", 0.5f);
ldata = ospNewData(2, OSP_INT, index);
EXPECT_TRUE(ldata);
ospCommit(ldata);
ospSetData(mLine, "index", ldata);
ospRelease(ldata);
ospCommit(mLine);
return mLine;
this code returns the following image. Note that I did not use your exact vertex positions because I’m not sure what camera setup you were using, and I did not want to throw that into the mix.
Rendering like a ghost tube.
I guess, it is related to the big negative "Y". Please use the vertices I put in this issue.
I see thanks Jim. To be clear, does this still show up without the volume?
Yes. I isolated problem to just use that 2 vertices streamline without anything else. Noticed that the radius was the same for these 2 vertices.
Hi, in OSPRay v2 we considerably changed the implementation of streamlines (now "curve"). I cannot reproduce the issue, below a rendering with the faulty vertices from you ([37407.6 -151282 0; 37340.5 -151306 17656.4] radius 821.25):
So, please reopen if the problem still exists.
This issue is related to particular vertices. Y is negative number.
I narrow down to 2 vertex (x, y, z, radius):
[37407.6 -151282 0 821.25 ; 37340.5 -151306 17656.4 821.25]
Here are my codes to produce problem (no fixture):Hopefully, you can reproduce this bug.