This one trick adds free FPS (do not do VXGI on completely transparent pixels)

This commit is contained in:
mrq 2024-12-05 00:11:57 -06:00 committed by ecker
parent 6b37b2fa0e
commit e076b2f53d
8 changed files with 54 additions and 25 deletions

View File

@ -4,12 +4,7 @@
<img src="./docs/assets/program.win64.gcc.vulkan_2024-12-02_23-07-35.png" width="500px"></img> <img src="./docs/assets/program.win64.gcc.vulkan_2024-12-02_23-07-35.png" width="500px"></img>
</p> </p>
An unnamed, almost-entirely from-scratch, engine written in C++, using: An unnamed, almost-entirely from-scratch, engine written in C++.
* a Unity-like ECS + scene system
* `?`-like hook system for dispatching events
* Vulkan (or OpenGL) as the rendering backend
* ReactPhysics3D for physics
* OpenAL for audio
## Build ## Build
@ -25,7 +20,7 @@ To compile, run `make`. The outputted libraries and executables will be placed i
Currently, assets are not provided due to size (but mostly due to being test assets). Currently, assets are not provided due to size (but mostly due to being test assets).
*If* adequate assets are provided, run `./program.sh`. *If* adequate assets are provided, run `./program.sh` or `make run`. This ensures the path to the required libraries are added to the PATH.
## Documentation ## Documentation

View File

