|
|
|
|
|
|
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; |
|
|
|