-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sega rally desert stage bug #201
Comments
Duplicate to this issue: #199 |
Which build did you use for testing? |
Git revision 161f1e3 (2024-09-30) built for 64-bit Windows. |
Try changing resolutions, see if it happens at one in particular. Does this bug happen on only the latest Supermodel build, or have you tried an older build? |
It's happening on the latest build and the previous one on a 1920x1080 display only, it's working fine on every other display settings.. |
As a temporary fix you could try setting the resolution to 1920x1079, that should get rid of the vertical line |
Will do, thank you. |
Seems like this issue has been around for quite some time at least |
I've discovered that this bug only occurs when using the quad renderer; with the triangle renderer it looks fine. The vertical line is a gap in the skybox model which shouldn't be there as there are no gaps between polygons. There must be some quirk of the quad renderer that is drawing the polygons a tiny bit smaller than they are supposed to be. |
Thanks, that helps. I'm currently looking at the code again and already saw some spots where things could be simplified, hopefully improving precision. |
The line at the top I'm sure is a precision issue with the quad renderer. The attribute interpolation on the edge is bad. I had problems like this with my original code and my fix was to use double precision maths to calculate the area of the poly. Of course this doesn't play well with older hw. |
Maybe i can tweak it once more, maybe also helping the old Harley problem, too. |
@dukeeeey Can you please point me to games/scenes where the
can be seen in action? Cause i struggle at the moment to find anything where simply commenting out that discard does change anything. |
It kicks in if the polys are non planar, by culling the edges. If you rotate a non planar quad you'll see what it does. I mean it might not be totally accurate to how quad drawing works on the actual model 3. Games definitely render non planar quads. VF3, scud etc |
Okay, thanks! btw: In triangle mode, the road also features that line (if in the intial cam/view mode). |
Is the method based on this one? https://www.inf.usi.ch/hormann/papers/Hormann.2004.AQR.pdf |
Yep that's it |
I just resurrected the original double based GS-code, but there the line also appears. :/ |
Hmm that sucks. I'll give it a debug at some point. Unfortunately fragment shaders are quite hard to debug. I normally look for NaN or any values which are out of expected range. Can normally pin point the problems that way but it's a little tedious. |
Yup, i also tracked down one issue: Seems like there is cancelation by 2 (or more) large t[] values leading to flaky signs, leading to the discard. So a hack (that works pretty well though if one outputs the effect itself for various games) is to skip the discard if at least one abs(t[]) was 'large enough'. This fixes things on my NVIDIA gpu, the Intel gpu though still has the upper part of the line, and that one seems to be due to another reason. :/ |
oh, and btw: Harley also shows this issue if in first person view (only the lower part of the problem though, so there the hack above also works). |
..which is only true on my NV board, Intel doesn't feature it :/ |
@dukeeeey Do you know which quadrilateral cases Real3D did support? EDIT, NOT TRUE, SORRY: Cause if i disable the +-+- cases (so where 2 of the quad vertices are 'flipped' leading to this bow tie like geometry) then this also works. It would also improve the harley sky issue. Seems like the issue is rather thin/long geometry where the precision issue flips the signs of two edge tests. EDIT: Note that bow ties also were not handled correctly before by the code, as the ---- case was not checked. Was this done intentionally (cause the accompanying comment claims that this should be checked, too). |
Honestly we don't really know exactly how the quad rendering worked on the model 3. But given the age of the hardware, I would assume it's similar to how the nintendo DS renders quads. In the paper you referenced look up "two-fold linear interpolation". I'm pretty sure that is how it would work. But I don't know how it handles the edge cases, ie twisted etc. There are quite a few non planar quads being rendered, but not so many twisted. Maybe the only ones I can remember from testing were on the cars in sega rally 2. It has some crazy quads. |
Some extra info here that might be interesting: https://melonds.kuribo64.net/comments.php?id=56 But the current quad renderer has been fine except in the most extreme of edge cases. Removing the edge culling doesn't really fix the issue for me either because the texture coordinates are wrong at the top part. Probably throwing some more precision at the problem would fix it. I never really cared that quad rendering was expensive on lower end hardware because it needed at a minimum gl 4.5 h/w to work anyway. |
I will not give up yet. ;) Cause its not just older HW/GPUs, that would of course be okay, if fp64 is slow there. But its also the case for recent integrated Intel GPUs, maybe integrated AMD GPUs, too (still have to verify). In addition, i did not even find a working solution so far if going full fp64 for that 'top part' issue (which is also only there on my Intel setup). But so you think its okay to ignore bow ties? As said, before these were also broken. I would then continue to hunt for the other issue where that comes from. |
Yeah double is extra slow on older hardware because it lacks double support entirely, so it's emulated with extra instructions.
I mean it's not a deal breaker certainly. I don't think it would negatively effect the emulation. Part of my own motivation is I wanted to make a quad renderer work in all cases, even if it wasn't entirely arcade accurate. Certain things in supermodel work better than the original h/w, and that for me is fine as long as everything works as expected. If you read the paper you'll see with some quads if you rotate them, actually you get a different result with two folder linear interpolation method, which actually is less than ideal. Polys shouldn't distort when you rotate them. So the method in supermodel is way better. This is where mame makes sense, writing this sort of rasteriser in software is way easier, and could be done fast. Mapping proper quads to triangles with fixed function hardware is not a trivial task. An alternative approach would be to write the whole renderer with a compute shader, but that a complicated project that is probably beyond me. |
I'm also all-in to improve the quality vs the original HW if possible. So the improved interpolation and handling of special cases more robustly is definetly awesome! But the problem even with a software/scanline rasterizer would still be to determine how the original HW did it, as the special case quads could either be handled like the DS did (=some form of broken), not at all/ignored, like if e.g. the flip was not there (so reordering the vertices), or even just correct (although the latter is unlikely). Cause it could also well be that these are just results of screw ups/bugs and the HW may have ignored them or rendered differently, so that would also lead to a 'cleaner' image then in Supermodel. I will do more experiments and try to explore more of this bugs original issue and hopefully also about the quad special cases. |
I tested an older build of supermodel before the reverse Z was added, and well it doesn't have this issue. Also the issue roughly is the the interpolated area is coming out as zero on the edge pixels at that particularly camera location. And some further down where the interpolation is also bad, I guess it's coming out very close to zero. I wonder if doing the 1/w in the fragment shader instead of the geometry shader would fix this |
Hmmm.. You mean there is no crack whatsoever, or the most upper and the road issue is not appearing there? |
5fa402f did change the behavior |
…Rally2 and HarleyD fixes/improves trzy#201
…-case support for twisted/bow-tie quads ..and align triangle code more to the quad code for easier comparisons also generalize mipmap0-only optimization to all non-blended cases related to trzy#201
I am not sure if any of these commits actually 'fix' the issue. If you make the viewport 1 pixel smaller the issue goes away. It's probably some corner case with the maths. I'd like to see if I can extract the bad poly and debug the render pipeline in software, to see if the situation can be improved. I suspect it probably can happen in other places. But your commit using floating point viewport values is interesting. Obviously opengl doesn't support fractional viewport values. Some games the viewport height comes out to 383 instead of 384. I am not sure whether these should be rounded or not. Kinda hard to tell on original hardware. But daytona has some issues with some of the smaller viewports leaving a gap at certain resolutions. I wonder if this would fix these. I suspect it might. |
True, but note that predating the changing commit in question this was also the same (so without the widescreen check), could for example be spotted when starting the race but not accelerating. So in some sense my commits do not really fix all things, but at least they should help improve/stabilize things further. Plus it fixes things for a super common use case (FullHD, but no widescreen). Most of my comments above (except for the bow tie one, this did not hold up in my experiments) also are still true. So the edge test/discard is still prone to precision error in general. This one i'm still experimenting with, but wanted to get the rest out of the door, also for easier comparisons later-on. |
Test program I wrote sometime ago to test quads. Keys are Press 'R' to reload shaders Press: Maybe you'll find it useful. I have the full source code somewhere if i can find it lol |
Nice, thanks! Source would be nice, but if one can reload shaders that should be good enough for experiments! |
I might have lost it lol. I'll see if i can find, but yes it should support hot reloading of shaders, Just press R to reload. |
JSYK: I just copypasted the modified code from the PR to see if all still works also in your small tool with the special cases, and yup, all good there, too. |
@dukeeeey How to progress here then? I think my 2 PRs are okay as-is, as at least they should improve things/precision in general (but also while not fixing it once and for all :/). |
You've got some great changes in there. I will get around to adding them but just unfortunately v busy with real life stuff atm, but will get to them. |
Is the line fixed? |
Having read this thread I'm gonna say no. |
The issue in here is fixed (with the outstanding PR(s)), but a general solution is outstanding. |
@dukeeeey Did you find some time to look at the 2 PRs by now? |
yes a little time. I will definitely pull in some of the changes, bear with me :) |
no problem! i just want to get this resolved before i forget most of the details again ;) |
I will review this on Wednesday for sure!
… On Nov 4, 2024, at 5:55 AM, toxie ***@***.***> wrote:
no problem! i just want to get this resolved before i forget most of the details again ;)
—
Reply to this email directly, view it on GitHub <#201 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJZ3RLLEWPX3YVRU2ULFTDZ654GTAVCNFSM6AAAAABPGU3PMKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJUG44DCMZVGM>.
You are receiving this because you are subscribed to this thread.
|
Any luck with the line? |
@Garagefreek I didn't test yet, but the newest build should improve the situation again, at least for this case. |
I am using d043dc0 |
Yeah and this time it's running right down the screen behind the car which wasn't the case with previous Gits.? |
Does this happen with older builds? If not can anyone identify which build it breaks? |
The break seems to appear here, |
The beginning of the race there’s a vertical line at the centre of the screen then disappears when you start driving?
The text was updated successfully, but these errors were encountered: