-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Watercolor: Add vignette option, improve color quantisation
- Loading branch information
Showing
24 changed files
with
82 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Number of luminosity levels to quantize into | ||
extern int luminosityLevels = 16; | ||
|
||
texture lastshader; | ||
sampler2D sLastShader = sampler_state { texture = <lastshader>; addressu = clamp; }; | ||
|
||
float4 main(float2 uv : TEXCOORD) : SV_Target { | ||
// Sample the texture color | ||
float4 texColor = tex2D(sLastShader, uv); | ||
// Calculate the original luminosity | ||
float luminosity = dot(texColor.rgb, float3(0.299, 0.587, 0.114)); | ||
// Quantize luminosity into a fixed number of levels | ||
float quantizedLuminosity = floor(luminosity * luminosityLevels) / (luminosityLevels-1); | ||
// Adjust the color's brightness to match the quantized luminosity | ||
// Keeping the color's hue and saturation unchanged | ||
float3 adjustedColor = texColor.rgb * (quantizedLuminosity / luminosity); | ||
// Return the adjusted color with the original alpha | ||
return float4(adjustedColor, texColor.a); | ||
} | ||
|
||
technique T0 < string MGEinterface="MGE XE 0"; string category = "final"; int priorityAdjust = 40; > | ||
{ | ||
pass p0 { PixelShader = compile ps_3_0 main(); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters