r/GraphicsProgramming • u/20260819 • 25m ago
i think i have some idea now
thank you all for helping me. several commentors said i have to use point light source so as to get sharp shadow. i did some experiments. as my program shoots random rays blindly so it'd be nearly impossible for a ray to reach a point light source (or light source which has 1 pixel radius). i tried using small light sources. firstly i tried this

it was too dim and i could hardly see the scene so i enlarged the light slightly

it could barely be seen now and as far as i could tell the shadow was quite sharp. then i tried this

the scene was more lit up and the shadow started to show certain degree of blurriness. i think it's the sweet spot. with everything else being unchanged i increased the number of samples

still noisy. not ideal but at least not too ugly. i think i got it
the reason why i don't want to use shadow ray is: my program has a real time mode and i always change the scene and properties of the objects. for example the ball in the scene can be set up to become 50% reflective and 50% emissive. it can be a light source. the list of light sources (and their properties) change during runtime. sometimes i use a skysphere that acts as light source too. isn't it quite complicated to implement shadow ray workflow?