Ray Tracing

Started by
16 comments, last by Tom Sloper 3 years, 1 month ago

Anyone here done ray tracing? I`m just starting on this path and I think I understand the basics (casting rays from a point towards the space contained between the four corners of a rectangle ) If you`re familiar/did stuff in this area would you mind sharing about your project?

My project`s facebook page is “DreamLand Page”

Advertisement

I just started working on a photon simulator, semi-ray tracer a couple days ago… not much to share about it right now, but I'm actually moving photons about 1 meter a frame, a random direction from a random light source and ray casting from the last position to see if it hits anything and if it does then plot a pixel from the transformed world position, and then bounce the photon. This is done on the CPU… has to be multi-threaded of coarse or it would be too slow.

Here's a vid of what I have so far, this is 50k photons all ray casting along their path. Not much, but like I said I just started it a couple days ago. This is viewed from 2km away.

BTW, ray tracing in unity is extremely easy and can now be done in parallel with raycastcommand which I just found out about. It improved my raycast speed by quite a bit.

in unity to trace a screen you just set the ray direction from a pixel with the camera function screenpointtoray and then cast it… couldn't be easier… It's a little more complicated with raycastcommand since you have to batch your rays but not by much.

Turbo14 said:
ray tracing in unity

the image produced by ray tracing is not the endproduct [edit: in my case], I intend to make it part of my existing game dev project.

I have messed up with the code of others in the past, I decided it`s time to build my own ray tracer.

Initially I though you`re talking about backwards ray tracing (rays cast from the light source) on a second read I`ve picked it - it`s a semi-ray tracer.

My project`s facebook page is “DreamLand Page”

While it uses ray casting to detect collisions and it'll eventually be used to collect light at collision points from the light source, and bounces, it's more of a point renderer. The collision points are rounded to a certain precision so not too many get spawned from collisions.

EDIT: I was thinking.. instead of spawning and rendering points at collisions I think it would be better to have light textures for objects and update their light values when the particles hit them… it would look better than having sparse points rendered for my objects.

Here's a vid that shows some points colliding with a box. There's 275k points simulated here. Most of the work is done on the CPU, the GPU just renders the points.

Interesting work you`ve done Turbo, thanks for sharing.

My project`s facebook page is “DreamLand Page”

I wrote a robust path tracer to study anisotropy and clearcoating on PBR materials. I also played around with the regular Cook-Torrance BRF to explore possible improvements for masking-shadowing, importance sampling and energy transfer.

The particle tracing thing didn't really work out, it was moving particles around on different threads but since I had to raycast their collision on the main thread I ended up having to cast very long rays since I could only cast them every once in awhile and I had to cast them from the particles past position.

Anyways what I'm doing now is caching ray intersection points and reflection directions and modified colors and gradually casting them and updating their cached data. I store the GI data in a texture on the objects. It takes a few seconds to cast the initial rays but when that's done everything updates pretty quick… it's still progressive but it looks better than my old progressive ray tracer when objects are moving… maybe it doesn't look the best but it's GI at 2500fps lol. Don't mind my Activate Windows watermark… just upgraded my PC and haven't got a new windows key hehe.

I'll keep working on it and see if I can improve the quality.

Update… photon traced GI. The shadows are done by unity… looks too crappy when stuff moves to have traced shadows.

hey @kudovickij

thank for sharing about your work and knowledge.

@Turbo14

looks nice. I`m still working on setting up things. You got me intrigued Turbo14, I`ll post my screenshots in a few days.

My project`s facebook page is “DreamLand Page”

This topic is closed to new replies.

Advertisement