浏览代码

fix refl shader compile errors due to roughness/perceptualRoughness

fix refl shader compile errors due to roughness/perceptualRoughness
/main
mmikk 8 年前
当前提交
c7d5b507
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 16
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredReflections.shader

16
Assets/ScriptableRenderLoop/fptl/Internal-DeferredReflections.shader


sampleDir = worldNormalRefl;
Unity_GlossyEnvironmentData g;
g.roughness = SmoothnessToPerceptualRoughness(data.smoothness);
g.perceptualRoughness = SmoothnessToPerceptualRoughness(data.smoothness);
g.reflUVW = sampleDir;
half3 env0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBEARRAY(_reflCubeTextures), lgtDat.iSliceIndex, float4(lgtDat.fLightIntensity, lgtDat.fDecodeExp, 0.0, 0.0), g);

{
#if UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 && (SHADER_TARGET >= 30)
// TODO: remove pow, store cubemap mips differently
half roughness = pow(glossIn.perceptualRoughness, 3.0/4.0);
half perceptualRoughness = pow(glossIn.perceptualRoughness, 3.0/4.0);
half roughness = glossIn.roughness; // MM: switched to this
half perceptualRoughness = glossIn.perceptualRoughness; // MM: switched to this
//roughness = sqrt(sqrt(2/(64.0+2))); // spec power to the square root of real roughness
//perceptualRoughness = sqrt(sqrt(2/(64.0+2))); // spec power to the square root of real roughness
float m = roughness*roughness; // m is the real roughness parameter
float m = perceptualRoughness*perceptualRoughness; // m is the real roughness parameter
roughness = pow( 2/(n+2), 0.25); // remap back to square root of real roughness
perceptualRoughness = pow( 2/(n+2), 0.25); // remap back to square root of real roughness
roughness = roughness*(1.7 - 0.7*roughness);
perceptualRoughness = perceptualRoughness*(1.7 - 0.7*perceptualRoughness);
half mip = roughness * UNITY_SPECCUBE_LOD_STEPS;
half mip = perceptualRoughness * UNITY_SPECCUBE_LOD_STEPS;
half4 rgbm = UNITY_SAMPLE_TEXCUBEARRAY_LOD(tex, float4(glossIn.reflUVW.xyz, sliceIndex), mip);
//return rgbm.xyz;

正在加载...
取消
保存