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
11
votes
2 answers

Finding the roots of a large number of functions with one variable

I'm working with Python/numpy/scipy to write a small ray tracer. Surfaces are modelled as two-dimensional functions giving a height above a normal plane. I reduced the problem of finding the point of intersection between ray and surface to finding…
mikebravo
  • 113
  • 6
10
votes
1 answer

Raytracer - Computing Eye Rays

I'm writing a ray tracer (mostly for fun) and whilst I've written one in the past, and spent a decent amount of time searching, no tutorials seem to shed light on the way to calculate the eye rays in a perspective projection, without using…
Nick Bedford
  • 4,365
  • 30
  • 36
10
votes
3 answers

Is there a 3D scene format specific or well-suited for raytracing?

I'm working on a raytracer and I don't want reinvent the wheel when it comes to file formats for 3D scenes. I also want to be able to test my program with scenes made by others. I'm a programmer not a 3D modeller. Is there a 3D scene format specific…
Jan Deinhard
  • 19,645
  • 24
  • 81
  • 137
10
votes
5 answers

Wanting to write a raytracer, stuck on what algebra library to use (C++)

I've been wanting to write my own multithreaded realtime raytracer in C++, but I don't want to implement all the vector and matrix logic that comes with it. I figured I'd do some research to find a good library for this, but I haven't had much…
robrene
  • 359
  • 3
  • 14
10
votes
4 answers

Determine if point is inside triangle in 3D

I am looking for acknowledgement on my perception of a method regarding determining whether a point is located inside a triangle or not in 3D. Given a ray in the form R(t) = e + td and a set of three points T = {V0, V1, V2} that forms a triangle in…
10
votes
2 answers

GLSL cube signed distance field implementation explanation?

I've been looking at and trying to understand the following bit of code float sdBox( vec3 p, vec3 b ) { vec3 d = abs(p) - b; return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0)); } I understand that length(d) handles the SDF case…
Fab Castel
  • 552
  • 5
  • 18
10
votes
1 answer

Raytracing in OpenGL via compute shader

I am trying to do some raytracing in OpenGL via the compute shader and I came across a weird problem. At the moment I just want to display a sphere without any shading. My compute shader launches a ray for every pixel and looks like this: #version…
Stan
  • 721
  • 10
  • 24
10
votes
1 answer

Why does raytracer render spheres as ovals?

I've been hacking up a raytracer for the first time over the past few days. However, there are a few quirks which bother me and I don't really know how to work out. One that has been there since the beginning is the shape of spheres in the scene -…
user1845810
  • 123
  • 1
  • 7
9
votes
1 answer

Traversal of Bounding Volume Hierachy in Shaders

I am working on a path tracer using vulkan compute shaders. I implemented a tree representing a bounding volume hierachy. The idea of the BVH is to minimize the amount of objects a ray intersection test needs to be performed on. #1 Naive…
jns
  • 1,250
  • 1
  • 13
  • 29
9
votes
1 answer

How to blend colors

I'm currently coding a raytracer. I wonder how to blend a primitive color with a light color. I've seen many combinations. Some just add the two colors. This gives me very strange results. Some mutiply each components. It looks ok, but in the…
Tangui
  • 3,626
  • 2
  • 26
  • 28
9
votes
1 answer

Ray tracing texture implementation for spheres

I'm trying to implement textures for spheres in my ray tracer. I managed to get something working, but I am unsure about its correctness. Below is the code for getting the texture coordinates. For now, the texture is random and is generated at…
ionutt93
  • 264
  • 2
  • 11
9
votes
2 answers

How to set up quadratic equation for a ray/sphere intersection?

I'm researching the math for a ray tracer, but I'm not following a transition that is made in just about every article I've read on the subject. This is what I have: Formula for a sphere: (X - Cx)^2 + (Y - Cy)^2 + (Z - Cz)^2 - R^2 = 0 Where R is the…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
8
votes
2 answers

Computing shading through a transparent surface

In ray tracing, I want to calculate the shading for a point where my ray hit. I "draw" lines to all light sources and check if they are blocked by objects or not. If they are not blocked then I calculate the intensity of the lighting according to…
SIMEL
  • 8,745
  • 28
  • 84
  • 130
8
votes
1 answer

Reflection and refraction impossible without recursive ray tracing?

I am writing a GPU-based real-time raytracing renderer using a GLSL compute shader. So far, it works really well, but I have stumbled into a seemingly unsolvable problem when it comes to having both reflections and refractions simultaneously. My…
Kelan
  • 355
  • 4
  • 16
8
votes
3 answers

How to best store lines in a kd-tree

I know kd-trees are traditionally used to store points, but I want to store lines instead. Would it be best to split the line at every intersection with the splitting of the kd-tree? or would storing just the end-points into kd-suffice for nearest…
newDelete
  • 385
  • 2
  • 10
1 2
3
69 70