diff --git a/Makefile b/Makefile index 9cb13cc6..85a40d5d 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,8 @@ EXT_LIB_NAME += ext #VULKAN_SDK_PATH += /c/VulkanSDK/1.3.224.1/ #VULKAN_SDK_PATH += /c/VulkanSDK/1.3.231.1/ #VULKAN_SDK_PATH += /c/VulkanSDK/1.3.261.1/ -VULKAN_SDK_PATH += /c/VulkanSDK/1.3.296.0/ +#VULKAN_SDK_PATH += /c/VulkanSDK/1.3.296.0/ +VULKAN_SDK_PATH += /c/VulkanSDK/1.4.321.1/ GLSLC += $(VULKAN_SDK_PATH)/Bin/glslc SPV_OPTIMIZER += $(VULKAN_SDK_PATH)/Bin/spirv-opt diff --git a/bin/data/config.json b/bin/data/config.json index e519dbe9..020ffb2c 100644 --- a/bin/data/config.json +++ b/bin/data/config.json @@ -35,10 +35,11 @@ "dispatch": 8, "cascades": 3, "cascadePower": 2.0, - "granularity": 12, + "granularity": 16, "voxelizeScale": 1, "occlusionFalloff": 2, "traceStartOffsetFactor": 1, + "filtering": "LINEAR", "shadows": 0, "extents": { "min": [ -8, -8, -8 ], @@ -396,7 +397,7 @@ "visible" : true, "center" : false, "sensitivity": [ 50, 50 ], - "smoothing": [ 0.75, 0.75 ] + "smoothing": [ 0.25, 0.25 ] }, "mode" : "windowed", // fullscreen, borderless, windowed "icon" : "./data/textures/icon.png", diff --git a/bin/data/entities/light.json b/bin/data/entities/light.json index 90e3f843..172f76ee 100644 --- a/bin/data/entities/light.json +++ b/bin/data/entities/light.json @@ -26,10 +26,10 @@ "bias": { "constant": 1.25, "slope": 1.75, - "shader": 0.05 // 0.000005 //0.000000005 + "shader": 0.000005 // 0.000005 //0.000000005 }, "radius": [0.5, 0], - "resolution": 768, + "resolution": 1024, "shadows": true, "dynamic": true } diff --git a/bin/data/scenes/sourceengine/scene.json b/bin/data/scenes/sourceengine/scene.json index a27dd52d..1e49a4ec 100644 --- a/bin/data/scenes/sourceengine/scene.json +++ b/bin/data/scenes/sourceengine/scene.json @@ -6,7 +6,7 @@ ], "metadata": { "light": { - "fog": { + "fog-0": { // "color": [ 0.1, 0.1, 0.1 ], // "color": [ 0.2, 0.2, 0.2 ], "color": [ 0.3, 0.3, 0.3 ], diff --git a/bin/data/scenes/sourceengine/ss2_medsci1.json b/bin/data/scenes/sourceengine/ss2_medsci1.json index dbe761c5..9e0b7a6a 100644 --- a/bin/data/scenes/sourceengine/ss2_medsci1.json +++ b/bin/data/scenes/sourceengine/ss2_medsci1.json @@ -1,8 +1,8 @@ { "import": "./base_sourceengine.json", "assets": [ - // { "filename": "./models/ss2_medsci1_smallish.glb" } - { "filename": "./models/ss2_medsci1_smallish/graph.json" } + // { "filename": "./models/ss2_medsci1.glb" } + { "filename": "./models/ss2_medsci1/graph.json" } ], "metadata": { "graph": { diff --git a/bin/data/shaders/display/deferred/comp/comp.h b/bin/data/shaders/display/deferred/comp/comp.h index 36a0040e..95ffd25e 100644 --- a/bin/data/shaders/display/deferred/comp/comp.h +++ b/bin/data/shaders/display/deferred/comp/comp.h @@ -271,9 +271,23 @@ void populateSurface() { surface.motion = cNDC.xy - pNDC.xy; } + } void directLighting() { +#if VXGI + // to-do: proper "visual" of the VXGI maps (directly pick the pixel instead of just rawdog tracing for it) + if ( ubo.settings.mode.type == 0x000A ) { + Ray ray; + ray.direction = surface.ray.direction; + ray.origin = surface.ray.origin; + vec4 radiance = voxelConeTrace( ray, 0.0000001f ); + + surface.material.albedo.rgb = radiance.rgb; + surface.material.indirect.rgb = vec3(0); + } +#endif + surface.light.rgb += surface.material.albedo.rgb * ubo.settings.lighting.ambient.rgb * surface.material.occlusion; // add ambient lighting surface.light.rgb += surface.material.indirect.rgb; // add indirect lighting #if PBR diff --git a/ext/behaviors/voxelizer/behavior.cpp b/ext/behaviors/voxelizer/behavior.cpp index da124fe6..9d7f915f 100644 --- a/ext/behaviors/voxelizer/behavior.cpp +++ b/ext/behaviors/voxelizer/behavior.cpp @@ -45,6 +45,10 @@ void ext::VoxelizerSceneBehavior::initialize( uf::Object& self ) { auto& normal = sceneTextures.voxels.normal.emplace_back(); normal.fromBuffers( NULL, 0, uf::renderer::enums::Format::R16G16_SFLOAT, metadata.voxelSize.x, metadata.voxelSize.y, metadata.voxelSize.z, 1, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, VK_IMAGE_LAYOUT_GENERAL ); auto& radiance = sceneTextures.voxels.radiance.emplace_back(); + if ( metadata.filtering == "NEAREST" ) { + radiance.sampler.descriptor.filter.min = uf::renderer::enums::Filter::NEAREST; + radiance.sampler.descriptor.filter.mag = uf::renderer::enums::Filter::NEAREST; + } radiance.fromBuffers( NULL, 0, uf::renderer::settings::pipelines::hdr ? uf::renderer::enums::Format::HDR : uf::renderer::enums::Format::SDR, metadata.voxelSize.x, metadata.voxelSize.y, metadata.voxelSize.z, 1, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, VK_IMAGE_LAYOUT_GENERAL ); // auto& depth = sceneTextures.voxels.depth.emplace_back(); // depth.fromBuffers( (void*) empty.data(), empty.size(), uf::renderer::enums::Format::R16_SFLOAT, metadata.voxelSize.x, metadata.voxelSize.y, metadata.voxelSize.z, 1, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, VK_IMAGE_LAYOUT_GENERAL ); @@ -275,6 +279,7 @@ void ext::VoxelizerSceneBehavior::Metadata::serialize( uf::Object& self, uf::Ser serializer["vxgi"]["occlusionFalloff"] = /*this->*/occlusionFalloff; serializer["vxgi"]["traceStartOffsetFactor"] = /*this->*/traceStartOffsetFactor; serializer["vxgi"]["shadows"] = /*this->*/shadows; + serializer["vxgi"]["filtering"] = /*this->*/filtering; serializer["vxgi"]["extents"]["min"] = uf::vector::encode(/*this->*/extents.min); serializer["vxgi"]["extents"]["max"] = uf::vector::encode(/*this->*/extents.max); @@ -306,6 +311,7 @@ void ext::VoxelizerSceneBehavior::Metadata::deserialize( uf::Object& self, uf::S /*this->*/occlusionFalloff = serializer["vxgi"]["occlusionFalloff"].as(/*this->*/occlusionFalloff); /*this->*/traceStartOffsetFactor = serializer["vxgi"]["traceStartOffsetFactor"].as(/*this->*/traceStartOffsetFactor); /*this->*/shadows = serializer["vxgi"]["shadows"].as(/*this->*/shadows); + /*this->*/filtering = serializer["vxgi"]["filtering"].as(/*this->*/filtering); /*this->*/extents.min = uf::vector::decode( serializer["vxgi"]["extents"]["min"], /*this->*/extents.min ); /*this->*/extents.max = uf::vector::decode( serializer["vxgi"]["extents"]["max"], /*this->*/extents.max ); diff --git a/ext/behaviors/voxelizer/behavior.h b/ext/behaviors/voxelizer/behavior.h index 9e44b124..7eddde44 100644 --- a/ext/behaviors/voxelizer/behavior.h +++ b/ext/behaviors/voxelizer/behavior.h @@ -25,6 +25,7 @@ namespace ext { float occlusionFalloff = 0; float traceStartOffsetFactor = 1.0f; uint32_t shadows = 0; + uf::stl::string filtering = "LINEAR"; struct { pod::Vector3f min = {};