raytracing

Ray Generation Inconsistency

I have written code that generates a ray from the "eye" of the camera to the viewing plane some distance away from the camera's eye: R3Ray ConstructRayThroughPixel(...) { R3Point p; double increments_x = (lr.X() - ul.X())/(double)width; double increments_y = (ul.Y() - lr.Y())/(double)height; p.SetX( ul.X() + ((double)i_pos+0.5)...

OpenGL render vs. own Phong Illumination Implementation

Hello: I have implemented a Phong Illumination Scheme using a camera that's centered at (0,0,0) and looking directly at the sphere primitive. The following are the relevant contents of the scene file that is used to view the scene using OpenGL as well as to render the scene using my own implementation: ambient 0 1 0 dir_light 1 1 1 ...

3D coordinate of 2D point given camera and view plane

I wish to generate rays from the camera through the viewing plane. In order to do this, I need my camera position ("eye"), the up, right, and towards vectors (where towards is the vector from the camera in the direction of the object that the camera is looking at) and P, the point on the viewing plane. Once I have these, the ray that's g...

c++ recursion error

Hello: I have the following recursive code and it doesn't behave as expected (see details below): R3Intersection ComputeIntersectionNode(R3Ray *ray, R3Node *node) { R3Intersection closest_inter; R3Intersection child_inter; R3Intersection shape_inter; double least_t = DBL_MAX; // check for intersection with shape if(node->...

Ray-Box Intersection during Scene traversal with matrix transforms

Hello: There are a few ways that I'm testing my ray-box intersections: Using the ComputeIntersectionBox(...) method, that takes a ray and a box as arguments and computes the closest intersection of the ray and the box. This method works by forming a plane with each of the faces of the box and finding an intersection with each of the p...

solve a classic map-reduce problem with opencl?

I am trying to parallel a classic map-reduce problem (which can parallel well with MPI) with OpenCL, namely, the AMD implementation. But the result bothers me. Let me brief about the problem first. There are two type of data that flow into the system: the feature set (30 parameters for each) and the sample set (9000+ dimensions for each...

Ray-box Intersection Theory

Hello: I wish to determine the intersection point between a ray and a box. The box is defined by its min 3D coordinate and max 3D coordinate and the ray is defined by its origin and the direction to which it points. Currently, I am forming a plane for each face of the box and I'm intersecting the ray with the plane. If the ray intersec...

point light illumination using Phong model

Hello: I wish to render a scene that contains one box and a point light source using the Phong illumination scheme. The following are the relevant code snippets for my calculation: R3Rgb Phong(R3Scene *scene, R3Ray *ray, R3Intersection *intersection) { R3Rgb radiance; if(intersection->hit == 0) { radiance = scene->background;...

Soft Shadows in Raytracing 3D to 2D

Hello: I wish to implement soft shadows produced by area lights in my raytracer. I'm having trouble generating the random samples. So I have a scene in which I have an area light (represented as a circle) whose world (x,y,z) coordinates of the center are given, the radius is given, the normal of the plane on which the circle lies is giv...

Determine if 3D point is inside 2D Circle

Hello: I wish to determine if a Point P(x,y,z) is inside a 2D circle in 3D space defined by its center C (cx, cy, cz), radius R, and normal to the plane the circle lies on N. I know that a point P lying on a 2D circle in 3D space is defined by: P = R*cos(t)*U + R*sin(t)*( N x U ) + C where U is a unit vector from the center of the ci...

".OFF" descriptions

I'd like to make a scene that uses meshes and primitives (such as spheres, cylinders, boxes, etc). I was wondering if there are any recommendations with regard to where I can go to find .off files that describes complex meshes, such as mountains, rocks, trees, animals, etc. ...

Why do my raytraced spheres have dark lines when lit with multiple light sources?

I have a simple raytracer that only works back up to the first intersection. The scene looks OK with two different light sources, but when both lights are in the scene, there are dark shadows where the lit area from one ends, even if in the middle of a lit area from the other light source (particularly noticeable on the green ball). Th...

Raytracing (LoS) on 3D hex-like tile maps

Greetings, I'm working on a game project that uses a 3D variant of hexagonal tile maps. Tiles are actually cubes, not hexes, but are laid out just like hexes (because a square can be turned to a cube to extrapolate from 2D to 3D, but there is no 3D version of a hex). Rather than a verbose description, here goes an example of a 4x4x4 map...

Matlab - Propagate points orthogonally on to the edge of shape boundaries

Hi I have a set of points which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points. ...

How do I integrate a BSDF into a ray caster.

I'm trying to implement sub surface scattering at isosurfaces and looked up how a BSDF works mathematically. Implementing the reflective and diffuse part seems to be quite easy as i just have to evaluate phong at the isosurface intersection, but how do you I apply the transmissive part of the BSDF? In what way do i have to modify the r...

Pointers to Derived Class Objects Losing vfptr

To begin, I am trying to write a run-of-the-mill, simple Ray Tracer. In my Ray Tracer, I have multiple types of geometries in the world, all derived from a base class called "SceneObject". I've included the header for it here. /** Interface for all objects that will appear in a scene */ class SceneObject { public: mat4 M, M_inv; Col...

What are some of the better open source raytracers?

I'm just wondering what options are out there as far as open source ray tracing software. eg. Yafaray, POV-Ray, what else? Any opinions on their relative merits would also be appreciated. ...

Raytracing Meta-Balls without Raymarching

In all examples online that I have seen, when rendering meta-balls (level sets of a potential function), the point of ray-meta-ball intersection is always found by raymarching. Are there any alternatives to this for determining the point explicitly? ...

Noise with multi-threaded raytracer

This is my first multi-threaded implementation, so it's probably a beginners mistake. The threads handle the rendering of every second row of pixels (so all rendering is handled within each thread). The problem persists if the threads render the upper and lower parts of the screen respectively. Both threads read from the same variables,...

Determining if and where a photon will collide with a polygon in 3D space.

The problem is straight forward: 1) We have a photon traveling from Point 1 (x,y,z) to Point 2 (x,y,z), both of which could be located anywhere in 3D space. 2) We have a polygon that is both rotated randomly on the x-axis and/or y-axis and also located anywhere in 3D space. 3) We want to find: a) if the photon will collide with the p...