private void BlendBuffer_Loading(object sender, EventArgs e)
        {
            vertexVBO = ScreenTri.Vertices().ToVBO();
            indexVBO  = ScreenTri.Indices().ToVBO();

            this.sourcegbuffer.SetSlot(0, new GBuffer.TextureSlotParam(TextureTarget.Texture2D, PixelInternalFormat.Rgba, PixelFormat.Rgba, PixelType.UnsignedByte, false, new List <ITextureParameter>
            {
                new TextureParameterInt(TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear),
                new TextureParameterInt(TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear),
                new TextureParameterInt(TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge),
                new TextureParameterInt(TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge)
            }));
            this.sourcegbuffer.Init(this.Width, this.Height);

            InitTextures();

            this.destinationgbuffer.SetSlot(0, frame[0]);
            this.destinationgbuffer.Init(this.Width, this.Height);

            this.gbufferCombiner = new GBufferCombiner(this.sourcegbuffer);
            this.Reload();
        }
        void LightingCombiner_Loading(object sender, EventArgs e)
        {
            this.gbuffer.SetSlot(0, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.HalfFloat));  // rgb+shadow
            this.gbuffer.SetSlot(1, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.HalfFloat));  // rough+specexp+specpwr+sparkle
            this.gbuffer.SetSlot(2, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.HalfFloat));  // normal

            this.gbuffer.Init(this.Width, this.Height);

            InitShader(program);

            this.gbufferCombiner = new GBufferCombiner(this.gbuffer, this.program);

            this.projection = Matrix4.CreateOrthographicOffCenter(0.0f, 1.0f, 1.0f, 0.0f, 0.001f, 10.0f);
            this.modelview = Matrix4.Identity * Matrix4.CreateTranslation(0.0f, 0.0f, -1.0f);
        }
Beispiel #3
0
        void LightingCombiner_Loading(object sender, EventArgs e)
        {
            this.gbuffer.SetSlot(0, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.HalfFloat));  // colour: rgb, material
            this.gbuffer.SetSlot(1, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.HalfFloat));  // normal+?
            this.gbuffer.SetSlot(2, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba, PixelFormat.Rgba, PixelType.UnsignedByte));  // shading: [reflection|roughness], specexp, specpwr, sparkle
            this.gbuffer.SetSlot(3, new GBuffer.TextureSlotParam(PixelInternalFormat.Rgba, PixelFormat.Rgba, PixelType.UnsignedByte));  // lighting - shadow, AO, emmissive, subsurface

            this.gbuffer.Init(this.Width, this.Height);

            Reload();

            this.gbufferCombiner = new GBufferCombiner(this.gbuffer, this.program);
        }
        void HDRExposureMapper_Loading(object sender, EventArgs e)
        {
            this.gbuffer.SetSlot(0,
                new GBuffer.TextureSlotParam(TextureTarget.Texture2D, PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.HalfFloat, false,
                new List<ITextureParameter>
                {
                    new TextureParameterInt(TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear),
                    new TextureParameterInt(TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear),
                    new TextureParameterInt(TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge),
                    new TextureParameterInt(TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge)
                }));  // colour
            this.gbuffer.Init(this.Width, this.Height);

            this.gbufferCombiner = new GBufferCombiner(this.gbuffer);
            this.Reload();

            this.projection = Matrix4.CreateOrthographicOffCenter(0.0f, 1.0f, 0.0f, 1.0f, 0.001f, 10.0f);
            this.modelview = Matrix4.Identity * Matrix4.CreateTranslation(0.0f, 0.0f, -1.0f);

            this.histogramTexture.SetParameter(new TextureParameterInt(TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest));
            this.histogramTexture.SetParameter(new TextureParameterInt(TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest));
            this.histogramTexture.SetParameter(new TextureParameterInt(TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge));
            this.histogramTexture.SetParameter(new TextureParameterInt(TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge));
            this.histogramTexture.UploadEmpty();
        }
Beispiel #5
0
        private void AAPostProcess_Loading(object sender, EventArgs e)
        {
            vertexVBO = ScreenTri.Vertices().ToVBO();
            indexVBO = ScreenTri.Indices().ToVBO();

            this.sourcegbuffer.SetSlot(0, new GBuffer.TextureSlotParam(TextureTarget.Texture2D, PixelInternalFormat.Rgba, PixelFormat.Rgba, PixelType.UnsignedByte, false, new List<ITextureParameter>
                {
                    new TextureParameterInt(TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear),
                    new TextureParameterInt(TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear),
                    new TextureParameterInt(TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge),
                    new TextureParameterInt(TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge)
                }));
            this.sourcegbuffer.Init(this.Width, this.Height);

            InitTextures();

            this.destinationgbuffer.SetSlot(0, frame[0]);
            this.destinationgbuffer.Init(this.Width, this.Height);

            this.gbufferCombiner = new GBufferCombiner(this.sourcegbuffer);
            this.Reload();
        }
Beispiel #6
0
        private void SetupGBufferCombiner()
        {
            var program = new ShaderProgram("combiner");

            program.Init(
                @"GBufferCombine.vert",
                @"GBufferCombine.frag",
                new List<Variable>
                {
                    new Variable(0, "vertex"),
                    new Variable(1, "in_texcoord0")
                });

            this.gbufferCombiner = new GBufferCombiner(this.gbuffer, program);
        }