A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE Technical / Map Design »how do i make an opensauce shader for pixelation?

Author Topic: how do i make an opensauce shader for pixelation? (1 messages, Page 1 of 1)
Moderators: Dennis

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;
}

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 7:58 PM 141 ms.
A Halo Maps Website