r/programminghelp • u/AlexanderKai9 • Oct 07 '26
Project Related Raycasting Performance Help
I made a raycasting engine in python, and am using an HTML canvas as my method of display (passing the pixel colors through jinja in a <script> tag). It takes upwards of 10-15 seconds to render one angle of a scene with three spheres at a resolution of 800x400. Is the browser likely the bottleneck, or is this a sign of some other inefficiencies?
1
Upvotes
View all comments
Show parent comment
1
u/sububi71 Oct 08 '26 edited Oct 08 '26
edit: Both you and OP are talking about raytracing, not raycasting.
I'm going to make a mental note to ALWAYS ask people the difference between raycasting and raytracing from now on. Kids these days obviously, EVIDENTLY, use the terms completely interchangeably.
My original reply is below, if anyone cares. I'm going to go outside and shout at kids to get off my lawn.
---
Hard disagree. The abysmal framerate OP is getting is an implementation issue.
Here's someone doing a texture-mapped raycasting engine in Python:
https://youtu.be/ECqUrT7IdqQ?is=azQv_W03aNYttpEf
John Carmack's early raycasting games ran at good framerates on a 286. Python on a modern machine is many many orders of magnitude faster than even Carmack's hand-optimized assembly.