Skip to content

Commit 10e5d40

Browse files
committed
Change Vignette behaviour on Film Grain node
Simplified the vignette functionality on the Film Grain node to support floats (step: 0.01). This allows very subtle vignette.
1 parent de7a29b commit 10e5d40

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

post_processing/film_grain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def INPUT_TYPES(s):
3232
"default": 0.0,
3333
"min": 0.0,
3434
"max": 10.0,
35-
"step": 1.0
35+
"step": 0.01
3636
}),
3737
},
3838
}
@@ -140,9 +140,9 @@ def apply_vignette(self, image, vignette_strength):
140140
X, Y = np.meshgrid(x, y)
141141
radius = np.sqrt(X ** 2 + Y ** 2)
142142

143-
# Map vignette strength from 0-10 to 1.800-0.800
144-
mapped_vignette_strength = 1.8 - (vignette_strength - 1) * 0.1
145-
vignette = 1 - np.clip(radius / mapped_vignette_strength, 0, 1)
143+
radius = radius / np.max(radius)
144+
opacity = np.clip(vignette_strength, 0, 1)
145+
vignette = 1 - radius * opacity
146146

147147
return np.clip(image * vignette[..., np.newaxis], 0, 1)
148148

post_processing_nodes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def INPUT_TYPES(s):
620620
"default": 0.0,
621621
"min": 0.0,
622622
"max": 10.0,
623-
"step": 1.0
623+
"step": 0.01
624624
}),
625625
},
626626
}
@@ -728,9 +728,9 @@ def apply_vignette(self, image, vignette_strength):
728728
X, Y = np.meshgrid(x, y)
729729
radius = np.sqrt(X ** 2 + Y ** 2)
730730

731-
# Map vignette strength from 0-10 to 1.800-0.800
732-
mapped_vignette_strength = 1.8 - (vignette_strength - 1) * 0.1
733-
vignette = 1 - np.clip(radius / mapped_vignette_strength, 0, 1)
731+
radius = radius / np.max(radius)
732+
opacity = np.clip(vignette_strength, 0, 1)
733+
vignette = 1 - radius * opacity
734734

735735
return np.clip(image * vignette[..., np.newaxis], 0, 1)
736736

0 commit comments

Comments
 (0)