Commit graph

45 commits

Author SHA1 Message Date
gm-matthew 3cf8a1fa94 Implementing texture NP values
For some reason Model 3 uses vertex coordinates rather than texel coordinates to calculate mipmap levels
Revised microtexture implementation; results are very close to real hardware when running at native resolution with supersampling disabled
2024-07-05 15:57:25 +01:00
Ian Curtis edb11dc223 Performance improvements
The old texture code was being bottle necked by the texture reads. We mirrored the real3d texture memory directly, including the mipmaps in a single large texture. I *think* most h/w has some sort of texture cache for a 2x2 or 4x4 block of pixels for a texture. What we were doing was reading the base texture, then reading the mipmap data from a totally separate part of the same texture which I can only assume flushed this cache. What I did was to create mipmap chains for the texture sheet, then copy the mipmap data there. Doing this basically doubles performance.
2024-06-13 13:36:30 +01:00
Ian Curtis 8778f98c4a Add missing edge on transluency function 2023-11-17 15:50:04 +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
toxieainc 4961951a89 fix a real error (m68kdasm) and some harmless performance warnings and use modern headers 2022-07-11 18:10:41 +02:00
Matthew Daniels 9ffce8b92a Getting rid of most of the includes from Supermodel.h; each file now explicitly includes the header files it needs.
Making changes to a header file should no longer force the entire project to recompile.
2021-11-22 17:15:06 +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 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 7497e3f1a6 forgot parentheses 2018-05-29 14:54:23 +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 2af58f4352 select correct bit .. 2018-05-24 20:19:54 +00:00
Ian Curtis 8452d4c0ef Parse out TranslucencyPatternSelect 2018-05-24 20:13:15 +00:00
Ian Curtis 8e13c3bbb9 Finish the hash function (Harry Tuttle) 2017-10-19 20:48:53 +00:00
Ian Curtis 0afd9026dc Fix the sky in one of the levels in virtua on. The problem was caused by the fact we didn't split the mesh by the fog % burn through, so all the polys had the same value. We could use a vertex attrib, but % burn through fog is so rarely used and when it is, normally every poly in the mesh has the same value. 2017-09-26 00:30:08 +00:00
Ian Curtis c12e4c3215 Fixed shading (per vertex poly colours) on step 1.5 hardware have the viewport ambient value added to them. This fixes various shading on scud. To do this had to switch the maths to the vertex shader. 2017-08-14 09:14:06 +00:00
Ian Curtis 5709ee2659 Sometime ago I managed to work out that specular on the model3 is not real specular, and really is just an extension of diffuse lighting. But attempts were derailed by corner cases and the fact we were not handling the normals correctly. Anyway Harry managed to successfully come up with an algorithm, and coefficients that give an almost perfect match to specular on the model3, based soley on observations from video footage! He also worked out that the lighting on hardware 1.5 onwards appears to be unclamped (ie greater than 1). This quite radically changes the brightness of some of the games, but much better matches the original hardware. 2017-08-09 16:56:56 +00:00
Ian Curtis 3c78571615 There are 2 bits in the polyheader labelled discard. When both are set ie in sega rally, the polygons are totally discarded. Scud seems to set bit 1 which seems halve the opacity. 2017-04-15 19:00:46 +00:00
Ian Curtis edfb521a9b Daytona seems to use this completely undocumented feature of the real3d pro-1000, the ability to invert texture colours. This patch fixes the colours on the cars, and the signs which should flash by alternating their colours. 2017-04-05 17:57:38 +00:00
Ian Curtis 5b9741bd5d Support high priority polygons. They are treated as a separate overlay plane by the h/w. Fixes some missing fx in harley. 2017-02-20 17:22:32 +00:00
Ian Curtis 2ae2010ee4 Add high priority poly function. Used by harley. 2017-02-18 23:58:08 +00:00
Ian Curtis 4a116190b5 When the translator map?? bit is enabled the colour format seems to be 4-5bit. Max observed value is 16. Scaling these values up seems to produce the correct colours in harley and dirt devils. 2017-02-16 17:20:42 +00:00
Ian Curtis 2c23268d88 Support microtexture relative scale. The exact scaling values are not known, but a 2x difference between each level seems highly likely. We know from visual inspection from scud that the first level is exactly 4. The SDK has a function that accepts a float input for scale and does this. lod = (1/scale) + 0.5. If lod>3 lod = 3. So this is our best guess. 2016-12-09 14:13:46 +00:00
Ian Curtis c3581c9fe8 Support multiple microTextures, fixes crazy texturing in sega ski champ. I'm assuming microtextures are always located on the other memory bank to the base texture. This logic seems to work for all our games anyway. 2016-10-06 01:37:29 +00:00
Ian Curtis 9bc1fbf0cb remove dead code 2016-06-02 21:26:50 +00:00
Ian Curtis ff8e9d6aad Check for overflow. Fixes some fade effects 2016-05-30 23:10:56 +00:00
Bart Trzynadlowski 5c1a240565 New engine: expanded color indices to 12 bits from 11. Added PolygonHeader::ColorIndex and SensorColorIndex methods. 2016-05-28 20:49:10 +00:00
Ian Curtis 661f19be19 fix transparency values, values are from 0-32, not 0-16 where the top bit disables 2016-05-27 22:20:57 +00:00
Ian Curtis 2086b1c9af Stencil layered polys, fixes shadow z fighting in some of the games. Other games maybe using stipple alpha (yuck), not sure yet. 2016-05-27 19:30:40 +00:00
Ian Curtis 9e279a0c1f Non luminous polygons seem to be effected by the lightModifier also. API seems to have no restriction in this regard, neither does the SDK. The ocean hunter requires this for some of the 2d stuff. Light modifier values only seem to exist between 0-16, which is strange for 5 bits of precision. Possibly top bit disables the effect and lower 4 bits are the value. This clearly differs from the SDK, but without this the values come out clearly wrong. 2016-05-16 10:49:00 +00:00
Ian Curtis bc08276d60 preliminary specular 2016-05-15 16:24:49 +00:00
Ian Curtis e295ad6868 double up polys for two sided polys, fixes some diffuse lighting problems 2016-05-13 08:39:48 +00:00
Ian Curtis 69a44a5d5f add texture helper functions 2016-05-07 18:57:06 +00:00
Ian Curtis 05e1e4de37 update poly header class 2016-05-06 15:00:12 +00:00
Ian Curtis b2da849d90 support flat shading 2016-05-05 00:01:17 +00:00
Ian Curtis c545b9fd85 preliminary microtexture 2016-05-04 00:35:07 +00:00
Ian Curtis c459772f8e wrap invalid texture sizes, seems to fix bad textures in srally2 (skid marks) 2016-05-01 19:52:02 +00:00
Ian Curtis 23a5839d46 Daytona seems to use 3 bits for texture transparency, will figure it out later but for now this works 2016-04-30 09:02:38 +00:00
Ian Curtis c499e6640c fixed shading code 2016-04-29 23:03:46 +00:00
Ian Curtis 09e27e3082 color flag 2016-04-27 16:42:31 +00:00
Ian Curtis 3e8439c09c fix model normals, add code for fixed shading, as of yet flag to turn it on is unknown 2016-04-26 09:06:48 +00:00
Ian Curtis 3bc2794b0a Use the correct texture enable bit 2016-04-03 16:10:40 +00:00
Ian Curtis 4992e59673 Cache rom models, for better performance. 2016-03-26 22:44:26 +00:00
Ian Curtis 0327db246f WIP 2016-03-24 13:17:17 +00:00
Ian Curtis 93f6b01e0b Update project to vs 2013. Clean compile warnings 2016-03-22 12:30:23 +00:00
Bart Trzynadlowski 34301e97e1 Adding new 3D engine by Ian Curtis. Old engine moved to Graphics/Legacy3D/. 2016-03-21 04:10:14 +00:00