Lens dirt masking
This commit is contained in:
parent
ff5cf50e4e
commit
f521828edc
|
@ -327,7 +327,23 @@ void main() {
|
|||
// #endif
|
||||
|
||||
#ifdef _CLensTex
|
||||
fragColor.rgb += textureLod(lensTexture, texCo, 0.0).rgb;
|
||||
#ifdef _CLensTexMasking
|
||||
vec4 scratches = texture(lensTexture, texCo);
|
||||
vec3 scratchBlend = fragColor.rgb + scratches.rgb;
|
||||
|
||||
float centerMaxClip = compoCenterMaxClip;
|
||||
float centerMinClip = compoCenterMinClip;
|
||||
float luminanceMax = compoLuminanceMax;
|
||||
float luminanceMin = compoLuminanceMin;
|
||||
float brightnessExp = compoBrightnessExponent;
|
||||
|
||||
float center = smoothstep(centerMaxClip, centerMinClip, length(texCo - 0.5));
|
||||
float luminance = dot(fragColor.rgb, vec3(0.299, 0.587, 0.114));
|
||||
float brightnessMap = smoothstep(luminanceMax, luminanceMin, luminance * center);
|
||||
fragColor.rgb = clamp(mix(fragColor.rgb, scratchBlend, brightnessMap * brightnessExp), 0, 1);
|
||||
#else
|
||||
fragColor.rgb += textureLod(lensTexture, texCo, 0.0).rgb;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _CLetterbox
|
||||
|
|
|
@ -184,6 +184,8 @@ def build():
|
|||
if rpdat.arm_lens_texture != '':
|
||||
wrd.compo_defs += '_CLensTex'
|
||||
assets.add_embedded_data('lenstexture.jpg')
|
||||
if rpdat.arm_lens_texture_masking:
|
||||
wrd.compo_defs += '_CLensTexMasking'
|
||||
if rpdat.arm_fisheye:
|
||||
wrd.compo_defs += '_CFishEye'
|
||||
if rpdat.arm_vignette:
|
||||
|
|
|
@ -466,6 +466,12 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
('Uncharted', 'Uncharted', 'Uncharted')],
|
||||
name='Tonemap', description='Tonemapping operator', default='Filmic', update=assets.invalidate_shader_cache)
|
||||
arm_lens_texture: StringProperty(name="Lens Texture", default="")
|
||||
arm_lens_texture_masking: BoolProperty(name="Luminance Masking", description="Luminance masking", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_lens_texture_masking_centerMinClip : FloatProperty(name="Center Min Clip", default=0.5, update=assets.invalidate_shader_cache)
|
||||
arm_lens_texture_masking_centerMaxClip : FloatProperty(name="Center Max Clip", default=0.1, update=assets.invalidate_shader_cache)
|
||||
arm_lens_texture_masking_luminanceMax : FloatProperty(name="Luminance Min", default=0.1, update=assets.invalidate_shader_cache)
|
||||
arm_lens_texture_masking_luminanceMin : FloatProperty(name="Luminance Max", default=2.5, update=assets.invalidate_shader_cache)
|
||||
arm_lens_texture_masking_brightnessExp : FloatProperty(name="Brightness Exponent", default=2.0, update=assets.invalidate_shader_cache)
|
||||
arm_fisheye: BoolProperty(name="Fish Eye", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_vignette: BoolProperty(name="Vignette", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_vignette_strength: FloatProperty(name="Strength", default=0.7, update=assets.invalidate_shader_cache)
|
||||
|
|
|
@ -1034,6 +1034,14 @@ class ARM_PT_RenderPathCompositorPanel(bpy.types.Panel):
|
|||
col.prop(rpdat, 'arm_autoexposure_strength', text='Strength')
|
||||
col.prop(rpdat, 'arm_autoexposure_speed', text='Speed')
|
||||
layout.prop(rpdat, 'arm_lens_texture')
|
||||
if rpdat.arm_lens_texture != "":
|
||||
layout.prop(rpdat, 'arm_lens_texture_masking')
|
||||
if rpdat.arm_lens_texture_masking:
|
||||
layout.prop(rpdat, 'arm_lens_texture_masking_centerMinClip')
|
||||
layout.prop(rpdat, 'arm_lens_texture_masking_centerMaxClip')
|
||||
layout.prop(rpdat, 'arm_lens_texture_masking_luminanceMin')
|
||||
layout.prop(rpdat, 'arm_lens_texture_masking_luminanceMax')
|
||||
layout.prop(rpdat, 'arm_lens_texture_masking_brightnessExp')
|
||||
layout.prop(rpdat, 'arm_lut_texture')
|
||||
|
||||
class ARM_PT_BakePanel(bpy.types.Panel):
|
||||
|
|
|
@ -554,6 +554,15 @@ const float autoExposureSpeed = """ + str(rpdat.arm_autoexposure_speed) + """;
|
|||
"""const float compoFogAmountA = """ + str(round(rpdat.arm_fog_amounta * 100) / 100) + """;
|
||||
const float compoFogAmountB = """ + str(round(rpdat.arm_fog_amountb * 100) / 100) + """;
|
||||
const vec3 compoFogColor = vec3(""" + str(round(rpdat.arm_fog_color[0] * 100) / 100) + """, """ + str(round(rpdat.arm_fog_color[1] * 100) / 100) + """, """ + str(round(rpdat.arm_fog_color[2] * 100) / 100) + """);
|
||||
""")
|
||||
|
||||
if rpdat.arm_lens_texture_masking:
|
||||
f.write(
|
||||
"""const float compoCenterMinClip = """ + str(round(rpdat.arm_lens_texture_masking_centerMinClip * 100) / 100) + """;
|
||||
const float compoCenterMaxClip = """ + str(round(rpdat.arm_lens_texture_masking_centerMaxClip * 100) / 100) + """;
|
||||
const float compoLuminanceMin = """ + str(round(rpdat.arm_lens_texture_masking_luminanceMin * 100) / 100) + """;
|
||||
const float compoLuminanceMax = """ + str(round(rpdat.arm_lens_texture_masking_luminanceMax * 100) / 100) + """;
|
||||
const float compoBrightnessExponent = """ + str(round(rpdat.arm_lens_texture_masking_brightnessExp * 100) / 100) + """;
|
||||
""")
|
||||
|
||||
focus_distance = 0.0 # TODO: deprecated
|
||||
|
|
Loading…
Reference in a new issue