@ -6,12 +6,12 @@
"meshes": { "interleaved": false }, "meshes": { "interleaved": false },
"lights": { "enabled": true, "lights": { "enabled": true,
"useLightmaps": false, "useLightmaps": false,
"max": 16, "max": 32,
"shadows": { "shadows": {
"enabled": true, "enabled": true,
"update": 4, "update": 4,
"max": 8, "max": 8,
"samples": 4 "samples": 2
}, },
"bloom": { "bloom": {
"scale": 1.0, "scale": 1.0,
@ -30,11 +30,11 @@
}, },
"vxgi": { "vxgi": {
// "limiter": 0, // "limiter": 0,
"limiter": 0.125, "limiter": 0.5,
"size": 256, "size": 128,
"dispatch": 8, "dispatch": 8,
"cascades": 4, "cascades": 3,
"cascadePower": 1.5, "cascadePower": 2.0,
"granularity": 12, "granularity": 12,
"voxelizeScale": 1, "voxelizeScale": 1,
"occlusionFalloff": 2, "occlusionFalloff": 2,
@ -58,7 +58,7 @@
} }
}, },
"graph": { "graph": {
"initial buffer elements": 1024, "initial buffer elements": 2048,
"global storage": false "global storage": false
}, },
"ext": { "ext": {
@ -114,7 +114,7 @@
"deferred": true, "deferred": true,
"gui": true, "gui": true,
"vsync": false, "vsync": false,
"hdr": false, "hdr": true,
"vxgi": true, "vxgi": true,
"culling": true, "culling": true,
"bloom": false, "bloom": false,

View File

@ -11,12 +11,12 @@
// exact matches // exact matches
"worldspawn": { "worldspawn": {
"physics": { "type": "mesh", "static": true }, "physics": { "type": "mesh", "static": true },
"grid": { "size": [8,1,8], "epsilon": 0.001, "cleanup": true, "print": true }, "grid": { "size": [16,1,16], "epsilon": 0.001, "cleanup": true, "print": true },
"optimize meshlets": { "simplify": 0.125, "print": false }, "optimize meshlets": { "simplify": 0.125, "print": false },
"unwrap mesh": true "unwrap mesh": true
}, },
"worldspawn_skybox": { "worldspawn_skybox": {
"grid": { "size": [8,1,8], "epsilon": 0.001, "cleanup": true, "print": true }, "grid": { "size": [16,1,16], "epsilon": 0.001, "cleanup": true, "print": true },
"optimize meshlets": { "simplify": 0.125, "print": false }, "optimize meshlets": { "simplify": 0.125, "print": false },
"unwrap mesh": true "unwrap mesh": true
}, },

View File

@ -1,8 +1,8 @@
{ {
"import": "./base_sourceengine.json", "import": "./base_sourceengine.json",
"assets": [ "assets": [
{ "filename": "./models/sh2_mcdonalds.glb" } // { "filename": "./models/sh2_mcdonalds.glb" }
// { "filename": "./models/sh2_mcdonalds/graph.json" } { "filename": "./models/sh2_mcdonalds/graph.json" }
], ],
"metadata": { "metadata": {
"graph": { "graph": {
@ -23,7 +23,7 @@
}, },
*/ */
"/^worldspawn_barrier$/": { "ignore": true }, "/^worldspawn_barrier$/": { "ignore": true },
// "/^worldspawn_skybox/": { "ignore": true }, "/^worldspawn_skybox/": { "ignore": true },
"func_door_rotating_5473": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, "func_door_rotating_5473": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } },
"func_door_rotating_5509": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, "func_door_rotating_5509": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } },

View File

@ -1,8 +1,8 @@
{ {
// "import": "./rp_downtown_v2.json" // "import": "./rp_downtown_v2.json"
// "import": "./ss2_medsci1.json" // "import": "./ss2_medsci1.json"
// "import": "./sh2_mcdonalds.json" "import": "./sh2_mcdonalds.json"
"import": "./animal_crossing.json" // "import": "./animal_crossing.json"
// "import": "./mds_mcdonalds.json" // "import": "./mds_mcdonalds.json"
// "import": "./gm_construct.json" // "import": "./gm_construct.json"
} }

View File

@ -180,7 +180,7 @@ void indirectLightingVXGI() {
// deferred sampling doesn't have a blended albedo buffer // deferred sampling doesn't have a blended albedo buffer
// in place we'll just cone trace behind the window // in place we'll just cone trace behind the window
#if !RT #if !RT
if ( surface.material.albedo.a < 1.0 ) { if ( 0.1 < surface.material.albedo.a && surface.material.albedo.a < 1.0 ) {
Ray ray; Ray ray;
ray.direction = surface.ray.direction; ray.direction = surface.ray.direction;
ray.origin = surface.position.world + ray.direction; ray.origin = surface.position.world + ray.direction;

View File

@ -4,6 +4,39 @@
To be filled. To be filled.
* a Unity-like ECS + scene + asset system
* entities stores components and behaviors
* scenes load a tree of entities
* entities are defined through JSON files (which are processed as gunzipped msgpacks for subsequent loads) which can reference assets or further entities
* Lua to extend the engine
* Garry's Mod-like hook system for dispatching events
* events are dispatched through the hook system by sending a payload to hooks tied to a given name / payload type
* by default, these are JSON payloads, but most internal hooks send unique structs instead
* Vulkan (or OpenGL) as the rendering backend
* the Vulkan backend heavily makes use of an almost-GPU driven deferred rendering system
* "G-buffer" can consist solely of IDs, barycentrics, and depth, and all geometry information is then reconstructed during the deferred compute pass
* shadow maps are rendered to each light's shadow maps
* point lights are treated as a cubemap
* basic PBR shading
* a sovlful (sloppy) VXGI for GI and reflections
* (currently broken) hardware RT support
* (currently broken) bloom and additional post processing
* FSR2 or something cringe
* OpenGL uses a very, very naive OpenGL 1.2 API with a homebrewed command recording system
* ReactPhysics3D for physics
* *very* loosely integrated
* basic shapes and triangulated mesh collision and some form of ray queries
* OpenAL for audio
* Currently only loads from ogg (vorbis) files
* Supports loading in full and streaming
* *very* loosely integrated
## Supported Systems
* Windows
* *technically* also Linux under Proton
* Sega Dreamcast
## Notices and Citations ## Notices and Citations
Unless otherwise credited/noted in this repo or within the designated file/folder, this repository is [licensed](/LICENSE) under AGPLv3. Unless otherwise credited/noted in this repo or within the designated file/folder, this repository is [licensed](/LICENSE) under AGPLv3 (I do not have a master record of dependencies).

View File

@ -9,10 +9,11 @@
#include <uf/utils/camera/camera.h> #include <uf/utils/camera/camera.h>
#include <uf/ext/xatlas/xatlas.h> #include <uf/ext/xatlas/xatlas.h>
// it's too unstable right now to do multithreaded loading, perhaps there's a better way
#if UF_USE_OPENGL #if UF_USE_OPENGL
#define UF_GRAPH_LOAD_MULTITHREAD 0 #define UF_GRAPH_LOAD_MULTITHREAD 0
#else #else
#define UF_GRAPH_LOAD_MULTITHREAD 1 #define UF_GRAPH_LOAD_MULTITHREAD 0
#endif #endif
#if 0 && UF_ENV_DREAMCAST #if 0 && UF_ENV_DREAMCAST