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
Ian Curtis
6595b9320e
Rewrite the renderer a bit to spit out the finished graphics from the 3d chip on separate buffers. One buffer is for opaque pixels, and 2 more for translucent pixels. Before the frame was composited on the back buffer, which meant the tilegen had to have been drawn first. This way the images are now totally independant of the tilegen chip so can be drawn as soon as the register write 0xC is written to the tilegen.
...
Some games update the tilegen after the ping_ping bit has flipped at 66% of the frame, so we need to split the tilegen drawing up into two stages to get some effects to work. So having the tilegen draw independantly of the 3d chip can make this happen.
2023-10-14 20:05:00 +01:00
Ian Curtis
d656643087
gm_mathew worked out that the camera flashes in sega rally 2 have the 'reset-matrix' attribute set inside the culling nodes, which was unsupported until now because we never found any games to have used this bit. The reset matrix is a bit strange, I would assume it would just reset the matrix back to identity, instead it seems to just reset the rotation back to identity whilst preserving the scale/position.
2023-09-27 16:33:53 +01:00
Ian Curtis
57ead6037d
Better opengl resource allocation. Fixes going fullscreen and back.
2022-12-17 23:46:02 +00:00
Ian Curtis
40c8259130
Rewrite the whole project for GL4+. I figured if we removed the limitation of a legacy rendering API we could improve things a bit. With GL4+ we can do unsigned integer math in the shaders. This allows us to upload a direct copy of the real3d texture sheet, and texture directly from this memory given the x/y pos and type. This massively simplifies the binding and invalidation code. Also the crazy corner cases will work because it essentially works the same way as the original hardware.
...
The standard triangle render requires gl 4.1 core, so should work on mac. The quad renderer runs on 4.5 core. The legacy renderer should still work, and when enabled a regular opengl context will be created, which allows functions marked depreciated in the core profiles to still work. This will only work in windows/linux I think. Apple doesn't support this.
A GL 4.1 GPU is now the min required spec. Sorry if you have an OLDER gpu. GL 4.1 is over 12 years old now.
This is a big update so I apologise in advance if I accidently broke something :]
2022-11-07 21:33:01 +00:00
toxieainc
e644751f01
after clarifications, minor cleanup
2022-10-10 16:35:02 -07:00
toxieainc
75771b3d14
remove 2 dupe function calls, where ProcessLos should actually be rather costly
2022-10-10 16:35:02 -07:00
toxieainc
5f97e5af6c
address review
2022-10-03 17:59:59 -07:00
toxieainc
519d695f57
address review and move bit casts to new header
2022-10-03 17:59:59 -07:00
toxieainc
22ffb5cc19
Harmless math warning fixes. map->unordered_map in CNew3D::CacheModel. Avoid general aliasing problems (using bit_cast or the recommended/optimized-away memcpy).
2022-10-03 17:59:59 -07:00
Ian Curtis
0ef90899e1
Double buffer the line of sight values. Should allow the correct values to be returned if GPU threading is enabled.
2022-01-02 12:48:09 +00:00
Ian Curtis
75f8ee61a3
fix missing polys with quad renderer
2020-09-14 20:01:52 +00:00
Ian Curtis
38c3ff61f9
Clip scroll fog to viewport, instead of filling entire screen. Fixes fog bug in Daytona credits.
2020-09-08 09:10:24 +00:00
Ian Curtis
aaa26f678c
Update scroll fog logic. Should fix the credits in virtua fighter and daytona that have fogging applied to the background layer and shouldn't.
2020-09-07 16:25:18 +00:00
Ian Curtis
6f6c98c671
The translator map seems to work with paletted colour values too, and the result is not clamped. Colours are passed to the GPU as unsigned bytes to multiplying by 16 will overflow, so we do the logic in the shader. If we passed floats we could skip the shader logic.
2020-05-11 09:05:46 +00:00
Ian Curtis
e2ad593e88
When the translator map is enabled the colour values seem to use 4 bits, 0-16. Why not 0-31 I don't know. Anyway virtua on is overflowing these values for some of the smoke effects. For us the numbers were wrapping around. Clamping is enough to fix this. (Thanks model123)
2020-05-07 19:34:22 +00:00
Ian Curtis
5ace960f14
tweak value so the map indicator still works at the start of spikeout
2020-01-04 18:15:30 +00:00
Ian Curtis
6b8a29105a
Sutherland-Hodgeman clipping only works for planar primitives. Scud is rendering non planar quads and this breaks our algorithm a little when using the quad renderer. Stretching the near plane a few % is enough to fix it.
2020-01-04 13:48:14 +00:00
Ian Curtis
d711afade1
Only need to clip against 4 planes for poly culling
2020-01-04 13:45:55 +00:00
Ian Curtis
06688de5fc
Really should cull against 5 frustum planes.
2019-11-15 20:00:25 +00:00
Ian Curtis
06b43c45b3
Ocean hunter in the middle of the game is passing a few matrices with FLT_MAX inside them, which blows apart our near/far calculation. The hardware must have some method to sanitize the near/far for instance if you render something extremely close to the origin you will also blow apart any near/far calc.
2019-11-02 20:11:48 +00:00
Ian Curtis
714f6a123a
skip invalid culling nodes
2019-07-28 12:14:13 +00:00
Ian Curtis
17f4103123
A culling node must follow immediately after a viewport.
2019-07-26 16:39:58 +00:00
Ian Curtis
8094c2e2b7
Composite the alpha layers at the end of rendering. To do this we need to mask the alpha pixels with the opaque pixels from the next priority layer. Fixes some overlapping shadows in vf3tb that have different priority layers. I assume that was a game bug, but it works on the real h/w.
2019-01-21 14:30:42 +00:00
Ian Curtis
bf4d725970
Smooth texture repeat makes no sense for alpha/contour textures with pixel dilate. HW seems to treat them as non smooth anyway. Also implement some line of sight stuff, used by Scud. Really need to check the threading/synchronisation of the register reads but it basically works.
2018-10-19 20:59:46 +00:00
Ian Curtis
42eaa7f3d8
fix copy paste error :]
2018-10-14 10:05:24 +00:00
Ian Curtis
3eeec35e7c
Correctly emulate the real3d pro-1000 texture modes in our shader.
2018-10-13 13:29:45 +00:00
Ian Curtis
3dbfa73734
Both lemans24 and dirt devils are rendering some totally transparent objects as the first model in each viewport. The HW seems to skip these entirely, and including them breaks our near/far plane calculations leading to Z fighting.
2018-09-19 20:43:41 +00:00
Ian Curtis
e3255e45f3
Tweak the ratio for the near plane. Fixes missing text on the map indicator at the start of spikeout. The vertices are 0.003 units apart so a tonne of precision is required at the near plane to not depth test out.
2018-09-18 21:46:38 +00:00
Ian Curtis
c5b156d95d
remove debug code
2018-09-18 21:20:15 +00:00
Ian Curtis
5dab9910e2
avoid double matrix load
2018-09-16 08:43:13 +00:00
Ian Curtis
b5f9ad9651
Quad rendering engine. Set QuadRendering = 1 in the ini file to use, or -quad-rendering at the end of the command line to use.
2018-09-13 12:50:34 +00:00
Ian Curtis
e4f5f0bcaf
Sega bass fishing is starting some off the meshes with a shared vertex. Without having a previous vertex to share with, the values were just uninitialised and junk. The hardware itself seems to hold the value from the previous mesh, and sega bass fishing relies on this undefined behaviour to function correctly. Storing the cached vertices as member variables instead of locally to the function means it holds the values from the last mesh, and uses those values instead of random garbage.
2018-09-02 21:36:24 +00:00
Ian Curtis
9f5a19a04a
Use correct PCI IDs (Harry Tuttle)
2018-07-09 08:06:06 +00:00
Ian Curtis
f9be1259c0
Opaque polys definitely depth test with less than or equal. Virtua striker is drawing co-planar polys for the bar gfx
2018-06-17 11:30:01 +00:00
Ian Curtis
c7ffd0a808
Draw transparent polys to separate layers and composite at the end. This solves a tonne of transparency errors we had been battling with for a long time. The model3 is strange in the fact it only supports a max of two translucent overlapped polys. They are not blended into the frame normally. Doing this means the topmost translucent polys only are visible in the scene, the equivalent of doing a depth pass first, but without the added cost.
2018-06-16 21:31:29 +00:00
Ian Curtis
f9f43ca66b
2018-05-28 12:55:13 +00:00
Ian Curtis
c1e0e3728b
optimise hash function and parse out transparency layer select bit
2018-05-28 11:59:48 +00:00
Ian Curtis
4d275ba49e
Parse siblings after children. It's the only way to get Daytona water fall to look correct without h/w poly sorting.
2018-05-03 18:37:49 +00:00
Bart Trzynadlowski
3f9b1b76e5
Added a stretch mode (-stretch) and modified new renderer's viewport code (hopefully correctly) to handle aspect ratio correction and widening the way the legacy one does.
2018-05-03 03:46:44 +00:00
Ian Curtis
c6b86c0812
Render the opaque part of texture transparency in the first pass. Fixes numerous transparency related issues in lemans24 and some in ocean hunter. I don't really know if this is the 'correct' way of solving this because the real3d pro-1000 is a complete black box. There is still a lot we don't understand about how it handles transparency.
2018-05-02 20:10:02 +00:00
Ian Curtis
d21e71dced
work around for non working jtag code in star wars
2018-03-21 10:26:05 +00:00
Ian Curtis
8266eecabb
Parse out line of sight position. Only known to be used by scud.
2018-01-15 21:27:21 +00:00
Ian Curtis
22a6166b82
fix Ian's bad maths :)
2018-01-15 13:08:39 +00:00
Ian Curtis
a1350d95a2
Update microtexture coordinate logic (Harry Tuttle)
2018-01-14 12:56:24 +00:00
Ian Curtis
863ea95013
simplify maths
2018-01-10 20:37:21 +00:00