Skip to content

Commit

Permalink
cAntiAliasing: Added render direction mode
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Sep 2, 2024
1 parent 1803a01 commit 5c1d113
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions shaders/cAntiAliasing.fx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

uniform int _RenderMode <
ui_label = "Render Mode";
ui_type = "combo";
ui_items = "Render Image\0Render Directions\0";
> = 0;

uniform int _RelativeThreshold <
ui_label = "Relative Threshold";
ui_tooltip = "Trims the algorithm from processing darks.";
Expand Down Expand Up @@ -265,8 +271,17 @@ float4 PS_AntiAliasing(CShade_VS2PS_Quad Input) : SV_TARGET0
}
}

float4 FXAA = tex2Dlod(CShade_SampleGammaTex, float4(BlendTex, 0.0, 0.0));
return CBlend_OutputChannels(float4(FXAA.rgb, _CShadeAlphaFactor));
if (_RenderMode == 1)
{
float3 FXAA = float3(Input.Tex0 - BlendTex, 0.0);
FXAA.xy = (normalize(FXAA.xy) * 0.5) + 0.5;
return CBlend_OutputChannels(float4(FXAA, _CShadeAlphaFactor));
}
else
{
float3 FXAA = tex2Dlod(CShade_SampleGammaTex, float4(BlendTex, 0.0, 0.0)).rgb;
return CBlend_OutputChannels(float4(FXAA, _CShadeAlphaFactor));
}
}

technique CShade_AntiAliasing
Expand Down

0 comments on commit 5c1d113

Please sign in to comment.