Skip to content

Commit

Permalink
Fix: Using float image layer as normal map produce wrong normal
Browse files Browse the repository at this point in the history
  • Loading branch information
ucupumar committed Jun 13, 2024
1 parent 66f9a5a commit 7e564fb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4896,7 +4896,7 @@ class YLayerChannel(bpy.types.PropertyGroup):
normal_strength : FloatProperty(
name = 'Normal Strength',
description = 'Normal strength',
default=1.0, min=0.0, max=10.0,
default=1.0, min=0.0, max=100.0,
update=update_normal_strength)

image_flip_y : BoolProperty(
Expand Down
3 changes: 2 additions & 1 deletion common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5376,7 +5376,8 @@ def any_linear_images_problem(yp):
#if ((is_image_source_srgb(image, source) and not ch_linear) or
# (not is_image_source_srgb(image, source) and ch_linear)
# ):
if not ch_linear:
# NOTE: Float image is pretended to be sRGB even if it's using linear colorspace
if (image.is_float and ch_linear) or (not image.is_float and not ch_linear):
return True

if not image.is_float and ((is_image_source_srgb(image, source) and linear) or
Expand Down
2 changes: 1 addition & 1 deletion subtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ def check_layer_channel_linear_node(ch, layer=None, root_ch=None, reconnect=Fals
and not ch.override_1
and root_ch.type == 'NORMAL'
and ch.normal_map_type in {'NORMAL_MAP', 'BUMP_NORMAL_MAP'}
and source #and is_image_source_srgb(image, source)
and source and source.image and not source.image.is_float #and is_image_source_srgb(image, source) # NOTE: No need for channel linear if the image is float
)):
if root_ch.type == 'VALUE':
linear = replace_new_node(source_tree, ch, 'linear', 'ShaderNodeMath', 'Linear')
Expand Down

0 comments on commit 7e564fb

Please sign in to comment.