This is my experiment on raytracing based on GPU.
It should obey the basic rules of raytracing, but is probably not the common practice, so be cautious when reading my codes.
- Install
pnpm - Run
pnpm i - Run
pnpm run dev
In the future, this part can be configured with JSON.
config_max_bounce: the max bounce time (recursion depth) of rays
gen_ray: prepare initial primary rays; for each pixel, generate one random rayhit_test: hit test for existing rays, calculate color contribution and new raysfilter: filter based on previous outputs to reduce noisesfilter: additional filter to reduce noises- to be added..
blit: blit result to screen
In one frame:
- gen ray for each pixel
- hit test for
config_max_bouncetimes - filter using previous frame's output (running average)
- blit to screen