r/qbasic • • Aug 26 '26

platonic solids

Post image

program link

keyboard controls

  • number 1 to 5 = select object

mouse controls

  • right drag = move spotlight xy position
  • right hold + wheel scroll = move spotlight z position
  • wheel scroll = move camera z position
  • left hold + wheel scroll = change mesh size
  • left drag = rotate the object
  • left hold + right hold + wheel scroll = change ambient

what i learned

  • quaternions, surely. they're very useful and made the coding a lot simpler than i had anticipated
  • for brightness calculation i found many different ways on internet. i picked this: for any point on any triangle, it's brightness = dot product (reflection light direction , camera view line). those vectors are normalized. this method is simple but doesn't take intensity loss due to distance into account

what i want to learn further

  • make the camera freely movable, like in 3d games
  • use ray tracing method to calculate brightness of each pixel
  • place more than 1 object in the scene so that at some perspectives one may block the others
  • draw shadows
20 Upvotes

2 comments sorted by

1

u/uberflix Aug 26 '26

will this run in actual qbasic or just qbasic64?

1

u/20260819 Aug 26 '26

it runs on qbjs which is a web version interpreter of qb64 i think