
thellt
Joined: Feb 14, 2009
chiperdilly the great 1999-2017
|
Posted: Aug 17, 2014 10:33 PM
Msg. 1 of 1
so i know NOTHING about hlsl. i found this fx file online. is any fx file usable in halo opensauce? what do i need to do to make this work to pixelate a 3d scene?
// // WPF ShaderEffect HLSL -- PixelateEffect // //--------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------- // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) //-----------------------------------------------------------------------------------------
float HorizontalPixelCounts : register(C0); float VerticalPixelCounts : register(C1);
//-------------------------------------------------------------------------------------- // Sampler Inputs (Brushes, including ImplicitInput) //--------------------------------------------------------------------------------------
sampler2D implicitInputSampler : register(S0);
//-------------------------------------------------------------------------------------- // Pixel Shader //--------------------------------------------------------------------------------------
float4 main(float2 uv : TEXCOORD) : COLOR { float2 brickCounts = { HorizontalPixelCounts, VerticalPixelCounts }; float2 brickSize = 1.0 / brickCounts;
// Offset every other row of bricks float2 offsetuv = uv; bool oddRow = floor(offsetuv.y / brickSize.y) % 2.0 >= 1.0; if (oddRow) { offsetuv.x += brickSize.x / 2.0; } float2 brickNum = floor(offsetuv / brickSize); float2 centerOfBrick = brickNum * brickSize + brickSize / 2; float4 color = tex2D(implicitInputSampler, centerOfBrick);
return color; }
|