Commit graph

1110 commits

Author SHA1 Message Date
Jacob Oxford 620a581227 No need to have changelog from 2011 in Readme.txt anymore. 2023-12-30 15:32:11 -08:00
Ian Curtis 75260f9f2c Clamp LODscale. If the object is drawn at zero we produce an Inf value which will produce Nans with later calculations. 2023-12-29 13:28:10 +00:00
Ian Curtis 0e07f29f80 Amend ambient fog logic
Should stop the sky flashing in lemans24, and the background totally disappearing in sega rally after a game. The logic here is still not totally understood but works well enough for the games.
2023-12-27 12:42:32 +00:00
Ian Curtis c039d08c03 Add supersampling anti-aliasing
Late christmas present. Due to the way alpha works on the model3 adding regular anti-aliasing doesn't really work. Supersampling is very much a brute force solution, render the scene at a higher resolution and mipmap it.

It's enabled via command line with the -ss option, for example -ss=4 for 4x supersampling or by adding Supersampling = 4 in the config file.

Note non power of two values work as well, so 3 gives a very good balance between speed and quality. 8 will make your GPU bleed, since it is essentially rendering 64 pixels for every visible pixel on the screen.
2023-12-26 18:25:03 +00:00
dukeeeey 33b84c89aa
Merge pull request #122 from gm-matthew/floatZ
Floating point reversed z-buffer and new clipping code
2023-12-22 17:06:35 +00:00
gm-matthew 6acb1165d4 Added new uniform bool polyAlpha to shaders
Added original matrix functions back into Mat4 class though they are currently unused
2023-12-22 16:31:05 +00:00
gm-matthew 9f66fcaac7 Floating point reversed z-buffer and new clipping code
Also always draw nodes with culling disabled even if they test as being outside the visible frustum
2023-12-22 02:00:47 +00:00
dukeeeey 6f409539a7
Merge pull request #120 from gm-matthew/patch
Fixed Scud Race Plus "ROLLING START" patch
2023-12-04 13:08:11 +00:00
gm-matthew 5b9e97008c Fixed Scud Race Plus "ROLLING START" patch
Accidentally patched the wrong memory location in Scud Race Plus
2023-12-04 02:33:00 +00:00
dukeeeey a19ba3cba8
Merge pull request #118 from firewave/uninit
Model3.cpp: avoid usage of uninitialized memory
2023-12-03 18:22:30 +00:00
dukeeeey 11e9b14e73
Merge pull request #117 from firewave/mismatch
Inputs/MultiInputSource.cpp: fixed mismatching allocation and deallocation
2023-12-03 18:17:12 +00:00
firewave 71e5baa61b Model3.cpp: avoid usage of uninitialized memory
```
==213531== Thread 20 SoundBoardNoSyn:
==213531== Conditional jump or move depends on uninitialised value(s)
==213531==    at 0x1A1D1E: CModel3::RunSoundBoardThread() (Model3.cpp:2607)
==213531==    by 0x49BECEA: UnknownInlinedFun (SDL_thread.c:292)
==213531==    by 0x49BECEA: RunThread.lto_priv.0 (SDL_systhread.c:76)
==213531==    by 0x4F719EA: start_thread (pthread_create.c:444)
==213531==    by 0x4FF5653: clone (clone.S:100)
```
2023-12-03 14:46:23 +01:00
firewave 1cc94b7d79 Inputs/MultiInputSource.cpp: fixed mismatching allocation and deallocation
Detected by Cppcheck:
```
Src/Inputs/MultiInputSource.cpp:87:3: error: Mismatching allocation and deallocation: CMultiInputSource::m_srcArray [mismatchAllocDealloc]
  delete m_srcArray;
  ^
```
2023-12-03 14:43:22 +01:00
firewave 5332d8f945 fixed some -Wunused-* compiler warnings 2023-12-02 14:27:32 -08:00
dukeeeey 391e1b9622
Merge pull request #113 from gm-matthew/handbrake
Dirt Devils does not use the handbrake
2023-12-01 17:08:09 +00:00
gm-matthew da62fa8640 Dirt Devils does not use the handbrake 2023-12-01 14:48:25 +00:00
Ian Curtis df0034ac1f fix minor error 2023-11-18 22:56:15 +00:00
Ian Curtis bd63400471 Optimise shader code (gm_matthew) 2023-11-17 22:22:50 +00:00
Ian Curtis 44fb32f2a9 fix compilation on linux 2023-11-17 18:03:40 +00:00
Ian Curtis cdf5e4b2b2 Fix transparency depth testing
The two transparency layers, might not be separate layers at all. We believe the hardware is writing each layer to every other pixel (stipple alpha), then using an anti-aliasing filter to effectively blend the pixels. Because the pixels don't overlap they don't depth test against each other. We are using separate layers to emulate this, so the depth buffer must be saved and restored between the layers.
2023-11-17 16:07:20 +00:00
dukeeeey de61835f14
Merge pull request #107 from gm-matthew/lod-blending
Implement LOD blending
2023-11-17 15:53:14 +00:00
Ian Curtis 8778f98c4a Add missing edge on transluency function 2023-11-17 15:50:04 +00:00
gm-matthew ac53101214 Implement LOD blending
If two translucent polygons with opposing patterns overlap the result is always opaque
Also the LOD scale calculation depends on Euclidean distance of x, y and z, not just z
2023-11-17 15:13:27 +00:00
Ian Curtis d726356006 Remove debug code 2023-11-13 23:19:18 +00:00
Ian Curtis 33d65e097f Merge branch 'master' of https://github.com/trzy/Supermodel 2023-11-13 21:17:15 +00:00
Ian Curtis efe3077f53 Fix some stencil issues
The stencil mask must be set to all 1s otherwise we can't clear all the bits in the stencil buffer. Also we no longer need to save/restore the depth buffer into between priority layers.
2023-11-13 21:17:06 +00:00
Bart Trzynadlowski 3022e418c7 Added some TODO notes to Main.cpp 2023-11-11 13:57:30 -08:00
Bart Trzynadlowski 47253d8398 Fixed graphics analysis -gfx-state option 2023-11-11 13:55:02 -08:00
Bart Trzynadlowski a57b379498 DSB.h: when generating a debug build in gcc w/ -g, k_framePeriod was causing a linker error. Not sure why k_timerPeriod wasn't but made them both constexpr. 2023-11-11 13:46:05 -08:00
Bart Trzynadlowski ccca9afceb byte_layout attribute for region tag, intended to support Sega Racing Classic 2 ROM extracted from Yakuza 2023-11-11 13:11:15 -08:00
Ian Curtis c40d6ac17b Rewrite the stencil buffer usage slightly, so both the LOS and layered polys work. LOS uses the top bit of the stencil buffer. Fixes some minor issues with draw order in sega rally. 2023-11-10 19:13:37 +00:00
Ian Curtis f9a0901e8c Fix regression
Scroll attenuation seems to disable ambient fog. If scroll attenuation is enabled it's telling the h/w to draw the real3d spot light on fog for the scroll fog layer. This should fix a regression where the background disappears on sega rally.
2023-11-09 18:41:57 +00:00
Ian Curtis a8976b51a2 typo 2023-11-06 10:56:39 +00:00
Ian Curtis a065df24b8 Correct scroll fog attenuation logic (gm_matthew)
The attenuation value effects the spot light on fog for the scroll fog layer. The old implemention was nearly correct but the paramaters for the mix function were swapped.
2023-11-05 23:44:27 +00:00
Ian Curtis aecf61762e Various fixes
- Scroll fog needed a break statement otherwise it could draw potentially multiples times.
- The fog atttenuation paramater doesn't appear to effect scroll fog, other than to potentially enable it. This fixes some issues with emergency call ambulance.
- Added support for the node discard attributes which sega rally2 uses to throw away specific geometry. This fixes junk that starts to show up in the levels after multiple runs.
2023-11-05 17:39:23 +00:00
dukeeeey 628eeebbc3
Merge pull request #101 from gm-matthew/lod-and-blending
Add LOD switching and blending out culling nodes
2023-11-03 19:56:17 +00:00
Ian Curtis 8dda8e9105 Fix the line of sight function.
Polygons have a line of sight value that's either a 0 or 1. We write this value into the stencil buffer, then read the app can read it back to determine the polygon attribute is visible or not. The returned value is 1/depth value in world coordinates. The first bit of the float is actually a control bit, 1 indicates no geometry hit, 0 indicates geometry hit.
2023-11-03 13:24:59 +00:00
gm-matthew 483dbdda2e Add LOD switching and blending out culling nodes
We're not blending between LODs yet as we're not sure of the best way to implement it
Also implementing control bits for disable culling and enable model scale (needed for ECA and Harley)
2023-11-02 14:16:07 +00:00
Ian Curtis 3a85bd9e25 remove debug code 2023-11-01 16:03:11 +00:00
Ian Curtis d16ba90856 Update comments for the culling node function. gm_matthew worked out that the last 2 bits of the model scale float appear to be control bits for disable culling and valid model scale. Strange logic but the line of sight (LOS) function does something similar by re-using float bits for control words. 2023-11-01 16:01:13 +00:00
Ian Curtis 37065ce478 Merge branch 'master' of https://github.com/trzy/Supermodel 2023-10-31 23:50:33 +00:00
Ian Curtis 8fea5bd3bf gm_mathew - the line scroll values, the top 16bits are the even lines, the bottom 16bits are the odd lines. We had it swapped. This fixes the number below the word results in daytona, when you finish a game. 2023-10-31 23:50:19 +00:00
Bart Trzynadlowski d42317db83
Update README.md to define GIF widths (for Safari) 2023-10-30 14:47:25 -07:00
Ian Curtis acab274526 Set language standard to c++ 17 2023-10-30 14:04:48 +00:00
Ian Curtis f89da17f17 Fix white gfx on linux / intel gpus. These optimisations originally came from toxieainc 2023-10-27 10:45:16 +01:00
Ian Curtis c5f9a3ad26 Amend the ambient fog logic to be disabled if fog density/start is set to zero. This fixes a regression where the sky stops drawing in lost world.
Rewrite the scroll fog shader slightly. Scroll fog is a 2d layer, it has no depth, or can be considered to be drawn at infinity, therefore is not effected by the viewport light. The scroll attenatuion value also I think attenatutes the scroll fog alpha value. This fixes various effects in emergency call ambulance.
2023-10-24 10:17:15 +01:00
Ian Curtis a214c6dae8 Prior scroll fog logic was nearly correct. For scroll fogging to draw it needs either a start value or a fog density value, but these can come from a different viewport if they have the same colour fog set. This fixes the credits in vf3 which sets scroll fog, but it never draws on the original hardware.
For a long time we've had bug reports that in vf3 the background in the Dural levels was the wrong colour, it should have been much darker. We thought it was again missing scroll fog, but gm_mathew worked out it was actually coming from the fogAmbient paramater. Not only does it darken the fog, but it also has an effect on the 2d background from the tilegen, similar to scroll fog. This also fixes the sky in lemans24.
2023-10-22 21:07:35 +01:00
Ian Curtis 2af0787279 Remove debug code 2023-10-17 17:33:26 +01:00
Ian Curtis 79ddc8c739 Rewrite the logic for the scoll fog (render buffer clear colour). Each viewport can potentially have a scroll fog value so the logic of which value to pick wasn't immediately clear. TLDR I think it picks the highest value starting from the lowest priority layers. This fixes the sky in daytona battle on the edge. 2023-10-17 17:30:14 +01:00
Ian Curtis 86d477263f Scroll fog is like a clear colour for the render target, but can be semi transparent as the tilegen layer can be shown underneath. I assumed that transprent polys would be drawn to the render target for transparent polys but unfortunately the logic does not work. So where else could it be drawn? Well with limited memory it must be draw to the buffer for opaque polys, which means this render target is also blended. 2023-10-15 17:16:52 +01:00