浏览代码

Probe Cache: Fixed conversion shader to use the proper mip when input texture was not the right size.

/Add-support-for-light-specular-color-tint
Julien Ignace 7 年前
当前提交
b4a35f1f
共有 4 个文件被更改,包括 9 次插入3 次删除
  1. 3
      ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader
  2. 9
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/ReflectionProbeCache.cs
  3. 0
      /ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader.meta
  4. 0
      /ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader

3
ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader


SAMPLERCUBE(sampler_InputTex);
float _FaceIndex;
float _LoD;
struct Attributes
{

float4 frag (Varyings input) : SV_Target
{
return SAMPLE_TEXTURECUBE(_InputTex, sampler_InputTex, input.texcoord);
return SAMPLE_TEXTURECUBE_LOD(_InputTex, sampler_InputTex, input.texcoord, _LoD);
}
ENDHLSL

9
ScriptableRenderPipeline/HDRenderPipeline/Lighting/ReflectionProbeCache.cs


{
public class ReflectionProbeCache
{
internal static readonly int s_InputTexID = Shader.PropertyToID("_InputTex");
internal static readonly int s_LoDID = Shader.PropertyToID("_LoD");
internal static readonly int s_FaceIndexID = Shader.PropertyToID("_FaceIndex");
enum ProbeFilteringState
{
Convolving,

// We can't use Graphics.ConvertTexture here because it does not work with a RenderTexture as destination.
void ConvertTexture(CommandBuffer cmd, Texture input, RenderTexture target)
{
m_ConvertTextureMPB.SetTexture("_InputTex", input);
m_ConvertTextureMPB.SetTexture(s_InputTexID, input);
m_ConvertTextureMPB.SetFloat(s_LoDID, 0.0f); // We want to convert mip 0 to whatever the size of the destination cache is.
m_ConvertTextureMPB.SetFloat("_FaceIndex", (float)f);
m_ConvertTextureMPB.SetFloat(s_FaceIndexID, (float)f);
CoreUtils.SetRenderTarget(cmd, target, ClearFlag.None, Color.black, 0, (CubemapFace)f);
CoreUtils.DrawFullScreen(cmd, m_ConvertTextureMaterial, m_ConvertTextureMPB);
}

/ScriptableRenderPipeline/Core/Resources/ConvertTexture.shader.meta → /ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader.meta

/ScriptableRenderPipeline/Core/Resources/ConvertTexture.shader → /ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader

正在加载...
取消
保存