Fix Vignette and Sharpen
This commit is contained in:
@@ -10,11 +10,11 @@ class Vignette:
|
||||
return {
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
"a": ("FLOAT", {
|
||||
"vignette": ("FLOAT", {
|
||||
"default": 0.0,
|
||||
"min": 0.0,
|
||||
"max": 10.0,
|
||||
"step": 1.0
|
||||
"step": 0.01
|
||||
}),
|
||||
},
|
||||
}
|
||||
@@ -33,10 +33,10 @@ class Vignette:
|
||||
X, Y = torch.meshgrid(x, y, indexing="ij")
|
||||
radius = torch.sqrt(X ** 2 + Y ** 2)
|
||||
|
||||
# Map vignette strength from 0-10 to 1.800-0.800
|
||||
mapped_vignette_strength = 1.8 - (vignette - 1) * 0.1
|
||||
vignette = 1 - torch.clamp(radius / mapped_vignette_strength, 0, 1)
|
||||
vignette = vignette[..., None]
|
||||
radius = radius / torch.amax(radius, dim=(0, 1), keepdim=True)
|
||||
opacity = torch.tensor(vignette, device=image.device)
|
||||
opacity = torch.clamp(opacity, 0.0, 1.0)
|
||||
vignette = 1 - radius.unsqueeze(0).unsqueeze(-1) * opacity
|
||||
|
||||
vignette_image = torch.clamp(image * vignette, 0, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user