Thursday, May 3, 2018

Star Wars Episode I: Racer






3D Vision fix for Star Wars Episode I: Racer (GOG release). It includes an aspect ratio mod that I did via shaders. The fix needs dgVoodoo to convert the game to DX11. There are some unavoidable compromises with the fix related to the HUD and geometry.


Fixed
- Most of the HUD at fixed depth (see the notes after the installation steps).
- Fixed "layer" was making 3D broken at high convergence levels.
- Sun and lens flares now at full depth.


Remaining issues
- Shadows are unfixed. They seem to not have depth information, and even if they had it, they still share their texture hashes with other geometry (I tried to do a manual approximation and it backfired).
- By default I have left the boost meter at a non fixed depth to not compromise geometry. You can probably still see it with one eye somewhere on the screen. If you want to fix the meter, open "d3dx.ini" and uncomment the "[TextureOverrideHUD3]" line and the two lines below it.
- Some slight geometry accuracies (affecting a few textures) had to be made to fix the HUD. See the notes below the installation steps.
- WARNING: trying to enable SBS/TAB/interlaced modes will crash the game, even if you configure the mode beforehand. You have to play with normal 3D Vision unless you find (and hopefully share) a way to make it work.


Installation
- First configure the game resolution the normal way. I recommend the default 640x480 for better CPU performance and full size videos.
- Download this file and extract its contents in the "STAR WARS Racer" folder, where "SWEP1RCR.EXE" is.
- Download the latest dgVoodoo 2 release or WIP version (at least 2.55.1 version) here: http://dege.freeweb.hu/dgVoodoo2/dgVoodoo2.html
- From inside its "MS" folder, copy "D3D8.dll", "D3DImm.dll" and "DDraw.dll" into the game folder. The GOG release of this game comes with a "ddraw.dll" that makes the game DX9, so rename it to something else if you don't want to lose it.
- Open "dgVoodooCpl.exe" and configure it like this, for example, tuning the resolution and some other settings to your liking:



- It's important that you enable "Fast video memory access" to remove a big CPU bottleneck.
- Open "dgVoodoo.conf" and set "DepthBuffersBitDepth" to "force32bit" to have the best geometry accuracy, avoiding the annoying "z fighting" problem.
- Boot the game directly from "SWEP1RCR.EXE", making sure you have admin rights to save the game profile changes it makes the first time. If I launch it from GOG Galaxy it doesn't trigger 3D Vision.


