
DirectX 7 Direct3D Rasterizer for Grand Prix Legends
====================================================
This is *unsupported* BETA software.  Please do not contact Sierra or Papyrus for technical support.  Use this software at your own risk.


Overview
--------

* Requires Grand Prix Legends.

* Requires at least DirectX 7.

* Works on GeForces and TNTs. (read "Notes And/Or Problems" below)

* Uses a Z buffer to gain a 60% frame rate improvement over not using a Z buffer.

* Mirror images are twice the resolution as compared to the other rasterizers.

* Supports resolutions up to 2048x1536.

* Can run in a window.


Updated for this version
------------------------

Fixed the incorrect flagger color bug, and improved visual image quality: anisotropic filtering can be enabled if your graphics card and drivers support it for a very nice improvement at no framerate hit, and the rendering of transparent images is improved at a small framerate cost, if you choose to use this, no more moth eaten trees or fences.


Disclaimer (i.e. please don't blame us!)
----------------------------------------

This driver, rastd3d7.dll, is a beta version.  As such, there may be some incompatibilities with various cards, and it may even crash your system (although it shouldn't cause any harm).  We have tested it with only a few different Direct3D implementations. It was written specifically for my GeForce DDR board at home, but it should work on other cards too. It is possible, however, that it may NOT work on certain other graphics cards. Please use the most up-to-date Direct3D driver for your graphics card, keeping in mind that the reference drivers available from the 3D accelerator chip manufacturer may be more up-to-date than the driver available from the card manufacturer.  If you need to update your driver, please be sure to follow its accompanying instructions very carefully.


Installation
------------

1) Copy rastd3d7.dll into your GPL\ install directory.

2) Add the following lines to the GPL\core.ini file. If the core.ini file does not exist, you will need to create one. If you already have a [Int Profile Values] section in your core.ini, simply append the valueX lines to that section. Otherwise, you'll need to copy the whole [Int Profile Values] section below. 

The rasterizer will work without adding these lines, but will default to the values shown below, and these values may not be optimal for your system.

** The [Int Profile Values] section of core.ini must precede the [Direct3D7] section. Otherwise, these core.ini adjustments won't work correctly! **

[ Int Profile Values ]
value3 = Direct3D7:D3DDevice:0                  ; do not change
value4 = Direct3D7:TossHighestMip:0             ; do not change
value5 = Direct3D7:DoubleMirrorResWidth:1       ; do not change
value6 = Direct3D7:DoubleMirrorResHeight:1      ; do not change
value7 = Direct3D7:DirectMirrorRendering:1      ; do not change
value8 = Direct3D7:DisableZBuffer:0             ; do not change
value9 = Direct3D7:AlphaThreshold:240           ; do not change
value10 = Direct3D7:TransparentMipsDrawOrder:0  ; do not change
value11 = Direct3D7:TrilinearFiltering:1        ; do not change
value12 = Direct3D7:AnisotropicFiltering:0      ; do not change
value13 = Direct3D7:LODBias:-50                 ; do not change

[ Direct3D7 ]
D3DDevice = 0
TossHighestMip = 0
DoubleMirrorResWidth = 1
DoubleMirrorResHeight = 1
DirectMirrorRendering = 1
DisableZBuffer = 0
AlphaThreshold = 1
TransparentMipsDrawOrder = 1
TrilinearFiltering = 1
AnisotropicFiltering = 14
LODBias = -75

3) Run GPL, go to Options - Graphics, and change the 3D Accelerator option to "rastd3d7". Restart GPL. If GPL fails to restart correctly, then there's something wrong. Switch back to the software rasterizer by editing the GPL\app.ini file and changing the line:

lastRasterizerDLL = rastd3d7.dll 

to

lastRasterizerDLL = softdll.dll

Then, save the changes to app.ini. It looks like you're out of luck! 



Adjustable Core.ini Options
---------------------------

* D3DDevice = 0

If you have multiple 3D graphics cards in your machine, make sure GPL is using the graphics card you want to use. The rasterizer displays the name of the graphics card it is using at the top of the screen when GPL first runs. If it is not using the 3D card you want, then change this line to:
D3DDevice = 1, or
D3DDevice = 2, etc.

* TossHighestMip = 0

In order to be compatible with most D3D cards, the rasterizer has to convert all the textures to 16bit. This means that GPL can use up to 15-16mb of textures. Cards with less texture memory may need to have this option set to 1 to reduce texture memory usage and minimize texture swapping during driving. This will result in slightly more blurry textures when up close.

* DoubleMirrorResWidth = 1
* DoubleMirrorResHeight = 1

The mirrors look rather blurry if you are running at resolutions of 1280x1024 or higher, so these options will double the resolution of the mirror texture. This is only worth doing if you run at 1024x 768 or greater, or if your graphics card is fast enough.

If you experience framerate problems after doubling both the horizontal and the vertical resolutions, try running with only the vertical resolution doubled.

* DirectMirrorRendering = 1

Most modern 3D cards are able to render the mirror scene directly into the mirror texture. However some cards or drivers can't do this, and need to draw the mirror scene on the main backbuffer and then copy the image into the mirror texture. If you have problems with mirror rendering, such as seeing the mirror image appearing in the top left corner of the screen, try setting this to 0.

* DisableZBuffer = 0

