protected override void PixelShader(PixelShaderInput input)
        {
            int x = input.RenderTargetX,
                y = input.RenderTargetY;

            Engine.BackBuffer.Data[y, x] +=
                Intensity * Engine.AlbedoBuffer.Data[y, x];
        }
Exemple #2
0
        protected override void PixelShader(PixelShaderInput input)
        {
            int x = input.RenderTargetX,
                y = input.RenderTargetY;

            Vector3 albedo = input.Color;

            if (input.TextureCoord != null)
            {
                albedo = Engine.Model.Texture.Sample(
                    input.TextureCoord.Y, input.TextureCoord.X);
            }

            Engine.PositionBuffer.Data[y, x]          = new Vector3(input.Position.X, input.Position.Y, input.Position.Z);
            Engine.DepthBuffer.Data[y, x]             = input.Position.Z;
            Engine.NormalBuffer.Data[y, x]            = new Vector3(input.Normal.X, input.Normal.Y, input.Normal.Z);
            Engine.AlbedoBuffer.Data[y, x]            = albedo;
            Engine.SpecularIntensityBuffer.Data[y, x] = 15f;
            Engine.SpecularPowerBuffer.Data[y, x]     = 15f;
        }
        protected override void PixelShader(PixelShaderInput input)
        {
            int x = input.RenderTargetX,
                y = input.RenderTargetY;

            var L   = Vector4.Normalize(LightPosition - input.Position);
            var N   = new Vector4(Engine.NormalBuffer.Data[y, x], 0);
            var eye = Vector4.Normalize(new Vector4(-Engine.PositionBuffer.Data[y, x], 0));
            var H   = Vector4.Normalize(eye + L);

            Engine.BackBuffer.Data[y, x] += Engine.AlbedoBuffer.Data[y, x] * Intensity *
                                            Math.Max(0, Vector4.Dot(N, L)) * (1.0f / Vector4.Dot(L, L));

            var NdotH = Vector4.Dot(N, H);

            var power     = Engine.SpecularPowerBuffer.Data[y, x];
            var intensity = Engine.SpecularIntensityBuffer.Data[y, x];

            Engine.BackBuffer.Data[y, x] += Engine.AlbedoBuffer.Data[y, x] *
                                            (float)Math.Pow(NdotH, power) * intensity;

            Engine.BackBuffer.Data[y, x] += new Vector3(1, 1, 1) *
                                            (float)Math.Pow(NdotH, power + 10) * intensity;
        }
Exemple #4
0
 protected override void PixelShader(PixelShaderInput input)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
 protected abstract void PixelShader(PixelShaderInput input);