Nico de Poel
861b06f2d2
Updated map files with UVs fixed for repeating textures.
3 years ago
Nico de Poel
87c5517bdd
Swap texture window only when the twin value changes.
Further reduces texture window commands, especially when drawing non-tiling faces.
Also cleans up the drawing code a bit.
3 years ago
Nico de Poel
7c0c15019c
Swap texture window only when the texture changes between faces.
Saves a bit on performance, though could be even better if we checked for texture window changes instead of texture ID.
3 years ago
Nico de Poel
5bd322d33b
Use texture windows to allow repeating textures on select faces.
This reduces polycounts and file sizes significantly, at the expense of more texture warping and less refined lighting.
3 years ago
Nico de Poel
1c4bd55cdb
Added a front frustum plane which isn't really used for anything yet, but it could be interesting for testing different depth culling approaches.
3 years ago
Nico de Poel
2122ae3421
Use face bounding quad to check if it may be partially inside the frustum, and force tessellation if it is.
I really don't like the additional CPU load required to do this, but it is necessary to reduce the amount of near-camera polygon clipping.
3 years ago
Nico de Poel
5ecf96428d
Use catPrim and addPrims to add the tessellated quads to the OT in a slightly more efficient fashion.
3 years ago
Nico de Poel
2167011f96
Commentary and TODOs
3 years ago
Nico de Poel
de12999cbb
Minor rearrangement for "readability"
3 years ago
Nico de Poel
2a3a8108f3
Removed the nop's before the INTPL instruction as they don't seem to be necessary.
Real hardware is fine with this too.
3 years ago
Nico de Poel
abc328430c
Undid some of the rearrangement that made the code not want to run on real hardware.
Doesn't make any difference for the optimizations made so far.
3 years ago
Nico de Poel
4e39f28228
Made use of the fact that we use monochrome lighting to combine light and UVs into a single lerp
3 years ago
Nico de Poel
07f87c4ca2
Made a custom vertex lerp macro using pure GTE assembly code
3 years ago
Nico de Poel
909b32f4c0
Some rearrangement that will hopefully allow single light values to be lerped right alongside UVs, saving on one lerp per vertex.
3 years ago
Nico de Poel
d7ec9a85a4
Interpolate vertex color and UV values using GTE instructions as well
3 years ago
Nico de Poel
cdc205f59a
First successful experiment with vertex interpolation using GTE intpl instructions.
3 years ago
Nico de Poel
7888f44bb8
Revert "Intersperse GTE instructions with vertex lerping and quad building code to mask load/store delays."
This reverts commit 4f886bd40c .
Rolling back to simpler code to facilitate conversion to GTE interpolation.
3 years ago
Nico de Poel
4f886bd40c
Intersperse GTE instructions with vertex lerping and quad building code to mask load/store delays.
Makes a noticeable difference in drawing performance.
3 years ago
Nico de Poel
e0e43d6e39
Reordered some vertex code to allow for optimized GTE load/stores
3 years ago
Nico de Poel
58b2e8dc20
Wrapped vertex copying code into a macro to make the quad drawing code more readable.
Added some generic n-bit blitting macros and started using them.
3 years ago
Nico de Poel
02b19a67dc
First implementation of near-camera polygon tessellation, which surprisingly actually worked on the first try!
Currently still rather inefficient, making no use of GTE for interpolation yet. Still only one tessellation level too.
3 years ago
Nico de Poel
c08858eb90
Updated map files with lighting issues fixed
3 years ago
Nico de Poel
9474739c26
Sort faces for brush models into the overall faces list.
This works well to draw models correctly by themselves, but when placed in the world they may still have clipping issues with other models and/or neighboring leafs.
3 years ago
Nico de Poel
ba1e384f69
Keep track of the leaf a model is in, so that it doesn't need to be looked up every frame but instead only when the model moves.
3 years ago
Nico de Poel
fd77b80afc
First implementation of dynamic world object (model) rendering.
Still very basic, with plenty of sorting and clipping issues.
3 years ago
Nico de Poel
090cde5f89
Included face area value in tessellation LOD level calculation.
Could probably use some more finetuning in practice, but this is already pretty good.
3 years ago
Nico de Poel
4f92d4c7e3
Getting close to a formula for determining tessellation LOD that takes camera position, direction, face normal and distance into account.
Still need to involve face area into this as well.
3 years ago
Nico de Poel
916d20a5db
Display PAL and NTSC on the debug status text, making it easier to distinguish what we're outputting when.
3 years ago
Nico de Poel
5442b2d4c9
Added a draw function for flat colored quads, useful for debugging
3 years ago
Nico de Poel
21101b3287
Added a special case for drawing faces that are single triangles.
This is just as fast in DuckStation and shows a small performance increase on real hardware, so worth the effort.
3 years ago
Nico de Poel
3b89d01ec1
Embedded the texture atlas data inside the .ps1bsp file and name those files after the actual map.
Makes it a bit easier to switch between maps for testing, and this is the kind of direction we want to go in anyway.
3 years ago
Nico de Poel
ef0d2ad723
Changed dot product and point-plane distance functions to use vector pointers as input.
Matters nothing for performance, but it does lead to some slightly cleaner and more consistent code.
3 years ago
Nico de Poel
4146238e1e
Moved frustum planes to fast scratchpad RAM for another appreciable speed boost.
3 years ago
Nico de Poel
a7e29ee420
Fixed issue with model data memory alignment, officially using model #0 now to draw the static world geometry.
3 years ago
Nico de Poel
de12e4269f
Minor stuff
3 years ago
Nico de Poel
2cb5bcb856
Added support for setting the clear color to a generic sky color.
This is very basic and it does exacerbate the gaps between polygons on some maps, but at least we get to have something of a sky.
3 years ago
Nico de Poel
26d541e48f
Eliminated recursion from the BSP traversal, using fast RAM to hold the node stack. Yet another appreciable speed boost.
3 years ago
Nico de Poel
520e62922c
Perform backface culling early to save on a bunch of needless linked list iterations.
Moved primitive buffer check and generalized it. It's fine to only check for the worst case scenario.
3 years ago
Nico de Poel
32237fc6ec
Fixed a few issues and further optimized the quad drawing code.
3 years ago
Nico de Poel
4f2d70cc82
Added some macros to make the optimized drawing code more readable, and applied the same optimization to water drawing.
3 years ago
Nico de Poel
74a36f0938
Found a 10% performance boost by simply reordering data access when filling in polygon data, and by blitting UV and RGB values with a single copy.
3 years ago
Nico de Poel
38e91f4c3a
BSP file now includes model data for dynamic world objects
3 years ago
Nico de Poel
97d23f0bc9
Removed unused texture metadata fields. Only the texture page and precalculated per-vertex UVs are needed to draw textured polygons.
3 years ago
Nico de Poel
542a81b68c
Draw lava, slime and teleporters as liquids, but not transparent.
3 years ago
Nico de Poel
314b52e99e
Added a separate CLUT for transparent surfaces, and set semi-transparency mode on water polygons.
3 years ago
Nico de Poel
ae080953f7
Rewrote the other face drawing functions to ditch the vertex copying stage too.
3 years ago
Nico de Poel
be7eb87685
Ditched the copy-to-scratch-RAM step for drawing textured faces, which apparently is no longer needed to run on real hardware.
Simpler code, less work to do, better performance. An all-round win.
3 years ago
Nico de Poel
ba83d78aa8
Removed the need for global variables for sorting leafs and faces
3 years ago
Nico de Poel
4d138b4199
Added an extra face sorting step so we can draw faces in front-to-back order:
- Nodes are traversed front-to-back, leafs are sorted back-to-front
- Leaf faces are collected back-to-front to ensure faces shared between leaves are drawn in the correct order
- Faces to be drawn are then sorted front-to-back and drawn in that order
- This obsoletes the need for any kind of depth calculations, and makes the primitive buffer cutoff work as intended
3 years ago
Nico de Poel
a8d3bf567b
First pass at leaf-based rendering order:
- Sort leafs first into a linked list, before drawing their faces
- Depth value for faces is determined by the leaf order, OT position is calculated once per leaf
- Removes the need for per-primitive depth calculation & check, so those are removed
- Moved primitive buffer check out of the primitive drawing routines and to the start of each face drawing function
- Triangle drawing routines now only draw a single triangle, no loops involved
- Simplified drawing routines where possible
- Face drawing is still happening in back-to-front order, so this needs another good look at
3 years ago