Closed karjonas closed 5 years ago
How do you add the sphere light (hardcoded in the viewer?)? With unusual position
or radius
? The assertion in Embree hints that invalid rays are generated (for example NaN
s in origin, direction or distance).
Okay. I add this at OSPApp.cpp:654:
auto &sphere = lights.createChild("sphere", "PointLight");
sphere["color"] = vec3f(1.f, 1.f, 1.f);
sphere["position"] = vec3f(10, 10, 10);
sphere["radius"] = 5.f;
sphere["intensity"] = 1.25f;
I encountered the issue from outside of OSPRay to begin with though, but this is the simplest way to reproduce it.
Thanks for the information; I have a fix (will be in the next release):
diff --git a/ospray/lights/PointLight.ispc b/ospray/lights/PointLight.ispc
@@ -62,7 +62,7 @@ Light_SampleRes PointLight_sample(const uniform Light* uniform super,
res.dir = frame(res.dir) * localDir;
res.pdf = uniformSampleConePDF(cosTheta);
const float c = localDir.z;
- res.dist = c*res.dist - sqrt(sqr(self->radius) - (1.f - c*c) * dist2);
+ res.dist = c*res.dist - sqrt_safe(sqr(self->radius) - (1.f - c*c) * dist2);
// TODO scale radiance by actual distance
} else { // inside sphere
const vec3f localDir = cosineSampleHemisphere(s);
Cool, thanks for the fix!
Hi,
It seems like the pathtracer and sphere light does not get along together. If I add a sphere light and load a model using ospExampleViewer and the pathtracer renderer I get the following assertion failure:
I am using OSPRay v1.8.4 and embree v3.5.2.
Best regards, Jonas