public GlobalIlluminationRenderer(Device device, Vector3 sceneBoundsMin, Vector3 sceneBoundsMax)
        {
            m_CubeObject      = TextureObject.CreateCubeTexture(device, 128, 128, 1, Format.R16G16B16A16_Float, false, true);
            m_CubeObjectDepth = TextureObject.CreateCubeTexture(device, 128, 128, 1, Format.R32_Typeless, true, true);

            if (System.IO.File.Exists("textures\\givolumer.dds"))
            {
                m_GIVolumeR = TextureObject.CreateTexture3DFromFile(device, VolumeSizeX, VolumeSizeY, VolumeSizeZ, Format.R16G16B16A16_Float, "textures\\givolumer.dds");
                m_GIVolumeG = TextureObject.CreateTexture3DFromFile(device, VolumeSizeX, VolumeSizeY, VolumeSizeZ, Format.R16G16B16A16_Float, "textures\\givolumeg.dds");
                m_GIVolumeB = TextureObject.CreateTexture3DFromFile(device, VolumeSizeX, VolumeSizeY, VolumeSizeZ, Format.R16G16B16A16_Float, "textures\\givolumeb.dds");
            }
            else
            {
                m_GIVolumeR = TextureObject.CreateTexture3D(device, VolumeSizeX, VolumeSizeY, VolumeSizeZ, Format.R16G16B16A16_Float);
                m_GIVolumeG = TextureObject.CreateTexture3D(device, VolumeSizeX, VolumeSizeY, VolumeSizeZ, Format.R16G16B16A16_Float);
                m_GIVolumeB = TextureObject.CreateTexture3D(device, VolumeSizeX, VolumeSizeY, VolumeSizeZ, Format.R16G16B16A16_Float);
            }


            m_InitialSHSet = RenderTargetSet.CreateRenderTargetSet(device, 128, 128, Format.R16G16B16A16_Float, 3, false);

            m_Downsampled16x16SHSetR = RenderTargetSet.CreateRenderTargetSet(device, 32, 32, Format.R16G16B16A16_Float, 1, false);
            m_Downsampled16x16SHSetG = RenderTargetSet.CreateRenderTargetSet(device, 32, 32, Format.R16G16B16A16_Float, 1, false);
            m_Downsampled16x16SHSetB = RenderTargetSet.CreateRenderTargetSet(device, 32, 32, Format.R16G16B16A16_Float, 1, false);

            m_Downsampled4x4SHSetR = RenderTargetSet.CreateRenderTargetSet(device, 8, 8, Format.R16G16B16A16_Float, 1, false);
            m_Downsampled4x4SHSetG = RenderTargetSet.CreateRenderTargetSet(device, 8, 8, Format.R16G16B16A16_Float, 1, false);
            m_Downsampled4x4SHSetB = RenderTargetSet.CreateRenderTargetSet(device, 8, 8, Format.R16G16B16A16_Float, 1, false);

            m_GIConstantBuffer = ShaderManager.CreateConstantBufferInstance("GIConstantBuffer", device);

            m_SceneBoundsMin = sceneBoundsMin;
            m_SceneBoundsMax = sceneBoundsMax;
        }
示例#2
0
        public void Initialize(Device device)
        {
            m_VolumeX = (int)ShaderManager.GetUIntShaderDefine("VOLUME_WIDTH");
            m_VolumeY = (int)ShaderManager.GetUIntShaderDefine("VOLUME_HEIGHT");
            m_VolumeZ = (int)ShaderManager.GetUIntShaderDefine("VOLUME_DEPTH");

            m_DensityTexture      = TextureObject.CreateTexture3D(device, m_VolumeX, m_VolumeY, m_VolumeZ, Format.R16_Float);
            m_LightingTexturePing = TextureObject.CreateTexture3D(device, m_VolumeX, m_VolumeY, m_VolumeZ, Format.R16G16B16A16_Float);
            m_LightingTexturePong = TextureObject.CreateTexture3D(device, m_VolumeX, m_VolumeY, m_VolumeZ, Format.R16G16B16A16_Float);
            m_ScatteringTexture   = TextureObject.CreateTexture3D(device, m_VolumeX, m_VolumeY, m_VolumeZ, Format.R16G16B16A16_Float);
        }