r/qbasic • u/20260819 • 2d ago
raytracer 1.1
i added 1 more ball and some new features. when the program starts it looks like this. the resolution is low as it's a real-time mode

use【q】【e】to switch the highlighted variable and scroll mouse wheel to change it. e.g. you can change the roughness of the "ground" to be 1 and hit【c】to get an offline render image

the shadows are clearly visible. note that the shadows caused by green light are reddish because those regions are lack of green. as default, roughness of ground=3/4 looks like this

if you further decrease the roughness it becomes more reflective and shadows less visible

roughness=0 means completely mirror-like. note that all shadows disappear

you can certainly move and resize the balls, making your own scene. press and hold【1】/【2】/【3】and move you mouse. the relevant ball would move with your pointer. e.g. you can make them mutually tangent to each other. press【z】to change background

you can give the balls some kind of color tone (hue) and adjust their emission (lightness) and opacity (saturation)

you can decrease the f-number to have a sense of depth (defocus blur). the program has auto focus feature. hold【shift】and move your mouse and the focus point would be at the pointer

balls can be mutually tangent not only externally but also internally. you can make the biggest one encloses the other two and move the camera into it (use【w】【s】【a】【d】【ctrl】【space】)

weird things can happen inside a spherical mirror. i can't remember how i got this

just try and use your creativity. the following scene is as follow: big sphere radius = 4, centre at (0,0,0), reflective; medium sphere radius = 1, centre at (1,0,0), reflective; small sphere radius = 1/4, centre at (-1,0,-5/4) and be the only light source; camera at (0,0,4) looking toward (0,0,-1)

full operation manual
【1】/【2】/【3】+ move mouse = move ball
【q】/【e】= select previous / next mouse wheel controllable item
【w】/【s】/【a】/【d】/【ctrl】/【space】= move camera forward / backward / left / right / down / up
【z】= change background
【x】= aim camera to centre of mass of the system
【c】= offline render
【f】= toggle mouse move looking
【v】= toggle auto gamma correction
【shift】+ move mouse = auto focus
【r】/【g】/【b】+ move mouse = move spotlight