Nico de Poel
7205dbdc31
Loosened tolerance for vertex equality a bit more because wow, floats are really inaccurate huh? Fixes light sampling issues on E4M6 and E4M7.
3 years ago
Nico de Poel
552678f67c
Reduced amount of geometry artifacting from T-junctions by rounding repeating UVs down to a grid that will be shared by adjacent faces using the same textures.
Sacrifices some performance again, but makes both geometry and lighting look a lot more solid.
3 years ago
Nico de Poel
68eb9c10c8
Tessellate faces into bigger chunks when texture repeating is an option.
This is kept conservative at just 2x2 cell sizes, because bigger polygons with more repeats will cause more texture warping and geometry glitching. This is already the biggest gain.
3 years ago
Nico de Poel
eb3de1b624
Pack repeatable textures first, followed by other textures in the remaining space. This is actually producing more efficient textures atlases. The hell.
3 years ago
Nico de Poel
435b62f280
Reorganized the texture packing code to allow for multiple packing steps, with repeatable textures getting packed first.
3 years ago
Nico de Poel
83dbee34e5
Use GPC to get rid of redundant vertices on some faces, which will reduce a bunch of them down to simple quads. This makes for slightly less additional vertex data required when storing bounds.
3 years ago
Nico de Poel
7fd5f09a34
Add four bounding vertex references to each face, for more accurate behind-the-camera/frustum culling
3 years ago
Nico de Poel
2626b9c67f
A bit of cleanup:
- Ditching the face vertex thing since we're not likely to use the low-quality render path in practice, and this saves a ton on extra vertex data
- No need to build a world-space bounding box per face anymore
3 years ago
Nico de Poel
b0f7e971e8
Detect and link animated texture frames
3 years ago
Nico de Poel
b0e6083d13
Added a few source references
3 years ago
Nico de Poel
f35fd7287e
Made an attempt at detecting T-junctions in geometry and correcting the vertices for that. It sort of works but it doesn't have the desired effect yet. Back to the drawing board.
3 years ago
Nico de Poel
225ec746ec
Updated vertex field names to match, to facilitate blitting to SVECTOR
3 years ago
Nico de Poel
c111a2090c
Implemented a more accurate face area computation, allowing for more precise tessellation LOD selection.
Also started putting face-related functions into a separate source file.
3 years ago
Nico de Poel
a4c3dba734
Allow easier bulk map conversion
3 years ago
Nico de Poel
f5ffefce4c
Additional debugging output
3 years ago
Nico de Poel
64865249a4
Removed the baselight addition during light sampling, as that was actually the cause of weird lighting bugs in some areas.
This will probably be relevant again when implementing animated lights, but not right now.
3 years ago
Nico de Poel
b43dff99a2
Fixed a floating point rounding error preventing faces from being found for some world-space points. Fixes lighting bugs in a few areas.
3 years ago
Nico de Poel
727c5bf724
Tweaked light sampling a bit more, should be more accurate to Quake's original implementation now (though it hardly makes any difference in practice)
3 years ago
Nico de Poel
ca08893253
Relaxed vector equality margin of error a little bit, hopefully leading to less instances of faces not being found for a given point
3 years ago
Nico de Poel
0a077b426c
Reworked lightmap sampling using a lightmap space transform and correctly rounding values, using the Quake source for reference. Finally fixes a bunch of lingering lighting artifacts.
3 years ago
Nico de Poel
ac84af48f2
Create a reusable texture space transform matrix per face, and use it to build up the texture boundaries.
3 years ago
Nico de Poel
b87102afb2
Export model face data
3 years ago
Nico de Poel
197c657361
Prevent 16-bit overflow when storing face area; fixes wildly inconsistent tessellation LOD calculations
3 years ago
Nico de Poel
8d51e7e252
Embed the texture atlas data inside the exported .ps1bsp file and name those files after the actual map.
Makes it a bit easier to switch between maps for testing.
3 years ago
Nico de Poel
dfe7806450
Reorganized model data so as not to cause any memory alignment issues
3 years ago
Nico de Poel
97a08243b5
Added a world spawn element with a generic sky color derived from the sky texture
3 years ago
Nico de Poel
45796822cd
Reorganized poly vertex data structure to allow for faster copying in the PS1 code
3 years ago
Nico de Poel
caaccee1dd
Export model data for dynamic world objects
3 years ago
Nico de Poel
dc78b9700d
Calculate average and dominant colors per texture, and use those to precalculate combined color * light values per face vertex, for cheap vertex colored drawing.
3 years ago
Nico de Poel
cc18611de8
Reorganized texture code so that the palette is loaded separately, and metadata used to calculate UVs are kept out of the exported file for PS1.
3 years ago
Nico de Poel
9f1ed1f35f
Draw lava, slime and teleporters as liquids, but not transparent.
3 years ago
Nico de Poel
c8d8d0b905
Added a few more file extensions to the ignore list
3 years ago
Nico de Poel
64d9b16c12
Duplicate the Quake palette CLUT with transparency flag set, to use for water surfaces. Doesn't actually work yet but the solution should be something in this direction.
3 years ago
Nico de Poel
c6a8abbb7b
Made the texture space transform available outside of Tessellator and used it to generate some more Face bounds data for later use.
3 years ago
Nico de Poel
fb66f93b46
Provide some additional data in the PS1 BSP file, including linked list pointers for leaf-based polygon sorting
3 years ago
Nico de Poel
cc1fcec7ea
Also add leaf bounding sphere for optional per-leaf frustum culling.
3 years ago
Nico de Poel
c91e8e6167
Added bounding spheres to node data, used for frustum culling
3 years ago
Nico de Poel
0df5801eba
Export face vertex data again, to allow for simplified rendering routines
3 years ago
Nico de Poel
93551117b1
Added surface flags, allowing for rendering of water surfaces
3 years ago
Nico de Poel
4655246b69
Retired the concept of surface vertices, as UVs can in fact not be shared between polygons.
I may revisit this idea when trying to compress data size, as lighting data can be shared between poly vertices.
3 years ago
Nico de Poel
ef9adf8de0
Introduced some matrix math to properly construct a texture space transform, that we can also invert to create a transform back to world space. Finally our tesselated polygons are working perfectly!
3 years ago
Nico de Poel
4e11041b93
Desaturate palette colors to more closely match Quake's look, and made an exception for the big Quake sign on the start map, so it maintains a higher mip level.
3 years ago
Nico de Poel
fc281251ea
Overhaul of geometry conversion:
- Faces are now tessellated into one or more polygons, based on UV coordinates and texture tiling
- Polygons have their own vertex index list and light/UV values per vertex
- Lighting is sampled per polygon vertex, allowing for more light samples in general and more refined lighting
- There are still problems with reconstruction of vertices for sloped surfaces, but this is enough of a result for a checkpoint commit
3 years ago
Nico de Poel
4f99baea65
Encapsulated GPC-based tesselation into a Tesselator class, which now also produces normalized UVs per vertex-texture pair and a list of Polygon structs with texture and vertex index data.
3 years ago
Nico de Poel
f413e8c47f
First test with GPC to cut faces into multiple polygons, based on a grid of texture boundaries. Reconstruct the texture space (s,t) coordinates back into world space. Store vertices and indices while avoiding duplicate vertices.
3 years ago
Nico de Poel
e5b2e6244a
Imported General Polygon Clipper library, which could come in handy to cut up faces to accomplish texture tiling
3 years ago
Nico de Poel
568f2450eb
Added a new lighting sampler to take advantage of the improved lightmap indexing: use a pseudo-random jitter pattern to take multiple light samples in an area around the sample point, from all surrounding faces at a shallow angle.
This further smooths out the lighting and reduces artifacts, while also better representing each face's entire lightmap.
3 years ago
Nico de Poel
6d6766663b
Realized we can include the UV offsets into the UVs stored in the exported map file, so we don't need to add those at runtime. Easy performance win.
3 years ago
Nico de Poel
3bc9167885
Tweaked heuristics of the rectpack algorithm to produce better results for our non-square texture atlases.
Ensure we don't exceed the maximum range of PS1 UV coordinates by limiting texture width and height.
3 years ago
Nico de Poel
fb3d1ac6a1
Upgraded dot product and cross product-related functions to doubles, to improve accuracy of various calculations
3 years ago