Microtexture emulation

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Microtexture emulation

Postby Ian » Mon Oct 22, 2018 5:10 pm

This one is for Harry, since I am just building upon the great work he did :)

Sometimes obscure documents can really help us in emulation. Here is one that has some specs about the real3d pro-1000.
http://www.textfiles.com/computers/DOCU ... 3dspec.txt

allows two different texture patterns to be added together and placed
on any surface. The microtexture pattern will emerge as the viewpoint
moves closer to the textured surface. Microtexture is a user-defined

Microtexture was something we weren't sure was used or even existed on the model3. Until one day someone made this screenshot comparison with the real hardware.


Okay clearly a large difference. Digging around in the texture memory we found the missing texture that is blended with the road surface.


Microtextures today would be described as a type of multitexturing.

A small history lesson :)

Back in the early days of computer gfx quake was a pretty popular game. Quake had lightmaps, which was actually a type of precalculated radiosity. Basically bounce some light around a level and catch the output in some textures (or lightmaps). It's actually a very accurate way of doing lighting, but lightmaps were generally pretty low resolution which didn't really work for hard shadows. Lightmaps looked something like this


Modulate with textures

The hardware at the time, the 3dfx voodoo1 only had 1 texture unit. It could only draw a poly with 1 texture at a time. In order to draw levels with lightmaps (which require 2), it would have to draw the entire world twice. First pass would be the lightmap pass, where it would draw only the brightness textures. Then in the next pass it would draw only the normal textures, and set the appropriate blending mode to mix them together. Obviously this was pretty expensive drawing everything twice.

The voodoo2 had two texture units, so could draw the entire world in a single pass. First texture unit would read the lightmaps, and the 2nd the textures. So by having a 2nd texture unit you could almost double the fps with the same speed hardware.

Anyway, back to the real3d. The real3d has two separate memory banks for texture memory. Both texture banks were 4meg each (probably split between more chips). Each texture memory bank on the model3 is actually laid out like a giant texture with a resolution of 2048x1024, with the mipmaps living in the lower right portion. Knowing how the physical hardware was laid out helped with the logic to work out how to use the micro textures. On the real3d there are no texture coordinates for the microtextures. They live at fixed memory locations in memory, and share texture coordinates with the base texture, just with a scale set to make them repeat X times over the surface. If a base texture was referenced on unit 1, the microtexture would always come from unit 2, and vice versa. It could never read the microtexture and the base texture from the same memory bank.

Texture memory on the model3 looks something like this :) Top half is one unit, bottom half is another unit. It's easier to see the mipmaps in the 2nd half because there are less textures.


Anyway the final result looked like this

Near perfect match to the arcade.

Then someone pointed out the flags on LA machine guns at the start looked kinda funny after adding microtexture emulation

The flag is being mixed with this texture.

Are the flags supposed to look like that? For a lot of games, only hilariously poor quality videos exist on youtube. Recorded in 240p from a CRT, etc, making actual confirmation very hard if not impossible. I did manage to find this though ..


Clearly very different to what we have. No microtextures here.

The real3d supports 0,4,8 microtextures. And they are all 128x128 pixels. Looking at the texture memory, it's clear the game isn't uploading any microtextures at all, because theres no set of textures that match that format at all. Yet the flag polygon has this attribute set. So why is the hardware not drawing them?

Some time ago Harry suggested that the microtextures were being faded out as a function of distance (or more accurately) LOD mipmap / blended out. He gave this screenshot

Naturally I was somewhat skeptical. Could it just be a video compression artifact? Hard to tell. Then later on we found this ..


Proper potato quality video, but enough to actually confirm this effect was real. Reading that description again from the text document

The microtexture pattern will emerge as the viewpoint moves closer

I originally just assumed that, that meant they would become clearer as it moved closer, since lower resolution mipmaps would remove the pattern entirely as the resolution of the textures decreases. But apparently they were actually faded out completely.

Anyway correctly (or as close as I can guess how it works) fading out the microtextures


Also fixes the flags in LA machineguns :)
Posts: 1535
Joined: Tue Feb 23, 2016 9:23 am

Re: Microtexture emulation

Postby YoYo09 » Mon Oct 22, 2018 6:46 pm

finally :D
great work, thank you Ian
Posts: 67
Joined: Mon Nov 28, 2016 7:43 pm

Re: Microtexture emulation

Postby scd » Tue Oct 23, 2018 9:10 am

isnt it suppose to look better without this kind of effect? (as far as i remember the emu use trilinear filtering to give a better quality). just wondering...
Posts: 47
Joined: Thu Jun 01, 2017 11:35 am

Re: Microtexture emulation

Postby theboy181 » Tue Oct 23, 2018 9:57 pm

another GREAT read, and awesome work!
Posts: 6
Joined: Mon Jun 20, 2016 8:17 pm

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 4 guests