I haven't read PBRT yet or looked at its source code in detail, but I don't entirely believe your premise that It would make sense for the RGB values to reside between a 0-1 range. In reality, the light intensity at any point can be pretty much arbitrarily large; the...

c++,graphics,3d,geometry,raytracing

With your data, I managed to get consistent results by having the ray direction normalized (this is the only apparent change in the code). Here is the code implementation (I used the paper as reference, and it's not very optimized) : struct quickVect { float x,y,z; float l; }; #define...

This looks pretty familiar, and is called "surface acne". A common error with ray-tracing shadows is that the shadow ray intersects the object the shadow ray is emanating from. Because of finite floating-point precision, the intersection point isn't always exactly on a surface - it ends up being slightly above...

What you need in the end is a pair of vectors that forms an orthonormal basis for the image plane. One of those is going to point to the right relative to the orientation of the camera. The other is going to point up relative to the orientation of the...

math,numerical-methods,raytracing,numerical,embree

I think a lot of the problem is using single precision float rather than double precision. Define two functions double dsqr(double x) { return x*x; } double ddot(const Vec3fa &a,Vec3fa &b) { double x1 = a.x, y1 = a.y, z1 = a.z; double x2 = b.x, y2 = b.y, z2...

First, thanks a lot for all your help. Second, I'm here to announce that after some trouble and after a period in which I didn't touch the code, I finally got it. I haven't understood what I was doing wrong, maybe the algorithm to get a random direction within a...

When I run that code with your "ray with origin (0,0,0) and direction (5,0,1).unit" example, it returns 3.15979 for me. From what I can tell all the code you posted is correct. I imagine it's one of your other implementations that's causing the failure. It could be your unit vector...

java,floating-point,raytracing

There is pretty much no difference between float and double when it comes to speed of calculation, as far as desktop processors are the platform. The difference can only come from the increased memory bandwidth requirements because doubles require twice as much space. Its different for GPU based calculations, those...

javascript,arrays,json,three.js,raytracing

Actualy this is not about Three.js, problem in logic, simple example: (function request(){ $.ajax({ url: "your path", data: "your data", timeout: "max respones time from the server in milliseconds" }) .done(function(response){ //do something with response request(); //call request function again }); })(); you can create simple counter to control how...

So, I solve it. I make code cleaner and problem is gone. private IEnumerable<Vector2> GetCrossedCells(Vector2 pPoint1, Vector2 pPoint2) { if (pPoint1 != pPoint2) { Vector2 V = (pPoint2 - pPoint1) / CELL_SIZE; // direction & distance vector Vector2 U = Vector2.Normalize(V); // direction unit vector Vector2 S = new Vector2(Math.Sign(U.X),...

java,loops,distance,rgb,raytracing

It looks like you're having difficulties with scope. If you declare variables inside a block, like you do in the case of if (something) { double x = ...; }, the variables are visible only inside the declared block. If you later want to access these variables, you have to...

mesh,autocad,raytracing,triangulation

You can collect the details of geometry by creating your own implementation of WorlDraw and ViewportDraw with the AutoCAD .NET API: http://adndevblog.typepad.com/autocad/2012/07/get-entity-geometry-using-custom-worlddraw-and-viewportdraw.html

I've never seen a graphics rendering software package that used anything other than Geometrical Optics for scene illumination, and I guess it's mainly because you don't visually witness many of the wave effects most of the time so GO is good enough. Some renderers use at least Physical Optics at...

javascript,canvas,trigonometry,raytracing,radians

First thing to do is to clarify your code. 1) you don't need to fill the array in reverse order. 2) use atan2 - i didn't get your way of dealing with radians... 3) cache the array element that you will re-use. 4) do not create one sort function on...

c++,opengl,cuda,opencl,raytracing

A common simple rendering approach in OpenGL that is one level of complexity above glDrawPixels is to draw pixels to a texture, apply the texture to a quad and render from the quad. This presentation will walk you through the steps, and as a bonus will show you how to...

c++,graphics,shader,raytracing

This line looks wrong: r = 2*nl*(n-l); 2*nl is a scalar, so this is in the direction of n - l, which is clearly the wrong direction (you also normalize the result, so multiplying by 2*nl does nothing). Consider when n and l point in the same direction. The result...

graphics,shader,probability,raytracing,clamp

I was having the same question you did. If you read http://blog.selfshadow.com/publications/s2012-shading-course/hoffman/s2012_pbs_physics_math_notes.pdf and http://blog.selfshadow.com/publications/s2012-shading-course/hoffman/s2012_pbs_physics_math_notebook.pdf You'll notice it's perfectly normal. To quote from the links: "The Beckmann Αb parameter is equal to the RMS (root mean square) microfacet slope. Therefore its valid range is from 0 (non-inclusive –0 corresponds to a...

I think I have discovered a satisfactory solution! Knowing the exit point, the exit plane is the one with the smallest distance to the exit point. It's as precise as the ray-AABB intersection algorithm and (being an AABB) it only requires a few subtractions, which makes it pretty fast. I...