PCSXR-PGXP

Discussion in 'PCSX Discussion' started by iCatButler, Aug 8, 2016.

  1. iCatButler

    iCatButler New Member

    Messages:
    106
    Likes Received:
    187
    PGXP (Parallel/Precision Geometry Transform Pipeline) is an enhancement for PlayStation emulation that produces high precision fully 3D geometry data that was not available on the original console hardware.

    It is currently integrated with PCSX-Reloaded via Pete's OpenGL v1.78 plugin and Tapeq's Tweak extension to Pete's OpenGL v2.9 plugin.

    Note: This project is still very much a work in progress.

    Features
    • High Precision Vertex Data (more stable geometry)
    • Reduced Triangle Culling (more detailed models)
    • Perspective Correct Texture Mapping (reduced texture distortion)
    [​IMG]
    Chrono Cross: Distortion of model geometry is significantly reduced, especially at a distance.

    [​IMG]
    Ridge Racer Type 4: Higher precision culling calculations mean that small triangles are no longer culled

    [​IMG]
    Tomb Raider: 3D vertex coordinates mean affine texture mapping can be replaced by perspective correct mapping

    Setup Instructions
    Download the required files (links to these can be found below):
    • A WIP build of PCSXR-PGXP
    • A complete install of PCSX-Reloaded
    • Pete's OpenGL2 PSX GPU Plugin v2.9
    Copy the PCSXR-PGXP.exe file from the WIP build to the root folder of the PCSX-Reloaded (the one with the PCSXR.exe file in it). Then copy the gpuPeopsOpenGL.dll and gpuPeteOpenGL2Tweak.dll files to the "Plugins" folder.

    If you don't already have it copy the "gpuPeteOpenGL2.dll" file to the Plugins folder too (this is required for the Tweak plugin to work).

    Note: If the plugins fail to appear in the "Graphics" menu of the "Plugins & Bios..." window then you may need to install the Visual C++ Redistributable 2015 (x86).

    Debug Visualisations
    Show Spoiler
    Various shading modes are available by pressing F11 when using the OpenGL 1.78 plugin each of which show different information regarding vertices. There are currently three such modes that can be cycled through, the first shows the different states of each vertex:
    • Blue: Successfully tracked from transformation on the GTE to the GPU.
    • Cyan: Tracked but has lost its 'w' component.
    • Yellow: The vertices belong to a 2D sprite element.
    • Red: No valid value was found so it falls back on the native low precision values.
    • Green: A suitable high precision value has been found in the cache
    • Magenta: Multiple high precision values were found at the same position of the cache, making the result ambiguous, so the low precision value is used.
    The other two modes display depth values as a spectrum through blue, green and red. The second mode being the 'w' components of the vertices (in older versions this was grey scale).
    [​IMG]
    The last shows depth information taken from the Ordering Table used by the PlayStation to sort primitives so they can be rendered from furthest to nearest.[​IMG]


    Links
    Most Recent Builds:
    WIP_PGXP_build_17_03_19.zip


    Source Code:
    PCSXR-PGXP: https://github.com/iCatButler/pcsxr
    Tapeq's OpenGL Tweak Plugin with PGXP: https://github.com/iCatButler/PeteOpenGL2Tweak

    Additional Links:
    Official PCSX-Reloaded Home Page: https://pcsxr.codeplex.com/
    Pete's OpenGL2 PSX GPU Plugin: http://www.pbernert.com/html/gpu.htm#OGL2
    Visual C++ Redistributable 2015: https://www.microsoft.com/en-us/download/details.aspx?id=48145
    Tapeq's Tweak Plugin Thread: http://ngemu.com/threads/peteopengl2tweak-tweaker-for-peteopengl2-plugin-w-gte-accuracy-hack.160319/

    Previous Builds:
    WIP_PGXP_build_16_08_01.zip
    WIP_PGXP_build_16_08_31.zip
    WIP_PGXP_build_17_03_17.zip


    Thanks to:
    Tapeq
    Pete Bernert
    Edgbla
    Simias
    The PCSX-R team
    And everyone who has provided feedback.
    Last edited: Mar 19, 2017
    rodgil, DinJerr, Strike105X and 9 others like this.
  2. NGEmu.com Advertisement

  3. SolisX

    SolisX Member

    Messages:
    259
    Likes Received:
    25
    Hello iCatButler,

    Any screens shots for comparison?
  4. gamax92

    gamax92 New Member

    Messages:
    1
    Likes Received:
    0
    Very impressive work! It's running great with many of the games I've tested it with, really improves how it looks.
    Kinda odd to see a racing game with straight lines :p

    Just wanted to note, with Hydro Thunder, the hack does not work at all.
    According to F11 debugging, everything shows up as red, even with Recompiler/Interpeter or Memory/Memory+CPU
    Enabling Vertex Cache will get things flickering madly as green/red/magenta and generally breaks the graphics massively.

    Show Spoiler
    [​IMG] [​IMG]
  5. TheDimensioner

    TheDimensioner New Member

    Messages:
    260
    Likes Received:
    68
    This is great! Having an exclusive thread is much better! To commemorate (kinda XD) I made a video showcasing Medal of Honor in the latest WIP:
    Show Spoiler
    This game works great using "Memory only" mode on PGXP. Only the sky seems to be low precision, but I guess that's a skybox, maybe just a big 2D texture.

    About the internal frames per second, I don't know if it's a bug with Pete's OpenGL2 2.9 plugin (which the TWEAK uses as its base), or if the plugin fixes a timing issue (?) with this game, because parts with no enemies run at 60 FPS, while parts with enemies run at 30 FPS. The corridors with leaf fences at both sides also run at 30 FPS. The OpenGL 1.78 makes the game run at a constant 30 FPS. This is the emulator running without overclock; with it, the parts that run at 60 FPS are more "constant", without common deeps to 55-50 FPS. This also happens on ePSXe's OpenGL 2 "core plugin", so maybe that's the correct behavior? And since people say Mednafen is the most accurate PSX emulator, I tried it with that, and it runs at a constant 60 FPS XD. I don't know what's going on, but at least it's very playable.
    gamax92 likes this.
  6. otherman

    otherman New Member

    Messages:
    93
    Likes Received:
    9
    @iCatButler please, update the main post with the vc_redist.x86 link, before people make the same questione over and over again!

    Otherwise, on emucr there is a build from your github updated with the 64bit dynarec; just to let you know.
  7. fischkopf

    fischkopf Member

    Messages:
    193
    Likes Received:
    13
    Aren't the emucr builds full of viruses these days? I dunno someone here said that.
  8. superjupi

    superjupi New Member

    Messages:
    117
    Likes Received:
    16
    I've definitely gotten my share from them in the past, but the last few PGXP builds of theirs have been clean.
  9. TheDimensioner

    TheDimensioner New Member

    Messages:
    260
    Likes Received:
    68
    Here's Crash Bandicoot 3: Warped.
    Show Spoiler
    Although there's an issue, where at a distance "holes" will appear on the ground (like what the old GTE accuracy hack did on some games), the character models and the rest of the scenario are high precision, using "Memory only" mode.

    This game does not work very well with the widescreen hack, but it's not as bad as Crash 1 and 2. I preferred to record this using the hack anyways, because that big overscan in the NTSC version is just stupid in 4:3, so the game will look kinda of "cinematic" in widescreen XD (XMedia Recode gives me an aspect ratio of 1.9692). I think since the Crash games are 3D "corridor" platformers, there was no need to create more scenario where the player would never get to explore, so the original PSX trilogy might never get a proper widescreen method, even if the widescreen hack is improved someday. Unless someone discovers a way to change the FOV, and also re-position Crash so that he is further on the field, than maybe a vert- method would work... just dreaming though.

    I do hope Sony does a good job on remaking these games, because as emulation already shows, remasters might not work very well.
  10. Lamerq2

    Lamerq2 New Member

    Messages:
    6
    Likes Received:
    1
    theese are for Crash Bandicoot 3 pal version :)
    8005D27E 0E0F
    8005D280 0E00
  11. curryking3

    curryking3 New Member

    Messages:
    41
    Likes Received:
    11
    I tried MGS1 and Chrono Cross yesterday even just with memory PGXP looked really awesome. MGS1 with Memory + CPU looked even better. I had some brief slowdown, but just in one part. Outside of the Shadow Moses base looked incredible :)
  12. iCatButler

    iCatButler New Member

    Messages:
    106
    Likes Received:
    187
    @SolisX Hi! Good idea, I've put a few comparisons in the first post to illustrate the differences. I'll probably put together a video at some point as the difference in motion is even more stark. I've included a couple more images that I put together.
    Show Spoiler
    [​IMG]
    This one shows just how distorted some models can get, the vertices effectively snapping to a square grid.
    [​IMG]
    The distortion effect on faces is also pretty striking.

    @gamax92 I suspect Hydro Thunder is writing individual bytes, PGXP currently only tracks 16 and 32-bit reads and writes because vertex coordinates are stored as two 16-bit values.

    What's happening when the cache is enabled looks like random false positives. There are vertices being transformed and added to the cache but not at their final screen space positions, so when GPU plugin does a lookup it's sometimes finding a value but probably not the right one.

    @otherman good point about the VC++ redistributable, I've added it in now. The 64-bit dynarec is only used in the linux and MacOS versions, the Windows solution only includes the x86 version, I updated it to help CarterLi on GitHub build for Mac.
    I did get it working for Windows locally, with a lot of hacking about, but there seemed little point to releasing that version as most of plugins available are only compiled for 32-bit.

    @TheDimensioner I've noticed those holes in Crash 3, unlike other cases I can't seem to influence those by modifying NCLIP, although the game does seem to use it for back face culling. I can only assume those gaps are either in the original mesh or being created as part of the tessellation/LoD system before the vertices are transformed.
    TheDimensioner and curryking3 like this.
  13. SolisX

    SolisX Member

    Messages:
    259
    Likes Received:
    25
    Hello iCatButler,

    Took me a while to see the difference in Chrono Cross but on the Silent Hill the improvements are alot easier to see.:)
  14. tem_luap

    tem_luap New Member

    Messages:
    8
    Likes Received:
    0
    iCatButler
    Is it possible to call the "Reduced Triangle Culling" feature in some sense an analogue of the tessellation? After all, judging by the screenshots, the final result is similar to tessellation - the models are more detailed.
  15. TheDimensioner

    TheDimensioner New Member

    Messages:
    260
    Likes Received:
    68
    Hah, the "widescreen cheat" for Crash 3 works!
    Show Spoiler
    Although there are much more issues than with the hack XD. The area shows more on the sides on some parts, but there are those sudden stretches of the characters and camera hiccups. The UI is also stretched, unlike with the widescreen hack, although it's only for this game.

    I "forced" 30 FPS for this recording, that's why the music plays faster sometimes. Isn't there a 60hz code for the PAL version of this game? Like I said in the Tweak's thread some times, PAL versions have less overscan, or none at all, generally showing a little more of the screen. But they're mostly 25/50FPS, which I'm not used to. So a hack or a patch for 60hz would be nice.
    Last edited: Aug 10, 2016
  16. iCatButler

    iCatButler New Member

    Messages:
    106
    Likes Received:
    187
    The default behaviour of the PlayStation is a sort of reverse tessellation, or implicit mesh simplification. This image illustrates what's happening quite well.
    Show Spoiler
    [​IMG]

    All the triangles are being transformed but the low precision results in many vertices of small triangles getting the same position. This causes those triangles to collapse into lines or points, becoming degenerate, with an area of zero.
    You can see this happening in the image where groups of small triangles form simple squares, two or three triangles stretch as their vertices snap to the same few points while other triangles disappear altogether.

    The PlayStation's GTE has a function to cull these degenerate triangles called NCLIP which also removes triangles that are facing away from the viewer (back-face culling). As PGXP calculates and stores vertices in high precision the implicit simplification doesn't happen but the default NCLIP behaviour still results in small triangles, that would have become degenerate, being culled. This is because the emulated game expects a low precision integer value which will be truncated to 0 for many small triangles.

    To solve this PGXP calculates its own NCLIP result in high precision and then intentionally skews the results so that values that would become 0 are now rounded up to 1 or -1 before passing it back to the emulator. So technically, rather than creating more triangles from a mesh, it is preserving existing triangles that would otherwise be simplified out.
    Last edited: Aug 10, 2016
    curryking3 likes this.
  17. tem_luap

    tem_luap New Member

    Messages:
    8
    Likes Received:
    0
    iCatButler
    Thanks for the exhaustive answer.
  18. TheDimensioner

    TheDimensioner New Member

    Messages:
    260
    Likes Received:
    68
    Showing Resident Evil: Survivor. This time I made 2 videos, one with PGXP and other enhancements (xBRZ and shaders), and another without PGXP and no enhancements (besides high internal resolution). I think this game is great for showing PGXP, because it has many detailed textures in the walls and floors. Without PGXP, the slightest movement of the camera distort everything, and on cutscenes, you can really see how bad the character models "tremble" (the last custcene in the no PGXP video is the worse). "Memory only" mode works very well here, although there are still some parts where the floors will "auto-align" as you walk on them, and also some "stair loading screens" with wobbly steps.

    Resident Evil: Survivor, PGXP enabled


    PGXP disabled, no enhancements


    @iCatButler, if it interests, you could use these two videos on the first post, because I think they show really well what PGXP does. I know it would be best if it were one video showing each footage side-by-side, but I don't know how to do that XD. I'm not suggesting this for views or anything, I just think that PGXP is great, and it has to be known by its greatness (also you as the author :D)! A better game would attract more attention though XD.
  19. curryking3

    curryking3 New Member

    Messages:
    41
    Likes Received:
    11
    TheDimensioner likes this.
  20. TheDimensioner

    TheDimensioner New Member

    Messages:
    260
    Likes Received:
    68
    GTA 2 doesn't work with PGXP XD. I was thinking if this was similar to DOOM, as it's not actually 3D, but using "Mem + CPU logic" mode stretches everything, like it did with most games I played before, so maybe the buildings are 3D.

    PGXP "Memory only" mode:
    Show Spoiler
    pcsxr0001.png pcsxr0002.png
    PGXP "Mem + CPU logic" mode:
    Show Spoiler
    pcsxr0003.png pcsxr0004.png
  21. Reventon2010

    Reventon2010 New Member

    Messages:
    68
    Likes Received:
    7
    Does the Perspective Correct Texturing not work with GTA? Those textures are so wobbly lol

Share This Page