Questions tagged [raytracing]

Ray tracing is a physics-based method for simulating photorealistic 3D scenes. Light rays are drawn from the eye through each pixel of the desired image, and the rays' interactions with the scene determine the displayed pixel color.

Ray tracing is a method (both physically-based and non-physically-based) for simulating photorealistic 3D scenes. Light rays are traced from the eye (or camera) through the geometry of the scene and the rays' interactions with the objects determine the final displayed pixel color.

It is capable, among other visual effects, to simulate light scattering, reflection, dispersion and refraction more realistically than other graphics rendering methods.

More information: http://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29

1049 questions
114
votes
1 answer

Haskell threads heap overflow despite only 22Mb total memory usage?

I am trying to parallelize a ray-tracer. This means I have a very long list of small computations. The vanilla program runs on a specific scene in 67.98 seconds and 13 MB of total memory use and 99.2% productivity. In my first attempt I used the…
Justin Raymond
  • 3,413
  • 2
  • 19
  • 28
60
votes
1 answer

Interior Mapping shader self shadowing

I'm tinkering with Joost van Dongen's Interior mapping shader and I'm trying to implement self-shadowing. Still I couldn't quite figure out what coordinates shadow casting light vectors need to be in. You can see somewhat working demo at here I've…
shaderology
  • 599
  • 3
  • 7
47
votes
1 answer

Why do we use CPUs for ray tracing instead of GPUs?

After doing some research on rasterisation and ray tracing. I have discovered that there is not much information on how CPUs work for ray-tracing available on the internet. I came across and article about Pixar and how they pre-rendered Cars 2 on…
oodle600
  • 619
  • 1
  • 5
  • 8
47
votes
12 answers

Calculating which tiles are lit in a tile-based game ("raytracing")

I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help. The situation is like this: There is a tile-based map (held as a 2D array), containing a single light…
Zarkonnen
  • 22,200
  • 14
  • 65
  • 81
41
votes
6 answers

How to do ray tracing in modern OpenGL?

So I'm at a point that I should begin lighting my flatly colored models. The test application is a test case for the implementation of only latest methods so I realized that ideally it should be implementing ray tracing (since theoretically, it…
j riv
  • 3,593
  • 6
  • 39
  • 54
36
votes
12 answers

When are structs the answer?

I'm doing a raytracer hobby project, and originally I was using structs for my Vector and Ray objects, and I thought a raytracer was the perfect situation to use them: you create millions of them, they don't live longer than a single method, they're…
JulianR
  • 16,213
  • 5
  • 55
  • 85
29
votes
1 answer

List of material properties for a Ray Tracer

I wrote a Ray Tracer for an assignment this past semester and wanted to keep working on it. There were 5 kinds of materials (for objects) in the assignment and we were given their ambient, diffuse, specular, and shininess values. I'm having a hard…
asimes
  • 5,749
  • 5
  • 39
  • 76
25
votes
4 answers

How to do ray plane intersection?

How do I calculate the intersection between a ray and a plane? Code This produces the wrong results. float denom = normal.dot(ray.direction); if (denom > 0) { float t = -((center - ray.origin).dot(normal)) / denom; if (t >= 0) { …
Pontus Magnusson
  • 632
  • 1
  • 10
  • 25
24
votes
9 answers

Improving raytracer performance

I'm writing a comparatively straightforward raytracer/path tracer in D (http://dsource.org/projects/stacy), but even with full optimization it still needs several thousand processor cycles per ray. Is there anything else I can do to speed it up?…
FeepingCreature
  • 3,648
  • 2
  • 26
  • 25
24
votes
4 answers

Elegant/Clean (special case) Straight-line Grid Traversal Algorithm?

I'm dusting off an old project of mine. One of the things it had to do was -- given a Cartesian grid system, and two squares on the grid, find a list of all squares that a line joining the center of those two squares would pass through. The special…
Justin L.
  • 13,510
  • 5
  • 48
  • 83
22
votes
2 answers

How to properly handle refraction in raytracing

I am currently working on a raytracer just for fun and I have trouble with the refraction handling. The code source of the whole raytracer can be found on Github EDIT: The code migrated to Gitlab. Here is an image of the render: The right sphere is…
Telokis
  • 3,399
  • 14
  • 36
22
votes
5 answers

Ray-box Intersection Theory

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…
Myx
  • 1,792
  • 5
  • 23
  • 37
22
votes
2 answers

How do I initialize the t-variables in "A Fast Voxel Traversal Algorithm for Ray Tracing"?

I am trying to implement the algorithm explained on this paper, used to traverse grid cells in order following a straight line, which is useful for ray tracing: http://www.cse.yorku.ca/~amana/research/grid.pdf The paper describes the algorithm as…
kikito
  • 51,734
  • 32
  • 149
  • 189
21
votes
2 answers

Refraction in Raytracing?

I've been working on my raytracer again. I added reflection and multithreading support. Currently I am working on adding refractions, but its only half working. As you can see, there is a center sphere(without specular highlight), a reflecting…
Koto
  • 506
  • 2
  • 4
  • 15
19
votes
1 answer

What is causing the artifacts in my raytracer?

EDIT: I have now solved the problem; you can see my solution in the answers. I'm in the process of writing a realtime raytracer using OpenGL (in a GLSL Compute Shader), and I've run into a slight problem with some of my line-triangle intersections…
Michael Oliver
  • 1,392
  • 8
  • 22
1
2 3
69 70