Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Vertex
- {
- float4 pos : POSITION;
- float2 tex : TEXTURE;
- float3 norm : NORMAL;
- };
- struct PixelShaderArgs
- {
- float4 pos : SV_POSITION;
- float2 col : TEXTURE;
- float3 norm : NORMAL;
- };
- struct BloomShaderData
- {
- float Threshold;
- float Intensity;
- float Padding1;
- float Padding2;
- };
- Texture2D ShaderTexture : register(t0);
- SamplerState Sampler : register(s0);
- float4x4 localMatrix : register(b0);
- cbuffer BloomShaderDataBuffer : register(b1)
- {
- BloomShaderData BloomData;
- };
- PixelShaderArgs VertexShaderMain(Vertex vertex)
- {
- PixelShaderArgs output;
- output.pos = vertex.pos;
- output.col = vertex.tex;
- return output;
- }
- float4 PixelShaderMain(PixelShaderArgs pixelShaderArgs) : SV_Target
- {
- float4 diffuse = ShaderTexture.Sample(Sampler, pixelShaderArgs.col);
- float luminosity = (diffuse.r * 0.2126) + (diffuse.g * 0.7152) + (diffuse.b * 0.0722);
- if (luminosity > BloomData.Threshold)
- {
- return diffuse;
- }
- else
- {
- return float4(0, 0, 0, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement