Sunday, February 18

Hack Excel for 3D Rendering

[C Bel] teaches Excel and he has a problem. Most of us — especially us Hackaday types — immediately write a VBA (Visual Basic for Applications) macro to do tough things in Excel. Not only is this difficult for non-technical users, but it also isn’t as efficient, according to [C Bel]. To demonstrate that VBA macros are not always needed, he wrote a 3D game engine using nothing but Excel formulae. He did have to resort to VBA to get user input and in a very few cases to improve the performance of large algorithms. You can see his result in the video below or download it and try it yourself.

The game is somewhat Doom-like. Somewhat. As you might expect it isn’t blindingly fast, and the enemy is a big red blob, but as the old Russian proverb goes, “The marvel is not that the bear dances well, but that the bear dances at all.” (And thanks to [Sean Boyce] for recalling that quote.)

You can download the spreadsheet with or without VBA if you want to try it or dig into the internals. It is really pretty impressive, including:

  • An infinite procedurally-generated maze map
  • Real-time ray tracing
  • Occlusion calculation
  • Basic illumination rendering
  • Illumination and compute shader
  • Natural displacement engine

Do we agree this is better than macros? We aren’t sure, but we were impressed you could pull all this off with formula manipulation.

Not that we haven’t abused spreadsheets ourselves (look at CARDIAC in a spreadsheet and — although not ours — Little Man). We’ve even used them for circuit analysis.

No comments:

Post a Comment