浏览代码

fix texture/sampler naming scheme for WIND_SETTINGS_TexNoise/WIND_SETTINGS_TexGust, fixes pixelized trees issue with Fontainebleau on metal

/main
Antti Tapaninen 7 年前
当前提交
84d9c9ea
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 8
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Wind.hlsl
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Wind/ShaderWindSettings.cs

8
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Wind.hlsl


// TODO: no global variable or resource declarations in the Shader Library. Functions and macros only!
TEXTURE2D(WIND_SETTINGS_TexNoise);
TEXTURE2D(_WIND_SETTINGS_TexNoise);
TEXTURE2D(WIND_SETTINGS_TexGust);
TEXTURE2D(_WIND_SETTINGS_TexGust);
SAMPLER(sampler_WIND_SETTINGS_TexGust);
float4 WIND_SETTINGS_WorldDirectionAndSpeed;

float3 texNoise(float3 worldPos, float LOD)
{
return SAMPLE_TEXTURE2D_LOD(WIND_SETTINGS_TexNoise, sampler_WIND_SETTINGS_TexNoise, worldPos.xz, LOD).xyz -0.5;
return SAMPLE_TEXTURE2D_LOD(_WIND_SETTINGS_TexNoise, sampler_WIND_SETTINGS_TexNoise, worldPos.xz, LOD).xyz -0.5;
return SAMPLE_TEXTURE2D_LOD(WIND_SETTINGS_TexGust, sampler_WIND_SETTINGS_TexGust, worldPos.xz, LOD).x;
return SAMPLE_TEXTURE2D_LOD(_WIND_SETTINGS_TexGust, sampler_WIND_SETTINGS_TexGust, worldPos.xz, LOD).x;
}

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Wind/ShaderWindSettings.cs


void ApplySettings()
{
Shader.SetGlobalTexture("WIND_SETTINGS_TexNoise", NoiseTexture);
Shader.SetGlobalTexture("WIND_SETTINGS_TexGust", GustMaskTexture);
Shader.SetGlobalTexture("_WIND_SETTINGS_TexNoise", NoiseTexture);
Shader.SetGlobalTexture("_WIND_SETTINGS_TexGust", GustMaskTexture);
Shader.SetGlobalVector("WIND_SETTINGS_WorldDirectionAndSpeed", GetDirectionAndSpeed());
Shader.SetGlobalFloat("WIND_SETTINGS_FlexNoiseScale", 1.0f / Mathf.Max(0.01f, FlexNoiseWorldSize));
Shader.SetGlobalFloat("WIND_SETTINGS_ShiverNoiseScale", 1.0f / Mathf.Max(0.01f, ShiverNoiseWorldSize));

正在加载...
取消
保存