HUD and geometry compromises
The problem of this game is that it has just a handful of texture hashes shared between geometry, shadows, lens flares and HUD. Even with a very narrow depth check (to see if it's exactly 0, for the HUD), it can still affect geometry. I tried to give the game the best balance between these things, but you can change how it's configured (experienced users only).

Open "d3dx.ini" and go to line 996, right before "[TextureOverrideHUD1]". Take a look at those blocks of text until line 1047. By default, I made the game unstereoize (i.e. put at screen depth) everything that has zero depth. Blocks that contain "filter_index=2" will avoid this and in some cases affect the HUD (other times it has no drawbacks). The block I have with "filter_index=1" is the lens flares and sun fix, putting the effect at full depth.

For example, if you want to fix the boost meter, comment the "[TextureOverrideHUD3]" block. But some geometry will have wrong depth.

For a quick general change to disable all HUD fixes in real time (but make the HUD convergence dependant), press the "4" hotkey.


Hotkeys (numbers are not from the numpad)
- 1: five convergence presets .
- 2: HUD depth presets. Screen depth by default, and tweaked for the HUD inside races.
- 3: HUD toggle. Not disabled by default. Only HUD elements with fixed depth will be affected. Sun and lens flares (and some HUD affected by it) won't be disabled.
- 4: press this to disable all HUD tweaks, making geometry perfect (except the always unfixed shadows) at the cost of probably not seeing the HUD if you use enough convergence.
- 5: aspect ratio mod presets (4:3, 16:9, 2560x1080 AR, 3440x1440 AR, 48:9). By default 4:3 to 16:9 conversion.
- 6: Y axis FOV unlock toggle. Use it alongside the "5" key to configure the zoom level. By default it assumes you are using a 16:9 resolution.
- 7: Y axis FOV multiplier, to use alongside the "5" and "6" keys. Use it to change aspect ratio at the same time as using zoom.


Aspect ratio mod
Use the 5, 6 and 7 hotkeys to change settings in real time.

In "d3dx.ini", line 94, there is a line that says "w=0.75". That's the X axis FOV. By default I assume you are using a 16:9 resolution, so "0.75" will unstretch the game, as you see in the screenshots above. The HUD is centered and unstretched too. The drawback of this mod is that there is some geometry culling, especially if you use higher than 16:9 aspect ratio. Also, the HUD will change its size accordingly. Extreme example of the max level of zoom I allow: screenshot.


Recommended settings
- In the "Video Settings" launcher (from GOG Galaxy or the "-v" command in a shortcut), use 640x480 resolution.
- Someone here posted better settings that can't be accessed ingame:
"Go to:
x:\GOG Folder\STAR WARS Racer\data\config\current
Open video.cfg with Notepad++ or similar and change the settings to enable max settings:

VIDEO REFLECTIONS=ON
VIDEO ZEFFECTS=ON
VIDEO DYNAMIC_LIGHTING=ON
VIDEO VSYNC=ON
VIDEO LENSFLARE=ON
VIDEO ENGINEEXHAUST=ON
VIDEO TEXTURE_RES=3
VIDEO MODEL_DETAIL=3
VIDEO DRAWDISTANCE=3 "
- Use Nvidia Profile Inspector to force 8xSGSSAA or 4xSGSSAA if your GPU can handle it. It will reduce texture shimmering a lot.


If you liked the fix and want to contribute for more future fixes, you can donate to this PayPal account: masterotakusuko@gmail.com

24 comments:

  1. When I am using 16:9 left and right of the screen are constantly "building up".
    How to use proper aspect ratio for 16:9 resolution but zoom in to not have artifacts visible on the edges?

    ReplyDelete
    Replies
    1. That "building up" is culling. The game decides to not draw some elements outside the 4:3 area of the screen. Unless someone makes a mod to the ".exe" file of the game to increase that, there's nothing I can do.

      What you can do is going to the regedit config of the game in "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" and for example change "Display Height" to 720 and "Display Width" to 1280. Maybe it's the same if you use the GOG video config launcher.

      With that change, the game with render in 16:9 without the need of my aspect ratio mod, but instead of adding content to the sides it will cut from the top and bottom. You won't get culling problems but you'll notice the image will be more zoomed in. Remember to set "w=1" or press the "5" key once when you are ingame to not use my modified aspect ratio if you want to use this widescreen mode. The HUD will be stretched, and the sun and lens flares too.

      Delete
  2. How do you get 0.75 for 16:9? what is the math behind that, I got a 16:10 monitor and it's not quite correct, but I can't figure out what the value for that should be.

    ReplyDelete
    Replies
    1. What you get without mods is a 4:3 aspect ratio stretched to your aspect ratio. What I do is compressing the X axis to compensate that stretching. The extra geometry at the sides depends on what the game decides to draw.

      4/3=1.333333
      16/9=1.777778

      1.333333/1.777778=0.75

      So, for you:

      16/10=1.6
      1.333333/1.6=0.833333

      That's your final number, 0.833333.

      Delete
  3. Any way I can get it running in a 2880x2160 window to maintain 4:3? Or just get it running windowed in general? Have it set to windowed but it doesn't sem to do it.

    ReplyDelete
    Replies
    1. If you have a normal or custom 2880x2160 resolution in the drivers, just choose it in dgVoodoo and don't enable any stretching option in the drivers or in dgVoodoo. I can play at 1920x1440, for example. But I prefer my widescreen method even if there's some geometry culling (you don't miss any content. You only get more).

      Delete
    2. It's just more useful for OBS recording on a 4k display, still unable to figure out how I can run it in a window though...

      Delete
  4. "- Use Nvidia Profile Inspector to force 8xSGSSAA or 4xSGSSAA if your GPU can handle it. It will reduce texture shimmering a lot."

    I tried adding SGSSAA using nvidia Inspector with no success. Have you tested this to see if it actually works. and if so, is there a behavior flag/antialiasing fix code that is needed to get this to work?

    ReplyDelete
    Replies
    1. Yeah, it works for me just fine. What I do is select 8xMSAA in dgVoodoo (may be unneeded), and in the game profile I choose to override antialiasing, 8xMSAA and 8xSGSSAA.

      The screenshots at the top were made at 4xSGSSAA when I thought 8x would be too demanding (it wasn't, in the end).

      Delete
    2. oh ok I didn't do the dgVoodoo install, I was just trying it in nvidia inspector on the vanilla GOG version of the game. If GOG converted the game to DX9 then SGSSAA should work in inspector, but no success so far.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Wow! great work masterotaku!

    So, I've discovered another thing that many people will like:

    I have my video card and 23" Samsung S23B370 monitor unlocked to work on 75FPS vsync @ 75Hz. This I've done with CRU program from:
    https://www.monitortests.com/forum/Thread-Custom-Resolution-Utility-CRU

    In addition I have enabled the Virtual Resolution from my Radeon RX470.

    So, the game can be forced to display other resolutions like 2560x1440 (2k res):
    https://1drv.ms/f/s!Am6T3B1JzNracdcCVEHwuhzDVBc

    by modifing the EXE from the old WSGF page manual:
    https://1drv.ms/u/s!Am6T3B1JzNrac5759F8FPfBMIBU

    However, it seems that the game engine performance is affected by this and the FPS drops to 50 to 65.

    But this time I've noticed that selecting 1280x1024 resolution makes the engine game work much more fluid.

    Now I can get constant 75FPS with vsync in 4k all the time.

    Is a sweet feeling and the velocity sensation is now PERFECT!

    So, that's all dudes!

    And thanks again masterotaku for your great work!

    See ya! ;)

    ReplyDelete
    Replies
    1. If you mean this widescreen method (http://www.wsgf.org/dr/star-wars-episode-i-racer), it's one the reduces the vertical view area instead of extending the horizontal one like I do.

      Check the installation instructions again. The "Fast video memory access" removes the big CPU bottleneck I had ovserved at high resolutions. Also, with dgVoodoo 2.55.1 (released yesterday) and higher, you have that depth buffer option I mention now in the instructions. Now the game looks better :).

      Delete
  7. hi please take a look at this topic on reddit, it's about the idea of a vr mod for episode I racer: https://www.reddit.com/r/oculus/comments/8oq93e/may_someone_develop_a_vr_mod_for_this_game_please/

    ReplyDelete
  8. Hiya,

    Trying this on the Steam release, where the DGvoodoo side seems to work but the 3D vision fix doesn't, resulting in 4:3 stretched to 16:9 while the hotkeys don't seem to do anything.

    Do you think there may need to be a difference in setup on the Steam release?

    Thanks in advance and thanks for your hard work!

    ReplyDelete
    Replies
    1. (to clarify, I've tried both launching from Steam and from the exe itself, have also extracted the 3D Vision rar's contents into the game folder

      Delete
  9. Tried all of this and nothing is working for me from either steam or GOG

    ReplyDelete
  10. Can't unhide cursor :(

    With standard GOG version all works just fine, after I install this mod cursor is always visible(

    ReplyDelete
  11. I didn't understand about hotkeys. What buttons are they exactly? I press the related ones and it has no effect.

    And about the FOV, how do I modify it already having the 642x480 configuration? I would like to have it as in the capture they showed. In my case, it looks like the 4:3 has been stretched and it looks warped in 16:9.

    ReplyDelete
  12. Can't get this to work. Voodoo is set up to load at 720 and the wrapper files installed but it just loads 2D.

    ReplyDelete
    Replies
    1. Ok I realised that I cant get Pod Racer to load in 720p cant even run it in 480p, very strange.

      Delete
    2. Fixed and working now :)

      Delete