r/GraphicsProgramming • • 2d ago

are shadow rays unavoidable?

Post image

i'm writing a raytracing (maybe pathtracing?) program. my program doesn't treat light sources differently than an hittable object. it doesn't deliberately cast a "shadow ray" toward each light source and check whether it hits and if it does get the color and multiply it with cosine, etc. it just shoot rays and let them bounce and bounce and bounce. some eventually reaches a light source and returns the color

it always produces soft shadows but i can't get sharp and clear shadow. and the soft shadows are quite noisy. is there no way i could overcome this, other than adding a shadow ray shooting procedure?

addition info:

shadows are more visible in low light environments so i usually use relatively dark scenes to test shadow formation and do gamma correction. attached image is an example. the scene has only one light source which is behind the balls and located at infinity

how to get a clear and sharp shadow?

28 Upvotes

22 comments sorted by

View all comments

1

u/FrogNoPants 1d ago edited 1d ago

Your shadows should become noise free eventually with your current approach, so if they aren't something is up, are you clamping the # of samples or something?

^ That is assuming the light in the picture is the actual size.

The shadows won't be hard, since the lights projected size is fairly large.

1

u/20260819 1d ago

thanks i figured that out. i should use a light source as small as possible in order to get sharp shadows