Micro shadowing
This commit is contained in:
parent
297a7b8281
commit
2da0e03d17
|
@ -182,6 +182,10 @@ void main() {
|
|||
vec3 v = normalize(eye - p);
|
||||
float dotNV = max(dot(n, v), 0.0);
|
||||
|
||||
#ifdef _MicroShadowing
|
||||
occspec.x = mix(1.0, occspec.x, dotNV); // AO Fresnel
|
||||
#endif
|
||||
|
||||
#ifdef _Brdf
|
||||
vec2 envBRDF = textureLod(senvmapBrdf, vec2(metrough.y, 1.0 - dotNV), 0.0).xy;
|
||||
#endif
|
||||
|
@ -307,6 +311,10 @@ void main() {
|
|||
svisibility *= textureLod(texClouds, vec2(p.xy / 100.0 + time / 80.0), 0.0).r * dot(n, vec3(0,0,1));
|
||||
#endif
|
||||
|
||||
#ifdef _MicroShadowing
|
||||
svisibility *= sdotNL + 2.0 * occspec.x * occspec.x - 1.0;
|
||||
#endif
|
||||
|
||||
fragColor.rgb += sdirect * svisibility * sunCol;
|
||||
|
||||
// #ifdef _Hair // Aniso
|
||||
|
@ -346,6 +354,9 @@ void main() {
|
|||
, voxels, voxpos
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MicroShadowing
|
||||
, occspec.x
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifdef _Spot
|
||||
|
@ -392,6 +403,9 @@ void main() {
|
|||
, lightsArraySpot[li].w // cutoff - exponent
|
||||
, lightsArraySpot[li].xyz // spotDir
|
||||
#endif
|
||||
#ifdef _MicroShadowing
|
||||
, occspec.x
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif // _Clusters
|
||||
|
|
|
@ -77,6 +77,9 @@ vec3 sampleLight(const vec3 p, const vec3 n, const vec3 v, const float dotNV, co
|
|||
, sampler3D voxels, vec3 voxpos
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MicroShadowing
|
||||
, float occ
|
||||
#endif
|
||||
) {
|
||||
vec3 ld = lp - p;
|
||||
vec3 l = normalize(ld);
|
||||
|
@ -105,6 +108,10 @@ vec3 sampleLight(const vec3 p, const vec3 n, const vec3 v, const float dotNV, co
|
|||
direct *= attenuate(distance(p, lp));
|
||||
direct *= lightCol;
|
||||
|
||||
#ifdef _MicroShadowing
|
||||
direct *= dotNL + 2.0 * occ * occ - 1.0;
|
||||
#endif
|
||||
|
||||
#ifdef _VoxelAOvar
|
||||
#ifdef _VoxelShadow
|
||||
direct *= 1.0 - traceShadow(voxels, voxpos, l);
|
||||
|
|
|
@ -15,6 +15,9 @@ def add_world_defs():
|
|||
if rpdat.arm_ssrs:
|
||||
wrd.world_defs += '_SSRS'
|
||||
|
||||
if rpdat.arm_micro_shadowing:
|
||||
wrd.world_defs += '_MicroShadowing'
|
||||
|
||||
if rpdat.arm_two_sided_area_light:
|
||||
wrd.world_defs += '_TwoSidedAreaLight'
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ def update_preset(self, context):
|
|||
rpdat.rp_compositornodes = True
|
||||
rpdat.rp_volumetriclight = False
|
||||
rpdat.rp_ssgi = 'SSAO'
|
||||
rpdat.arm_ssrs = False
|
||||
rpdat.arm_micro_shadowing = False
|
||||
rpdat.rp_ssr = False
|
||||
rpdat.rp_bloom = False
|
||||
rpdat.rp_autoexposure = False
|
||||
|
@ -63,6 +65,8 @@ def update_preset(self, context):
|
|||
rpdat.rp_compositornodes = False
|
||||
rpdat.rp_volumetriclight = False
|
||||
rpdat.rp_ssgi = 'Off'
|
||||
rpdat.arm_ssrs = False
|
||||
rpdat.arm_micro_shadowing = False
|
||||
rpdat.rp_ssr = False
|
||||
rpdat.rp_bloom = False
|
||||
rpdat.rp_autoexposure = False
|
||||
|
@ -97,6 +101,7 @@ def update_preset(self, context):
|
|||
rpdat.rp_volumetriclight = False
|
||||
rpdat.rp_ssgi = 'RTAO'
|
||||
rpdat.arm_ssrs = False
|
||||
rpdat.arm_micro_shadowing = False
|
||||
rpdat.rp_ssr = True
|
||||
rpdat.arm_ssr_half_res = False
|
||||
rpdat.rp_bloom = True
|
||||
|
@ -131,6 +136,8 @@ def update_preset(self, context):
|
|||
rpdat.rp_compositornodes = False
|
||||
rpdat.rp_volumetriclight = False
|
||||
rpdat.rp_ssgi = 'Off'
|
||||
rpdat.arm_ssrs = False
|
||||
rpdat.arm_micro_shadowing = False
|
||||
rpdat.rp_ssr = False
|
||||
rpdat.rp_bloom = False
|
||||
rpdat.rp_autoexposure = False
|
||||
|
@ -340,6 +347,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
name="Resolution Z", description="3D texture z resolution multiplier", default='1.0', update=update_renderpath)
|
||||
arm_clouds: BoolProperty(name="Clouds", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_ssrs: BoolProperty(name="SSRS", description="Screen-space ray-traced shadows", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_micro_shadowing: BoolProperty(name="Micro Shadowing", description="Micro shadowing based on ambient occlusion", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_texture_filter: EnumProperty(
|
||||
items=[('Anisotropic', 'Anisotropic', 'Anisotropic'),
|
||||
('Linear', 'Linear', 'Linear'),
|
||||
|
|
|
@ -957,6 +957,7 @@ class ARM_PT_RenderPathPostProcessPanel(bpy.types.Panel):
|
|||
col = layout.column()
|
||||
col.enabled = rpdat.arm_ssrs
|
||||
col.prop(rpdat, 'arm_ssrs_ray_step')
|
||||
layout.prop(rpdat, 'arm_micro_shadowing')
|
||||
layout.separator()
|
||||
layout.prop(rpdat, "rp_bloom")
|
||||
col = layout.column()
|
||||
|
|
Loading…
Reference in a new issue