|
Features > A tribute to Build > Exclusive: Polytex, Build version 2.0
Back when Duke3D was being developed, Quake was about to do real 3D for games. For this reason, work was started on bringing the Build engine
to being a true 3D renderer.
What ever happened to the Polytex engine you were working on?
The Polytex engine,
showing different render
modes.
In 1994, Scott Miller was pushing me to write a new engine to compete with
Quake. So I played around with some stuff and called it "Polytex". A few
months later, the Build teams were complaining (to both Apogee and myself)
that I was not giving enough attention to Build. We all knew what our
priorities were.. and that was the end of Polytex.
Polytex never got past the test program stage. Polytex generated a BSP tree
on the fly at startup and drew all surfaces in the map in back-to-front
order. Drawing this way avoids the need for hidden surface removal, but it
suffers from a ton of overdraw. It actually ran fast enough on medium-size
Build maps. To achieve this, I had to optimize my polygon drawing code as
much as possible. I used 2 unusual tricks to speed up my polygon drawing:
1. Free-directional texture mapping. This method is very fast since it uses
a minimal number of divides. It is also very close to correct perspective.
Unfortunately, free directional mapping suffers from visible artifacts which
make textures not look so clean (I like to call them "sawtooth" marks)
2. 2-D texture cache. Instead of simply using malloc() when allocating space
for textures, I wrote a special system that would allocate rectangles for
each tile on a 2-dimensional (X * 256) space. This way, all textures could
be accessed simply by using the x86 byte registers (AL and AH for example)
as U and V texture coordinates directly. This makes for a much faster inner
loop - especially on 486's - because there is no need for shift operations.
The 2D cache saved a lot of memory on poorly-sized textures, such as 65x129.
Polytex had a lot of problems. Besides the obvious bugs and crashes
everywhere, I didn't have a clue on how to implement an editor. I was trying
to do everything in 3D mode. In fact, the only editor function that remotely
worked was the 'T' key (for splitting a polygon into a triangle
fan), but even that had problems because I had to
re-generate the BSP from scratch on every change. If I wrote a 6 degree of
freedom polygon engine from scratch today, I would never use a BSP.
Actually, it would be very similar to my "Polymost" engine.
|
|