//------------------------------------------------------
        // Render
        //------------------------------------------------------

        public void render(
            fx_Quad quad,
            Texture normal_texture,
            Texture diffuse_texture,
            Texture specular_texture,
            Vector3 sun_position,
            Texture shadowDepthTexture)
        {
            //------------------------------------------------------
            // Render Atmoshpere
            //------------------------------------------------------

            _fAtmosphere.bind(DrawBuffersEnum.ColorAttachment0);

            GL.Viewport(0, 0, _resolution.W, _resolution.H);
            _pAtmoshpere.bind();

            _tTransmittance.bind(_pAtmoshpere.getUniform("transmittanceSampler"), 0);
            _tIrradiance.bind(_pAtmoshpere.getUniform("irradianceSampler"), 1);
            _tInscatter.bind(_pAtmoshpere.getUniform("inscatterSampler"), 2);

            normal_texture.bind(_pAtmoshpere.getSamplerUniform(0), 3);
            diffuse_texture.bind(_pAtmoshpere.getSamplerUniform(1), 4);
            specular_texture.bind(_pAtmoshpere.getSamplerUniform(2), 5);
            shadowDepthTexture.bind(_pAtmoshpere.getSamplerUniform(3), 6);

            sun_position = Vector3.Normalize(sun_position);
            GL.Uniform3(_pAtmoshpere.getUniform("sun_position"), sun_position);

            quad.renderFullQuad();
        }
Esempio n. 2
0
        public void rayTracing(fx_Quad quad, SpatialData camera_spatial)
        {
            if (!(_debug_display_voxels && _enabled))
            {
                return;
            }

            mipMap();

            GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, 0);
            GL.Clear(ClearBufferMask.ColorBufferBit);

            GL.Viewport(0, 0, _resolution.W, _resolution.H);


            _pRayTrace.bind();

            GL.Uniform1(_pRayTrace.getUniform("vx_volume_dimensions"), _vx_volume_dimensions);

            Vector3 vx_position_snapped   = -voxelSnap(camera_spatial.position);
            Matrix4 voxel_volume_position = Matrix4.CreateTranslation(vx_position_snapped);

            Matrix4 invMVP = Matrix4.Invert(_vx_shift_matrix * voxel_volume_position * camera_spatial.model_view * camera_spatial.perspective);

            GL.UniformMatrix4(_pRayTrace.getUniform("vx_inv_view_perspective"), false, ref invMVP);

            GL.Uniform1(_pRayTrace.getUniform("displayMipLevel"), _debug_display_voxels_mip_level);


            _tVoxelVolume.bind(_pRayTrace.getSamplerUniform(0), 0);


            quad.renderFullQuad();
        }
Esempio n. 3
0
        public void render(fx_Quad quad, FrameBuffer gbuffer_fbo, Vector3 circadian_position)
        {
            // Write into gBuffer's frame buffer attachemnts
            gbuffer_fbo.bind(new DrawBuffersEnum[]
            {
                DrawBuffersEnum.ColorAttachment0,
                DrawBuffersEnum.ColorAttachment1,
                DrawBuffersEnum.ColorAttachment3
            });
            GL.Viewport(0, 0, _resolution.W, _resolution.H);

            GL.DepthMask(true);
            GL.Enable(EnableCap.DepthTest);

            _pSkyBox.bind();

            _iSkyBox.bind(_pSkyBox.getSamplerUniform(0), 0);
            GL.Uniform3(_pSkyBox.getUniform("circadian_position"), Vector3.Normalize(circadian_position));

            quad.renderFullQuad();
        }
Esempio n. 4
0
        public void coneTracing(fx_Quad quad, Texture diffuse_texture, Texture normal_texture, Texture specular_texture, SpatialData camera_spatial)
        {
            if (!_enabled)
            {
                _tConeTrace_Diffuse.clear();
                return;
            }

            mipMap();


            _fConeTrace.bind(DrawBuffersEnum.ColorAttachment0);

            GL.Viewport(0, 0, _tConeTrace_Diffuse.width, _tConeTrace_Diffuse.height);

            _pConeTrace.bind();

            GL.Uniform1(_pConeTrace.getUniform("vx_volume_dimensions"), _vx_volume_dimensions);
            GL.Uniform1(_pConeTrace.getUniform("vx_volume_scale"), _vx_volume_scale);

            Vector3 vx_position_snapped   = -voxelSnap(camera_spatial.position);
            Matrix4 voxel_volume_position = Matrix4.CreateTranslation(vx_position_snapped);

            GL.Uniform3(_pConeTrace.getUniform("vx_volume_position"), vx_position_snapped);

            GL.Uniform1(_pConeTrace.getUniform("maxMipLevels"), _tVoxelVolume.getMaxMipMap());

            normal_texture.bind(_pConeTrace.getSamplerUniform(0), 0);
            specular_texture.bind(_pConeTrace.getSamplerUniform(1), 1);
            diffuse_texture.bind(_pConeTrace.getSamplerUniform(2), 2);

            _tVoxelVolume.bind(_pConeTrace.getSamplerUniform(3), 3);


            quad.renderFullQuad();
        }