Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ add_definitions(-DJPH_DEBUG_RENDERER)
add_definitions(-DJPH_ENABLE_ASSERTS=1)
add_definitions(-DJPH_ENABLE_ASSERT_MESSAGES=1)

# #if WILL_ENGINE_DEBUG
# ##endif
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DWILL_ENGINE_DEBUG=1)
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(-DWILL_ENGINE_RELEASE=1)
endif ()

# Vulkan
find_package(Vulkan REQUIRED)

Expand Down Expand Up @@ -88,8 +96,6 @@ set(CORE_SOURCES
src/core/engine_types.h
src/core/transform.h
src/core/transform.cpp
src/core/identifier/identifier_manager.cpp
src/core/identifier/identifier_manager.h
src/core/game_object/game_object.h
src/core/game_object/game_object.cpp
src/core/game_object/transformable.h
Expand All @@ -104,7 +110,6 @@ set(CORE_SOURCES
src/core/game_object/components/component_factory.h
src/core/game_object/components/rigid_body_component.h
src/core/game_object/components/rigid_body_component.cpp
src/core/identifier/identifiable.h
src/core/camera/camera.cpp
src/core/camera/camera.h
src/core/camera/camera_types.h
Expand Down Expand Up @@ -178,8 +183,6 @@ set(RENDERER_SOURCES
src/renderer/lighting/directional_light.cpp
src/renderer/pipelines/shadows/cascaded_shadow_map/cascaded_shadow_map.cpp
src/renderer/pipelines/shadows/cascaded_shadow_map/cascaded_shadow_map.h
src/renderer/pipelines/shadows/cascaded_shadow_map/shadow_constants.cpp
src/renderer/pipelines/shadows/cascaded_shadow_map/shadow_constants.h
src/renderer/pipelines/shadows/cascaded_shadow_map/shadow_types.h
src/renderer/descriptor_buffer/descriptor_buffer.cpp
src/renderer/descriptor_buffer/descriptor_buffer.h
Expand Down
141 changes: 119 additions & 22 deletions assets/settings.willengine
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,132 @@
"minor": 1,
"patch": 0
},
"mainLight": {
"direction": [
-0.005322144832462072,
-0.9349234104156494,
-0.35480964183807373
],
"color": [
0.20000000298023224,
0.4000000059604645,
1.0
],
"intensity": 50.0
"engineSettings": {
"saveOnExit": true
},
"cameraProperties": {
"cameraSettings": {
"position": [
112.34994506835938,
83.79894256591797,
-50.39910125732422
-19.169994354248047,
105.9618911743164,
36.455501556396484
],
"rotation": [
-0.4555923640727997,
-0.2922893166542053,
-0.16135302186012268,
0.8252077102661133
-0.14886538684368134,
-0.2690022885799408,
-0.04212456941604614,
0.9506327509880066
],
"fov": 1.3089969158172607,
"aspectRatio": 1.7777777910232544,
"aspectRatio": 1.4861111640930176,
"nearPlane": 1000.0,
"farPlane": 0.10000000149011612
},
"environmentMapIndex": 3
"lightSettings": {
"mainLight": {
"direction": [
-0.6859943270683289,
-0.5144957900047302,
-0.5144957900047302
],
"color": [
1.0,
1.0,
1.0
],
"intensity": 1.5
}
},
"environmentSettings": {
"environmentMapIndex": 3
},
"aoSettings": {
"enabled": true,
"properties": {
"effect_radius": 0.5,
"effect_falloff_range": 0.6150000095367432,
"denoise_blur_beta": 1.2000000476837158,
"radius_multiplier": 1.4570000171661377,
"sample_distribution_power": 2.0,
"thin_occluder_compensation": 0.0,
"final_value_power": 2.200000047683716,
"depth_mip_sampling_offset": 3.299999952316284,
"slice_count": 9.0,
"steps_per_slice_count": 3.0
}
},
"sssSettings": {
"enabled": true,
"properties": {
"surfaceThickness": 0.004999999888241291,
"bilinearThreshold": 0.05000000074505806,
"shadowContrast": 2.0,
"ignoreEdgePixels": 1,
"usePrecisionOffset": 0,
"bilinearSamplingOffsetMode": 0
}
},
"csmSettings": {
"enabled": true,
"properties": {
"pcfLevel": 1,
"splitLambda": 0.800000011920929,
"splitOverlap": 1.0499999523162842,
"cascadeNearPlane": 0.10000000149011612,
"cascadeFarPlane": 100.0,
"cascadeBias": [
{
"constant": 500.0,
"slope": 0.699999988079071
},
{
"constant": 500.0,
"slope": 0.6000000238418579
},
{
"constant": 600.0,
"slope": 1.0
},
{
"constant": 300.0,
"slope": 1.0
}
],
"cascadeExtents": [
{
"width": 2048,
"height": 2048,
"depth": 1
},
{
"width": 2048,
"height": 2048,
"depth": 1
},
{
"width": 2048,
"height": 2048,
"depth": 1
},
{
"width": 2048,
"height": 2048,
"depth": 1
}
],
"useManualSplit": true,
"manualCascadeSplits": [
0.10000000149011612,
4.0,
25.0,
100.0,
400.0
]
}
},
"taaSettings": {
"enabled": true,
"properties": {
"blendValue": 0.10000000149011612
}
}
}
2 changes: 0 additions & 2 deletions shaders/deferredResolve.comp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ void main() {
float normalOffsetScale = max(offset, dot(N, L) * offset);
vec3 offsetPosition = viewPosition + N * normalOffsetScale;
vec4 worldPosition = sceneData.invView * vec4(offsetPosition, 1.0f);
//float _tempShadowFactor = getShadowFactorBlend(pushConstants.pcfLevel, worldPosition.xyz, abs(viewPosition.z), shadowCascadeData.cascadeSplits, shadowCascadeData.lightViewProj, shadowMapSampler, shadowCascadeData.nearShadowPlane, shadowCascadeData.farShadowPlane);
//float shadowFactor = clamp(smoothstep(-0.15f, 0.5f, dot(N, L)) * _tempShadowFactor, 0, 1);

float shadowFactor = getShadowFactorBlend(pushConstants.pcfLevel, worldPosition.xyz, abs(viewPosition.z), shadowCascadeData.cascadeSplits, shadowCascadeData.lightViewProj, shadowMapSampler, shadowCascadeData.nearShadowPlane, shadowCascadeData.farShadowPlane);
if (pushConstants.disableShadows == 1){
Expand Down
18 changes: 14 additions & 4 deletions shaders/transparent.frag
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ layout (set = 5, binding = 0) uniform sampler2DShadow shadowMapSampler[4];

layout (push_constant) uniform PushConstants {
int enabled;
int receiveShadows;
int disableShadows;
int disableContactShadows;
} pushConstants;

void main() {
Expand Down Expand Up @@ -111,13 +112,21 @@ void main() {
float normalOffsetScale = max(offset, dot(N, L) * offset);
vec3 offsetPosition = inViewPosition + N * normalOffsetScale;
vec4 worldPosition = sceneData.invView * vec4(offsetPosition, 1.0f);
float _tempShadowFactor = getShadowFactorBlend(1, worldPosition.xyz, abs(inViewPosition.z), shadowCascadeData.cascadeSplits, shadowCascadeData.lightViewProj, shadowMapSampler, shadowCascadeData.nearShadowPlane, shadowCascadeData.farShadowPlane);
float shadowFactor = clamp(smoothstep(-0.15f, 0.5f, dot(N, L)) * _tempShadowFactor, 0, 1);

if (pushConstants.receiveShadows == 0) {
float shadowFactor = getShadowFactorBlend(1, worldPosition.xyz, abs(inViewPosition.z), shadowCascadeData.cascadeSplits, shadowCascadeData.lightViewProj, shadowMapSampler, shadowCascadeData.nearShadowPlane, shadowCascadeData.farShadowPlane);
if (pushConstants.disableShadows == 1){
shadowFactor = 1.0f;
}
// todo: add contact shadow as descriptor to transparent pipeline
//float contactShadow = texture(contactShadowBuffer, uv).r;
float contactShadow = 1.0f;
if (pushConstants.disableContactShadows == 1){
contactShadow = 1.0f;
}

shadowFactor = min(shadowFactor, contactShadow);

// Direct lighting with shadows
vec3 directLight = (diffuse + specular) * nDotL * shadowFactor * shadowCascadeData.directionalLightData.intensity * shadowCascadeData.directionalLightData.color;

// IBL Reflections
Expand All @@ -128,6 +137,7 @@ void main() {

float ao = 1.0f;
vec3 ambient = (kD * reflectionDiffuse + reflectionSpecular) * ao;
ambient *= mix(0.4, 1.0, min(shadowFactor, nDotL));
vec3 finalColor = directLight + ambient;

float z = gl_FragCoord.z;
Expand Down
Loading
Loading