From e076b2f53d07527bf8ad43f5de9c89c3f9b6e3a2 Mon Sep 17 00:00:00 2001 From: mrq Date: Thu, 5 Dec 2024 00:11:57 -0600 Subject: [PATCH] This one trick adds free FPS (do not do VXGI on completely transparent pixels) --- README.md | 9 ++--- bin/data/config.json | 16 ++++----- .../sourceengine/base_sourceengine.json | 4 +-- .../scenes/sourceengine/sh2_mcdonalds.json | 6 ++-- .../scenes/sourceengine/sourceengine.json | 4 +-- bin/data/shaders/common/vxgi.h | 2 +- docs/README.md | 35 ++++++++++++++++++- engine/src/engine/graph/decode.cpp | 3 +- 8 files changed, 54 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index a56c6447..096405b9 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,7 @@

-An unnamed, almost-entirely from-scratch, engine written in C++, using: -* 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 +An unnamed, almost-entirely from-scratch, engine written in C++. ## 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). -*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 diff --git a/bin/data/config.json b/bin/data/config.json index 3d6b1fcc..dfed9af2 100644 --- a/bin/data/config.json +++ b/bin/data/config.json @@ -6,12 +6,12 @@ "meshes": { "interleaved": false }, "lights": { "enabled": true, "useLightmaps": false, - "max": 16, + "max": 32, "shadows": { "enabled": true, "update": 4, "max": 8, - "samples": 4 + "samples": 2 }, "bloom": { "scale": 1.0, @@ -30,11 +30,11 @@ }, "vxgi": { // "limiter": 0, - "limiter": 0.125, - "size": 256, + "limiter": 0.5, + "size": 128, "dispatch": 8, - "cascades": 4, - "cascadePower": 1.5, + "cascades": 3, + "cascadePower": 2.0, "granularity": 12, "voxelizeScale": 1, "occlusionFalloff": 2, @@ -58,7 +58,7 @@ } }, "graph": { - "initial buffer elements": 1024, + "initial buffer elements": 2048, "global storage": false }, "ext": { @@ -114,7 +114,7 @@ "deferred": true, "gui": true, "vsync": false, - "hdr": false, + "hdr": true, "vxgi": true, "culling": true, "bloom": false, diff --git a/bin/data/scenes/sourceengine/base_sourceengine.json b/bin/data/scenes/sourceengine/base_sourceengine.json index 4db45f63..1475bdb1 100644 --- a/bin/data/scenes/sourceengine/base_sourceengine.json +++ b/bin/data/scenes/sourceengine/base_sourceengine.json @@ -11,12 +11,12 @@ // exact matches "worldspawn": { "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 }, "unwrap mesh": true }, "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 }, "unwrap mesh": true }, diff --git a/bin/data/scenes/sourceengine/sh2_mcdonalds.json b/bin/data/scenes/sourceengine/sh2_mcdonalds.json index 9c4c4b21..aa0518ff 100644 --- a/bin/data/scenes/sourceengine/sh2_mcdonalds.json +++ b/bin/data/scenes/sourceengine/sh2_mcdonalds.json @@ -1,8 +1,8 @@ { "import": "./base_sourceengine.json", "assets": [ - { "filename": "./models/sh2_mcdonalds.glb" } - // { "filename": "./models/sh2_mcdonalds/graph.json" } + // { "filename": "./models/sh2_mcdonalds.glb" } + { "filename": "./models/sh2_mcdonalds/graph.json" } ], "metadata": { "graph": { @@ -23,7 +23,7 @@ }, */ "/^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_5509": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, diff --git a/bin/data/scenes/sourceengine/sourceengine.json b/bin/data/scenes/sourceengine/sourceengine.json index 0ca77b5c..f3a848a7 100644 --- a/bin/data/scenes/sourceengine/sourceengine.json +++ b/bin/data/scenes/sourceengine/sourceengine.json @@ -1,8 +1,8 @@ { // "import": "./rp_downtown_v2.json" // "import": "./ss2_medsci1.json" -// "import": "./sh2_mcdonalds.json" - "import": "./animal_crossing.json" + "import": "./sh2_mcdonalds.json" +// "import": "./animal_crossing.json" // "import": "./mds_mcdonalds.json" // "import": "./gm_construct.json" } \ No newline at end of file diff --git a/bin/data/shaders/common/vxgi.h b/bin/data/shaders/common/vxgi.h index d4dbb4e2..e553d1d4 100644 --- a/bin/data/shaders/common/vxgi.h +++ b/bin/data/shaders/common/vxgi.h @@ -180,7 +180,7 @@ void indirectLightingVXGI() { // deferred sampling doesn't have a blended albedo buffer // in place we'll just cone trace behind the window #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.direction = surface.ray.direction; ray.origin = surface.position.world + ray.direction; diff --git a/docs/README.md b/docs/README.md index 6da5f1f1..017c1328 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,6 +4,39 @@ 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 -Unless otherwise credited/noted in this repo or within the designated file/folder, this repository is [licensed](/LICENSE) under AGPLv3. \ No newline at end of file +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). \ No newline at end of file diff --git a/engine/src/engine/graph/decode.cpp b/engine/src/engine/graph/decode.cpp index 7bc6359b..3be9bfa6 100644 --- a/engine/src/engine/graph/decode.cpp +++ b/engine/src/engine/graph/decode.cpp @@ -9,10 +9,11 @@ #include #include +// it's too unstable right now to do multithreaded loading, perhaps there's a better way #if UF_USE_OPENGL #define UF_GRAPH_LOAD_MULTITHREAD 0 #else - #define UF_GRAPH_LOAD_MULTITHREAD 1 + #define UF_GRAPH_LOAD_MULTITHREAD 0 #endif #if 0 && UF_ENV_DREAMCAST