From bytes to 3d

Foreword: I mush say that 3d artists at Sega-AM2 did an awesome job. The tracks are just perfect. Thank you guys!

From Flight Sim to Racing "Sim"

Following the work on Tiny Sim I kept working on 3d projects with an old crush of mine: flat shaded polygons.

Virtua Racing was the kind of style I was looking for, so started a 3d engine focusing on effective pruning of geometry.

A basic prototype using standard raycasting (think Wolfenstein) was up and running in little time:

Still eyeing at a Virtua Racing demake, I stumbled accross this old post: describing the layout of the Megadrive ROM.

That was the trigger: the Megadrive 3d models looked like something that my engine could handle.

Unfortunately, the post detailled the in-memory layout of the running game. After trying to make sense (and failing) of running arcade emulator, I went back to the ROM.

The article clearly mentionned a standard 3d format layout (colors, x/y/z coords). I was hoping the ROM was storing everything uncompressed and built a small app in PyGame to "scan" the data. 

This must be what the unfiltered matrix look like!

That said, scanning through the memory addresses - some data did make sense (take that AI :). For ex, see these curves? Looks like indeed some 3d data is around.

I am skipping some tedious comparison of bytes "pack" to match layout with area I was sure contained 3d data and ended up with that:

Tada!! Now time to scale up:

Good news: the various track segments (130) are using absolute positions, will greatly facilitate import to Blender.

A couple of Blender Python lines after:

Mapping color codes (2 x 4 bits colors) to something matching the game:

Ok - that's 5371 vertices, 2839 faces, time to optimize the hell out of the 3d engine!

(and good news - it does fit into 2MB of pico8 RAM - pfew!)

Raycasting quad pruning

At this point, there was no turning back - the 3d track was too good to be left as an experiment and decided to stick with a multi-cart game :/

With some more python scripting, I had an automated export toolchain from Blender to data carts (yikes the __sfx__ format!!):

  • Big Forest: 5 carts / 180Kb
  • Acropolis:  5 carts / 188Kb
  • Ocean: 5 carts / 202Kb

Given I need 1 cart for the game and 1 game for the title screen, that's a total of 17 carts - the export limit being 16!!!! 

And that's why the tech demo did not ship with all 3 tracks :/

Next step: investigate compression!

Megradrive ROM trivia

Each face has its own vertices - no sharing accross adjacent faces (I assume due to limited dynamic allocation on console), but man, what a waste of cpu!

Tracks have animal models: horses, birds, duck, ... that no one in the arcade ever saw for sure!

Pit stop animation is set of fixed 3d models, displayed one after the other (matrix skining is for looser :)

Get Virtua Racing Demake

Download NowName your own price


Log in with to leave a comment.

Care to share details on the ROM format? Especially the address of the 3D models?

Ok I can see an address in your screenshot 0x00138200.

So for anyone looking to extract the stages 3D models from the european Virtua Racing ROM, here are the addresses:

beginner: 0x00138200 palette: 0x001d3020

medium: 0x0014c200 palette: 0x001d30a0

expert: 0x00164298 palette: 0x001d3120

This is super impressive. I'd like to try converting this to Scratch. Would it be possible to share the .blend files you extracted for this? Or any more info you're willing to share about the models?

I won’t share Blend files and not sure what you expect to do with Scratch???

vOv   I've done a number of 3d projects on Scratch and was hoping to get this running too.

Like this...

If anyone else comes across this I will post Blend files soon.

Amazing project! Thanks for writing this post.

Nice details ! Thanks for sharing !

Thank you for this.