Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research Ray Tracing #127

Open
acs opened this issue Jul 27, 2020 · 11 comments
Open

Research Ray Tracing #127

acs opened this issue Jul 27, 2020 · 11 comments
Labels
research Research a Topic

Comments

@acs
Copy link
Contributor

acs commented Jul 27, 2020

OpenGL is for rastering, so, what about ray tracing? AMD implement it using shaders (GLSL?)

For voxels, ray tracing is the way to go to render with solid internals reflected?

https://github.com/dannyfritz/awesome-ray-tracing

APIs: https://github.com/dannyfritz/awesome-ray-tracing#apis

http://www.realtimerendering.com/ Several books about Ray Tracing. I will take a look to find the most interesting one for leaning.

Hardware implementing it:

@acs acs added this to To do in McThings v0.60.0 via automation Jul 27, 2020
@acs acs added the research Research a Topic label Jul 27, 2020
@acs
Copy link
Contributor Author

acs commented Jul 28, 2020

http://raytracey.blogspot.com/2008/08/voxel-ray-tracing-vs-polygon-ray.html (2008): Voxels and ray tracing vs polys

@javiercuervo javiercuervo pinned this issue Jul 28, 2020
@acs
Copy link
Contributor Author

acs commented Jul 28, 2020

http://www.realtimerendering.com/raytracinggems/ Advanced Ray Tracing, but with introductory chapters, slides, videos ... and pretty recent, from 2019. Let's take a look. https://developer.nvidia.com/video/GDC-19/RAYTRACINGGEMS Too much advanced yet I have read now all slides and I can understand now a good portion of the contents. Advancing!

@acs
Copy link
Contributor Author

acs commented Jul 28, 2020

I would love to follow this one, but I need to recover my C++ skills and I need a full weekend: https://github.com/RayTracing/raytracing.github.io Right now, I want to understand the key elements in Ray Tracing.

@acs
Copy link
Contributor Author

acs commented Jul 28, 2020

Let's try this one: http://www.realtimerendering.com/raytracing/An-Introduction-to-Ray-Tracing-The-Morgan-Kaufmann-Series-in-Computer-Graphics-.pdf

It is the original one from 1989. But it has been updated in 2019 to the 1.3 version. And it is CC-by.

«This book is a revised and edited version of reference material prepared for an intensive one-day course on ray tracing» So probably it is whay I am looking for now!

I am reading this book and at least, the introduction chapter, it is what I was searching for.

@acs
Copy link
Contributor Author

acs commented Jul 29, 2020

A python ray tracer engine: https://gist.github.com/rossant/6046463 evolved in https://excamera.com/sphinx/article-ray.html to a speedier one: https://github.com/jamesbowman/raytrace

https://github.com/martinchristen/pyRT for learning ray tracing with Python

@acs acs moved this from To do to In progress in McThings v0.60.0 Jul 30, 2020
@acs
Copy link
Contributor Author

acs commented Jul 30, 2020

Ok, let's focus in https://excamera.com/sphinx/article-ray.html to test the ray tracer and maybe, create our own version.

Forked at: https://github.com/acs/raytrace

Let's start with the slower and simpler version: https://gist.github.com/rossant/6046463 Which in the repository is https://github.com/acs/raytrace/blob/master/raytracing.py

@acs
Copy link
Contributor Author

acs commented Jul 31, 2020

In order to understand ray tracing and to implement it, it is key to understand the different types of lights that exist:

https://www.iu.edu.jo/files/FacultyIT/slides_it/ComputerGraphics/lecture%207.pdf

  • Emitted
  • Ambient
  • Diffuse
  • Specular

In the ray tracer sample, the last three are used. The objects don't emit light in this scene (and in general).

It seems that in the example, the https://en.wikipedia.org/wiki/Phong_reflection_model is used to describe how light is reflected in the objects. So how the objects appears in the scene.

The key logic is how the color of each pixel is defined:

    # Start computing the color.
    col_ray = ambient
    # Lambert shading (diffuse).
    col_ray += obj.get('diffuse_c', diffuse_c) * max(np.dot(N, toL), 0) * color
    # Blinn-Phong shading (specular).
    col_ray += obj.get('specular_c', specular_c) * max(np.dot(N, normalize(toL + toO)), 0) ** specular_k * color_light

And it is pretty natural: the color of each pixels is the sum of ambient light, diffuse light and specular light. Ambient is the same for all visible voxels of the scene. But diffuse and specular are computed using two algorithms.

So for each ray hitting a voxel we compute its color using this method.

@acs
Copy link
Contributor Author

acs commented Aug 2, 2020

A pretty cool introduction, with a good balance between introducing basic concepts and explaining the whole thing: https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/adding-reflection-and-refraction (at least for my current vision of ray tracing).

And https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection describe a minimal ray tracer!

@acs
Copy link
Contributor Author

acs commented Aug 2, 2020

@acs acs removed this from In progress in McThings v0.60.0 Aug 2, 2020
@acs acs added this to To do in McThings v0.70.0 via automation Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
research Research a Topic
Projects
Development

No branches or pull requests

2 participants