In order to gain a significant frame rate improvement (about 60%) this D3D renderer will try to use a Z buffer to minimize state changes. The renderer automatically will attempt to detect any problems with creating a Z buffer. You can disable any attempt to use a Z buffer by setting this to 1. For example, you may want to benchmark the performance difference between enabling/disabling the Z buffer, or you may want to check if your graphics card actually is using the Z buffer or not. If you set this value to 1 and get the same frame rate, the Z buffer isn't working on your machine.

* AlphaThreshold = 240
* TransparentMipsDrawOrder = 0

The edges of trees and fence textures require transparency. In order to draw these polygons fast using the above Z buffering trick they need to be drawn in closest to furthest order (TransparentMipsDrawOrder = 0), but if the edges of the transparent parts are allowed to blend smoothly to totally transparent, this will result in nasty visual artifacts around the edges of the trees and fences, so the transparency, or alpha, threshold for drawing is kept very close to solid (AlphaThreshold = 240). This helps the framerate, but makes the trees look moth eaten and fences tend to vanish in the distance. You can dramatically improve the appearance of trees and fences by drawing these transparent polygons from furthest to closest (TransparentMipsDrawOrder = 1), and then this allows you to draw the transparent edges of the trees and fences completely (AlphaThreshold = 1), but at the cost of a small framerate hit. If you've got a fast PC, I definitely recommend the latter settings.

* TrilinearFiltering = 1

This makes mipmapping look a lot nicer. Most modern cards are able to do trilinear filtering in a single pass, but some cannot. Setting this value to 0 will help speed up the framerate on slower cards.

* AnisotropicFiltering = 0

A problem with the way polygons are drawn is that as you look at the polygon at low angles the texture tends to get very blurry. You can see this particularly in a car racing game, as the armco, fences, road surface and grass are usually at very low angles. Anisotropic filtering is a neat trick that can help the texture look better at these low angles. GeForce 1 or 2 cards can do 1 level of anisotropy, you can turn on this effect by using a setting of AnisotropicFiltering = 2. Valid values are powers of 2. 1 or 0 = none, 2 = 1 level, 4 = 2 levels, 8 = 3 levels, 16 = 4 levels, etc. GeForce 3 cards can do 3 levels of anisotropy which looks awesome, AnisotropicFiltering = 8, except that at the time this is being written it appears the game cannot enable this itself, you have to use special programs to hack into registry, but do this at your own risk, see the disclaimer above. Setting this value too high is harmless, it will only apply as much anisotropy as the drivers claim they can support.

* LODBias = -50

You can mess with how your graphics card selects which mip level of a texture to display here. The value in this field (number of mip levels to adjust) times 100. 0 is completely normal. 100 would bring lower mips exactly 1 mip level closer to the foreground making everything a bit blurrier. 450 would bring the mips 4.5 levels closer, making the game REALLY blurry. -50 is the default, which pushes the more detailed mips 0.5 mip levels further into the scene, helping make the image a little crisper. Anything much lower than -50 starts to make the textures "speckle" a lot in the distance, even if they look sharper.


Graphics Cards/Chipsets Known To Work
-------------------------------------

GeForce 3
GeForce 2 GTS
GeForce 256 DDR
GeForce 256
TNT 2 Ultra
TNT 1
Voodoo 3

If your card is not listed here, it doesn't necessarily mean that
it won't work. Give it a try!



Notes And/Or Problems
---------------------

* On nVidia cards the game will crash when you try to enter the cockpit if you are using the Detonator 5.xx drivers earlier than version 5.22. There is a bug in the screen mode switching that was fixed for 5.22. Please make sure you have the latest nVidia drivers.

* On nVidia cards (and possibly others as well) you can run GPL in a window by setting in your core.ini:

[Rasterizer]
fullScreen = 0

The window initially will appear in the top left corner, but you can drag it around. It is also overlappable.

* The mouse pointer currently is done only in hardware, and as a result is only visible on primary graphics cards. For instance, it will not be visible if you are using a Voodoo 2 as your D3D device.

* Sometimes, the penalty board (that little board that appears where your pit stall is) will be blank. 

* Sometimes you may see very slight hiccups in the rendering of fonts. 



Some Suggested Optimal Settings For Various Graphics Cards
----------------------------------------------------------

* GeForce 3 cards:
* GeForce 1 or 2 cards on faster systems:

[ Direct3D7 ]
D3DDevice = 0
TossHighestMip = 0
DoubleMirrorResWidth = 1
DoubleMirrorResHeight = 1
DirectMirrorRendering = 1
DisableZBuffer = 0
AlphaThreshold = 1
TransparentMipsDrawOrder = 1
TrilinearFiltering = 1
AnisotropicFiltering = 8
LODBias = -50

* GeForce based cards on slower systems:
* Voodoo 3 based cards:

[ Direct3D7 ]
D3DDevice = 0
TossHighestMip = 0
DoubleMirrorResWidth = 1
DoubleMirrorResHeight = 1
DirectMirrorRendering = 1
DisableZBuffer = 0
AlphaThreshold = 240
TransparentMipsDrawOrder = 0
TrilinearFiltering = 1
AnisotropicFiltering = 2
LODBias = -50

* TNT 1 based cards:

[ Direct3D7 ]
D3DDevice = 0
TossHighestMip = 0
DoubleMirrorResWidth = 0
DoubleMirrorResHeight = 0
DirectMirrorRendering = 1
DisableZBuffer = 0
AlphaThreshold = 240
TransparentMipsDrawOrder = 0
TrilinearFiltering = 0
AnisotropicFiltering = 0
LODBias = -50

* Non listed cards:

Experiment :)



Good luck, and have fun!

