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
Can't find an analytical sphere (using tutorial) #441
Comments
Does your attachGeometry call rtcCommit on the scene? I would just start with a single triangle to get Embree integration working, and then go to more complicated primitives. BTW, there is also direct support for spheres using the RTC_GEOMETRY_TYPE_SPHERE_POINT geometry type. |
Thanks for your reply. Yes it does. Here is its code :
Yes, I found that, but I will need to make cylinders and cones in the future and I believe that they are not supported natively. That's why I chose to learn how to do this with analytical method. |
That code looks correct. The mapScenes is likely an std:map and looking up scenes there will significantly reduce performance. |
This line here "rtcSetGeometryUserData(geom, &sphere);" sets a pointer to a local variable. You have to allocate the sphere object on the heap. |
Oops you're right, I already used an allocation trying to debug (not in the first code I sent though) but forgot to remove the & before sphere. Hence, the pointer was numb. Well, I believe that my question is now answered. Thanks a lot for your help ! Have a good day. |
Hi, I'm back again :) These two functions together work well with triangular shapes (tested with cubes and triangles) but doesn't seem to work with my analytical sphere. What should be added/modified to these functions in order to gather all hits ? (whether they are from analytical or tessellated primitives, I don't care, I only want to be able to sort them later by geomID). Filter :
Function that gathers hits :
Thanks again ! |
Make sure the ray.tfar is keeping old value, thus this line should get executed in sphere intersector: rayhit->ray.tfar = old_t; |
Yes it is, at the end of the ifs (that check which solution should be kept between t0 and t1), we put back old_t if the test with mask fails. I have absolutely no idea how to pursue to make the "multi-hit gathering" with an alaytical sphere. Thanks again for your help. Here is the last version of my code :
And I have a question : Thanks in advance. |
Is the gather_all_hits callback invoked at all? The rtcInvokeIntersectFilterFromGeometry call just invokes the filter function assigned to the geometry, not the one in the context. The context callback has to get invoked manually for user defined geometries, thus instead of rtcInvokeIntersectFilterFromGeometry inoke your gather_all_hits directly (either by just calling that function directly or by also adding the RTCIntersectArguments to your RayQueryContext and invoking it through the function pointer). |
Thanks a lot for your help, I guess that it's all working now |
(I'm french so I apologize in advance if I make any english mistake)
Hello everyone,
I am having trouble creating a User Geometry in Embree 4. I need to create a set of them (sphere, cylinder...) but let's focus on the sphere for now.
For some reason I cannot find an intersection with the sphere I created. I basically copy pasted this tutorial (just modified a few things so that it works in my setup).
I know the code is quite long and I am sorry about it.
I tried the code above using this setup :
And embree doesn't update the tfar component (hence no intersection).
Please let me know if you find any mistake in that code.
Thanks in advance.
Adrian
The text was updated successfully, but these errors were encountered: