From 4f24d862c0568b28547b9803b3b05aa181b8667f Mon Sep 17 00:00:00 2001 From: ACiiL Date: Sun, 20 Sep 2020 13:40:33 -0600 Subject: [PATCH] update to v1.3 --- Assets/shaders/aciil/ACLS/ACLS_CORE.cginc | 345 ++++++++++-------- Assets/shaders/aciil/ACLS/ACLS_HELPERS.cginc | 18 +- .../aciil/ACLS/ACLS_base_cutout.shader | 15 +- .../aciil/ACLS/ACLS_base_cutoutAlpha.shader | 15 +- .../ACLS/ACLS_base_cutoutAlphaDither.shader | 15 +- .../shaders/aciil/ACLS/ACLS_base_solid.shader | 15 +- .../aciil/ACLS/Editor/ACLSInspector.cs | 36 +- Assets/shaders/aciil/ACLS/Editor/ACLStyles.cs | 19 +- 8 files changed, 297 insertions(+), 181 deletions(-) diff --git a/Assets/shaders/aciil/ACLS/ACLS_CORE.cginc b/Assets/shaders/aciil/ACLS/ACLS_CORE.cginc index c13f947..0062626 100644 --- a/Assets/shaders/aciil/ACLS/ACLS_CORE.cginc +++ b/Assets/shaders/aciil/ACLS/ACLS_CORE.cginc @@ -84,7 +84,11 @@ uniform half _Set_SystemShadowsToBase; uniform half _Is_UseTweakHighColorOnShadow; uniform half _Tweak_SystemShadowsLevel; - uniform half _shaSatRatio; + uniform int _shadowUseCustomRampNDL; + uniform half _shadowNDLStep; + uniform half _shadowNDLFeather; + uniform half _shadowMaskPinch; + uniform int _shadowSplits; uniform half _highColTexSource; uniform half _Tweak_HighColorMaskLevel; @@ -105,6 +109,7 @@ uniform half _RimLight_InsideMask; uniform half _Tweak_LightDirection_MaskLevel; + uniform int _useCubeMap; uniform int _ENVMmode; uniform half _ENVMix; uniform half _envRoughness; @@ -142,11 +147,6 @@ uniform int _CubemapFallbackMode; uniform float _EnvGrazeMix; uniform int _EnvGrazeRimMix; - // uniform float _AO_shadePosFront_Offset; - // uniform float _AO_shadePosBack_Offset; - // uniform float _Occlusion_Spec; - // uniform float _Occlusion_Rim; - // uniform float _Occlusion_MatAdd; uniform int _ToonRampLightSourceType_Backwards; uniform half _diffuseIndirectDirectSimMix; uniform int _UseSpecularSystem; @@ -161,6 +161,7 @@ uniform half _indirectGIBlur; uniform half _emissiveUseMainTexA; uniform half _emissiveUseMainTexCol; + uniform half _rimLightLightsourceType; @@ -284,8 +285,8 @@ { // UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); UNITY_SETUP_INSTANCE_ID(i); - - int isBackFace = !frontFace; + bool isAmbientOnlyMap = !(any(_LightColor0.rgb)); + bool isBackFace = !frontFace; i.wNormal = normalize( i.wNormal); if(isBackFace) { //// flip normal for back faces. i.wNormal = -i.wNormal; @@ -473,24 +474,34 @@ // float lightAtten = LIGHT_ATTENUATION(i); // UNITY_LIGHT_ATTENUATION(lightAtten, i, i.worldPos.xyz); UNITY_LIGHT_ATTENUATION_NOSHADOW(lightAtten, i, i.worldPos.xyz); - if ( !(any(_LightColor0.rgb))) /// lightAtten is random in scenes without directional lights. Using this raw is unstable so we correct when lacking light color. + if (isAmbientOnlyMap) /// lightAtten is random in scenes without directional lights. Using this raw is unstable so we correct when lacking light color. { lightAtten = 1; } - float shadowFullTrue = lightAtten; - lightAtten = smoothstep(0, 0.6, lightAtten); float shadowAtten = lightAtten; #else // float lightAtten = LIGHT_ATTENUATION(i); // UNITY_LIGHT_ATTENUATION(lightAtten, i, i.worldPos.xyz); UNITY_LIGHT_ATTENUATION_NOSHADOW(lightAtten, i, i.worldPos.xyz); float shadowAtten = UNITY_SHADOW_ATTENUATION(i, i.worldPos.xyz); - float shadowFullTrue = shadowAtten; - shadowAtten = smoothstep(0, 0.6, shadowAtten); #endif - //// regraph shadow fridge - // float nShadowAtten = 1 - shadowAtten; - // shadowAtten = ( (-(nShadowAtten * nShadowAtten) + 1)); + shadowAtten = smoothstep(0, 0.6, shadowAtten); //// clean up artifacts + if (_shadowUseCustomRampNDL) //// nDl shadow + { + half nDlSha = dot(dirNormalToonRamp, dirLight) *.5+.5; + nDlSha = StepFeatherRemap(nDlSha, _shadowNDLStep, _shadowNDLFeather); + shadowAtten = (shadowAtten * nDlSha); + // shadowAtten = min(shadowAtten, nDlSha); + } + if (_shadowMaskPinch || _shadowSplits) + { + shadowAtten = smoothstep(0, (1 - _shadowMaskPinch), shadowAtten); + } + if (_shadowSplits) + { + shadowAtten = round(shadowAtten * _shadowSplits) / _shadowSplits; + } + // return float4(shadowAtten.xxx,1); float attenRamp = shadowAtten; //// shadow influance for masking some effects. float shadowMask, shadowMaskSharp; @@ -500,6 +511,26 @@ +//// setup shadow darkness control + //// setup dynamic shadow limits + float shadowAttenuation = shadowAtten; + float shadowBlackness = 0; + float shadowMinPotential = 0; + UNITY_BRANCH + if ( (_shadowCastMin_black) || !(_DynamicShadowMask_TexelSize.z <16)) + { + float dynamicShadowMask = _DynamicShadowMask.SampleGrad(sampler_MainTex_trilinear_repeat, uv_toon.uv, uv_toon.dx, uv_toon.dy).g; + float tmp = max(_shadowCastMin_black, dynamicShadowMask); + shadowBlackness = saturate( (shadowAttenuation + tmp)/(1 - tmp)); + // shadowMinPotential = saturate( (_LightShadowData.x + tmp)/(1 - tmp)); + } else + { + shadowBlackness = shadowAttenuation; + } + // return float4(shadowBlackness.xxx,1); + + + //// toon ramp, prepare ramp masks //// toon ramp AO masks. These down ramp as to "force shadow". float shadowTex_1 = 1; @@ -568,43 +599,27 @@ shadeRamp_n2 = 1 + shadeRamp_n2 * -shadowTex_2 / ( _1st2nd_Shades_Feather ); shadeRamp_n2 = saturate(shadeRamp_n2); // return float4(shadeRamp_n2.xxx,1); -//// end toon ramp mask setup -//// setup shadow darkness control - //// setup dynamic shadow limits - float shadowAttenuation = shadowAtten; - float shadowBlackness = 0; - float shadowMinPotential = 0; - UNITY_BRANCH - if ( (_shadowCastMin_black) || !(_DynamicShadowMask_TexelSize.z <16)) - { - float dynamicShadowMask = _DynamicShadowMask.SampleGrad(sampler_MainTex_trilinear_repeat, uv_toon.uv, uv_toon.dx, uv_toon.dy).g; - float tmp = max(_shadowCastMin_black, dynamicShadowMask); - shadowBlackness = saturate( (shadowAttenuation + tmp)/(1 - tmp)); - // shadowMinPotential = saturate( (_LightShadowData.x + tmp)/(1 - tmp)); - } else - { - shadowBlackness = shadowAttenuation; - } - // return float4(shadowBlackness.xxx,1); - - - -//// collect scene light sources +//// collect scene light sources. sLight #ifdef UNITY_PASS_FORWARDBASE + //// prepare cubemap albedo support lighting + half3 refGIcol = shadeSH9LinearAndWhole(float4(normalize(i.wNormal + dEnv.dirViewReflection),1)); //// gi light at a weird angle + half3 colGIGray = LinearRgbToLuminance_ac(refGIcol); + // return float4(dot(normalize(i.wNormal + dEnv.dirViewReflection),dirLight).xxx*.5+.5,1); + //// get vertex lighting + half3 vertexLit = i.vertexLighting; //// build indirect light source - float3 lightIndirectColAve = DecodeLightProbe_average(); //// average light from raw L0 - float3 lightIndirectColMax = SHEvalDirectL1(float4(i.dirGI,1)); //// direct most light raw L1 - float3 lightIndirectColStatic = 0, lightIndirectColDir = 0; - if ((_indirectGIDirectionalMix) < 1) + half3 lightIndirectColAve = DecodeLightProbe_average(); //// L0 Average light + half3 lightIndirectColL1 = max(0, SHEvalDirectL1(normalize(i.dirGI))); //// L1 raw. Add to L0 as max color of GI + half3 lightIndirectColStatic = 0, lightIndirectColDir = 0; + // if ((_indirectGIDirectionalMix) < 1) + if (true) { - half GI_Max = LinearRgbToLuminance_ac(lightIndirectColMax), GI_Ave = LinearRgbToLuminance_ac(lightIndirectColAve); - half GI_MaxAveDif = ((GI_Max * _indirectAlbedoMaxAveScale) - GI_Ave); - half GI_MaxAveSum = GI_Max + GI_Ave; - half GI_MaxAveRatio = saturate(GI_MaxAveDif / GI_MaxAveSum); - lightIndirectColStatic = lerp(lightIndirectColMax, lightIndirectColAve, GI_MaxAveRatio); + half3 stackIndirectMaxL0L1 = lightIndirectColL1 + lightIndirectColAve; + half ratioCols = ratioOfColors(stackIndirectMaxL0L1, lightIndirectColAve, _indirectAlbedoMaxAveScale); + lightIndirectColStatic = lerp(stackIndirectMaxL0L1, lightIndirectColAve, ratioCols); } if (_indirectGIDirectionalMix > 0) { @@ -612,32 +627,128 @@ lightIndirectColDir = max(0, ShadeSH9_ac(indirectGIDirectionBlur)) / (indirectGIDirectionBlur.w); // float3 lightIndirectColAngle = shadeSH9LinearAndWhole(float4(i.wNormal,1)); //// not blur adaptiable without intense math } - float3 lightIndirectCol = lerp(lightIndirectColStatic, lightIndirectColDir, _indirectGIDirectionalMix); + half3 lightIndirectCol = lerp(lightIndirectColStatic, lightIndirectColDir, _indirectGIDirectionalMix); + // return float4(lightIndirectCol,1); + //// build direct light source - float3 lightDirect = _LightColor0.rgb; - float3 lightDirectSave = lightDirect; + half3 lightDirect = _LightColor0.rgb; //// build ambient LUM for reflection types - float lightAverageLum = LinearRgbToLuminance_ac((lightDirectSave * _LightShadowData.x * .5) + lightDirectSave + (lightIndirectCol)) * .34; - float3 vertexLit = i.vertexLighting; - //// out light source by types - float3 lightDirectSource = (mixColorsMaxAve(lightIndirectColMax, lightDirect) + vertexLit) * _directLightIntensity; - float3 lightIndirectSource = (lightIndirectCol + vertexLit); + //// build indirect light + half3 lightIndirectSource = (lightIndirectCol + vertexLit); + //// build direct light + half3 lightDirectSource = 0; +if (isAmbientOnlyMap) //// this setup sucks for preserving Direct light effects +{ + if (any(lightIndirectColL1)) //// L1 in pure ambient maps is black. Recover by spliting indirect energy. + { + lightDirectSource = lightIndirectColL1; + } + else + { + lightDirectSource = lightIndirectColAve * .2; + lightIndirectCol = lightIndirectColAve * .7; + } +} +else +{ + lightDirectSource = lightDirect; +} + lightDirectSource = (lightDirectSource + vertexLit) * _directLightIntensity; + // float3 lightDirectSource = (mixColorsMaxAve(lightIndirectColL1, lightDirect) + vertexLit) * _directLightIntensity; + #elif UNITY_PASS_FORWARDADD - float3 lightIndirectColAve = 0; - float3 lightIndirectColAngle = 0; - float3 lightDirect = _LightColor0.rgb; - float3 lightDirectSave = lightDirect; - lightDirect *= lightAtten; - float lightAverageLum = lightAtten * LinearRgbToLuminance_ac((lightDirectSave * _LightShadowData.x * .5) + lightDirectSave) * .5; - // float colSceneAmbientLum = LinearRgbToLuminance_ac(lightDirect); - // float colorIntSignal = 0; + float3 lightDirect = _LightColor0.rgb; + lightDirect *= lightAtten; //// out light source by types float3 lightDirectSource = lightDirect * _directLightIntensity; float3 lightIndirectSource = 0; #endif +//// simple light systems reused. slsys + half3 lightSimpleSystem = (lightDirectSource * shadowBlackness) + lightIndirectSource; + lightDirect = _LightColor0.rgb; +#ifdef UNITY_PASS_FORWARDBASE + half3 cubeMapAveAlbedo = ((lightDirect * _LightShadowData.x * .5) + lightDirect + lightIndirectCol) * .34; + half lightAverageLum = LinearRgbToLuminance_ac((lightDirect * _LightShadowData.x * .5) + lightDirect + (lightIndirectCol)) * .34; +#elif UNITY_PASS_FORWARDADD + half3 cubeMapAveAlbedo = ((lightDirect * _LightShadowData.x * .5) + lightDirect) * .5 * lightAtten; + half lightAverageLum = LinearRgbToLuminance_ac((lightDirect * _LightShadowData.x * .5) + lightDirect) * .5 * lightAtten; +#endif + + + +//// toon ramp color setup + //// Albedo variable remap zone of pain. + // get albedo samples + half3 albedoCol_1 = mainTex.rgb; + half3 albedoCol_2 = shadeMapTex_1.rgb; + half3 albedoCol_3 = shadeMapTex_2.rgb; + // + half3 shadeCol_1 = _0_ShadeColor.rgb * _Color.rgb; + half3 shadeCol_2 = _1st_ShadeColor.rgb * _Color.rgb; + half3 shadeCol_3 = _2nd_ShadeColor.rgb * _Color.rgb; + +//// Toon albedo and ramp mixer + half3 toonMix_bright_albedo = lerp(albedoCol_1, albedoCol_2, shadeRamp_n1); + half3 toonMix_dark_albedo = lerp(albedoCol_2, albedoCol_3, shadeRamp_n2); + //// mix scene colors per ramp region + // if (isAmbientOnlyMap) //// overbright correction. Indirect was put in Direct light and thus 2x albedo + // { + // } + if (_ToonRampLightSourceType_Backwards > 0) //// diffuse lighting: backface area is part of shadow thus indirect light only + { + half n2ShadowMask = 1 - min((1-shadeRamp_n2), shadowBlackness); + shadeRamp_n2 = n2ShadowMask; //// cover Backward Area with dynamic shadow mask + + lightSimpleSystem = (lightDirectSource * (1-shadeRamp_n2)) + lightIndirectSource; //// match backface-is-dark mode + + half3 lDSAdjest = lightDirectSource; + // if (isAmbientOnlyMap) //// reducing an albedo surplus as direct came from indirect + // { + // lDSAdjest *= .5; + // } + half3 lightDirectSim = (lDSAdjest * shadowBlackness) + lightIndirectSource; + shadeCol_1 *= lightDirectSim; + shadeCol_2 *= lightDirectSim; + shadeCol_3 *= lerp(lightIndirectSource, lightDirectSim, _diffuseIndirectDirectSimMix); + } else //// diffuse lighting: surface uses entire albedo + { + half3 lDSAdjest = lightDirectSource; + // if (isAmbientOnlyMap) //// reducing an albedo surplus as direct came from indirect + // { + // lDSAdjest *= .5; + // } + half3 lightDirectSim = (lDSAdjest * shadowBlackness) + lightIndirectSource; + half3 lSSAdjest = lightDirectSim; + // if (isAmbientOnlyMap) //// removing an albedo surplus as direct came from indirect + // { + // lSSAdjest *= .5; + // } + shadeCol_1 *= lSSAdjest; + shadeCol_2 *= lSSAdjest; + shadeCol_3 *= lSSAdjest; + } + half3 toonMix_bright_mix = lerp(shadeCol_1, shadeCol_2, shadeRamp_n1); + half3 toonMix_dark_mix = lerp(shadeCol_2, shadeCol_3, shadeRamp_n2); + + // return float4(shadeRamp_n1, shadeRamp_n2,0,1); + half diff_GSF = 0; + UNITY_BRANCH + if (_Diff_GSF_01) + { + diff_GSF = -GSF_Diff_ac(dDiff.ndl, dDiff.ndv, dDiff.ldhS) + 1; + diff_GSF = StepFeatherRemap(diff_GSF, _DiffGSF_Offset, _DiffGSF_Feather); + } + else { + diff_GSF = min(shadeRamp_n1, shadeRamp_n2); + } + half3 shadeColor_albedo = lerp(toonMix_bright_albedo, toonMix_dark_albedo, diff_GSF);//// textures + half3 shadeColor_mix = lerp(toonMix_bright_mix, toonMix_dark_mix, diff_GSF);//// ramp + half3 shadeColor = shadeColor_albedo * shadeColor_mix;//// mix ramp + // return float4(shadeColor,1); + //// matcap float matcapMask = 1; float matcapShaMask = 1; @@ -688,60 +799,6 @@ - - -//// toon ramp color setup - //// Albedo variable remap zone of pain. - // get albedo samples - float3 albedoCol_1 = mainTex.rgb; - float3 albedoCol_2 = shadeMapTex_1.rgb; - float3 albedoCol_3 = shadeMapTex_2.rgb; - // - float3 shadeCol_1 = _0_ShadeColor.rgb * _Color.rgb; - float3 shadeCol_2 = _1st_ShadeColor.rgb * _Color.rgb; - float3 shadeCol_3 = _2nd_ShadeColor.rgb * _Color.rgb; - -//// Toon albedo and ramp mixer - float3 toonMix_bright_albedo = lerp(albedoCol_1, albedoCol_2, shadeRamp_n1); - float3 toonMix_dark_albedo = lerp(albedoCol_2, albedoCol_3, shadeRamp_n2); - //// mix scene colors per ramp region - //// how ambient light mixes affects both feedin of shadow attenuation and lighting selection - if (_ToonRampLightSourceType_Backwards > 0) //// diffuse lighting: backface ramp is part of shadow - { - float n2ShadowMask = 1 - min((1-shadeRamp_n2), shadowBlackness); - shadeRamp_n2 = n2ShadowMask; //// make Backward Area be forced Dynamic shadow from its wrap - float3 lightDirectSim = (lightDirectSource * shadowBlackness) + lightIndirectSource; - shadeCol_1 *= lightDirectSim; - shadeCol_2 *= lightDirectSim; - shadeCol_3 *= lerp(lightIndirectSource, lightDirectSim, _diffuseIndirectDirectSimMix); - } else //// diffuse lighting: shadow is independent of ramp - { - float3 lightDirectSim = (lightDirectSource * shadowBlackness) + lightIndirectSource; - shadeCol_1 *= lightDirectSim; - shadeCol_2 *= lightDirectSim; - shadeCol_3 *= lightDirectSim; - } - float3 toonMix_bright_mix = lerp(shadeCol_1, shadeCol_2, shadeRamp_n1); - float3 toonMix_dark_mix = lerp(shadeCol_2, shadeCol_3, shadeRamp_n2); - - // return float4(shadeRamp_n1, shadeRamp_n2,0,1); - float diff_GSF = 0; - UNITY_BRANCH - if (_Diff_GSF_01) - { - diff_GSF = -GSF_Diff_ac(dDiff.ndl, dDiff.ndv, dDiff.ldhS) + 1; - diff_GSF = StepFeatherRemap(diff_GSF, _DiffGSF_Offset, _DiffGSF_Feather); - } - else { - diff_GSF = min(shadeRamp_n1, shadeRamp_n2); - } - float3 shadeColor_albedo = lerp(toonMix_bright_albedo, toonMix_dark_albedo, diff_GSF);//// textures - float3 shadeColor_mix = lerp(toonMix_bright_mix, toonMix_dark_mix, diff_GSF);//// ramp - float3 shadeColor = shadeColor_albedo * shadeColor_mix;//// mix ramp - // return float4(shadeColor,1); - - - //// specular setup control //// specular tint _highColTexSource _SpecTintMix UV_DD uv_specularMask = UVDD( TRANSFORM_TEX( i.uv, _Set_HighColorMask)); @@ -821,13 +878,11 @@ //// Env Reflection float3 colEnv = 0; - float3 envOntoRimSetup = 1; + float3 envOntoRimSetup = 0; float envRimMask = 0; - float colEnvMask = 1; - float colGIGray = 0; - float LODrange; UNITY_BRANCH - if ((_ENVMmode) || (_envOnRim > 0)) + // if ((_ENVMmode) || ((_envOnRim) && (_rimLightLightsourceType))) + if (_useCubeMap) { float3 reflDir0 = BoxProjection(dEnv.dirViewReflection, i.worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax); float pRoughnessFix; @@ -876,8 +931,7 @@ envLOD = perceptualRoughnessToMipmapLevel_ac(pRoughnessFix, lodMax); float4 colEnvBkup = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(_CubemapFallback, unity_SpecCube0, reflDir0, envLOD); colEnvBkup.rgb = DecodeHDR(colEnvBkup, _CubemapFallback_HDR); - colEnv = colEnvBkup; - colEnv *= lightAverageLum; + colEnv = colEnvBkup * cubeMapAveAlbedo; } } //// natural grazing rim mask @@ -886,13 +940,9 @@ envRimMask = Pow4_ac(1 - dEnv.ndv); } //// env on rim lights - float colEnvGray = LinearRgbToLuminance_ac(colEnv); - envOntoRimSetup = lerp(colEnvGray, colEnv, _envOnRimColorize); - envOntoRimSetup = lerp(1, envOntoRimSetup, _envOnRim); - - //// gi light at a weird angle - float3 refGIcol = shadeSH9LinearAndWhole(float4(normalize(i.wNormal + dEnv.dirViewReflection),1)); - colGIGray = LinearRgbToLuminance_ac(refGIcol); + // float colEnvGray = LinearRgbToLuminance_ac(colEnv); + // envOntoRimSetup = lerp(colEnvGray, colEnv, _envOnRimColorize); + envOntoRimSetup = colEnv; } @@ -995,19 +1045,17 @@ colDiffuse = shadeColor; if (_MatCap){ //// gets scene lighting from toon ramp chain { - float3 lightDirectSim = (shadowBlackness * lightDirectSource) + lightIndirectSource; - // float3 lightDirectSim = (shadowBlackness * lightDirectSource) + lightIndirectSource; float3 diffMixMC = 1; if (_McDiffAlbedoMix) { - diffMixMC = lerp(1, colDiffuse, _McDiffAlbedoMix); + diffMixMC = lerp(1, shadeColor_albedo, _McDiffAlbedoMix); } - colDiffuse = lerp(colDiffuse, (colDiffuse + (diffMixMC * (lightDirectSim * mcMixMult.rgb * _MatCapColMult.rgb * _MatCapColMult.a))), matcapMask); + colDiffuse = lerp(colDiffuse, (colDiffuse + (diffMixMC * lightSimpleSystem * mcMixMult.rgb * _MatCapColMult.rgb) * (_MatCapColMult.a)), matcapMask); } } //// fernel - float3 rimMixer = 0; + float3 rimMixer = 0; //// get effects if (_RimLight) { rimMixer += rimLightCol * rimLightMask; @@ -1016,16 +1064,22 @@ { rimMixer += rimLightApCol * rimlightApMask; } - colFernel = rimMixer; - colFernel *= (lightDirectSource * shadowBlackness) + lightIndirectSource; //// light is lazy combined - colFernel *= envOntoRimSetup; + colFernel = rimMixer; //// get lighting + half3 colFernelLight = 1; + if (true) //// fake function incapsulation + { + colFernelLight = lerp(cubeMapAveAlbedo, envOntoRimSetup, _envOnRim); //// get cubemap setup + colFernelLight = lerp(LinearRgbToLuminance_ac(colFernelLight), colFernelLight, _envOnRimColorize); //// cubemap color + colFernelLight = lerp(lightSimpleSystem, colFernelLight, _rimLightLightsourceType); //// select light system + } + colFernel *= colFernelLight; + // colFernel *= (lightDirectSource * shadowBlackness) + lightIndirectSource; //// light source is lazy combined //// specularity colSpecular = specMaskSetup_1 * aoSpecularM; colSpecular *= FresnelTerm_ac(highColorTotalCol_1, dSpec.ldh); - colSpecular *= (lightDirectSource); //// specular shadow mask is in effect's stack - // colSpecular *= (lightDirectSource * shadowBlackness) + lightIndirectSource; //// specular shadow mask is in effect's stack + colSpecular *= (lightDirectSource); //// light source is Direct light // return float4(colSpecular,1); @@ -1061,7 +1115,9 @@ #endif //// UNITY_PASS_FORWARDBASE //// spec matcap if (_MatCap){ - colReflect += mcMixAdd * _MatCapColAdd.rgb * specularMatcapDes * lightAverageLum * _MatCapColAdd.a * matcapShaMask * aoSpecularM; + half3 mcSpecSourceLight = lerp(lightAverageLum, cubeMapAveAlbedo, 1); //// _MatcapSpecSourceLightMix + colReflect += (mcMixAdd * _MatCapColAdd.rgb * mcSpecSourceLight) * (_MatCapColAdd.a * matcapShaMask * aoSpecularM);\ + // colReflect += mcMixAdd * _MatCapColAdd.rgb * specularMatcapDes * cubeMapAveAlbedo * _MatCapColAdd.a * matcapShaMask * aoSpecularM; } @@ -1069,8 +1125,7 @@ //// energy conservation float3 colDiffuseTerms = (colDiffuse); float3 colSpecularTerms = colSpecular + colFernel + colReflect; - // float3 colSpecularTerms = (colSpecular + colFernel) * lightDirectSource + colReflect; - //// solve oneMinusReflectivity again. Might be use for transparancy + //// solve oneMinusReflectivity for transparancy colDiffuseTerms = EnergyConservationBetweenDiffuseAndSpecular_ac( _Is_BlendAddToHiColor, colDiffuseTerms, specularSrcCol, oneMinusReflectivity); /// oneMinusReflectivity unused @@ -1096,7 +1151,7 @@ fragColor.rgb = max(0, fragColor); if (_forceLightClamp) { - float sceneIntensity = LinearRgbToLuminance_ac(lightDirectSource + lightIndirectSource); + float sceneIntensity = LinearRgbToLuminance_ac(lightDirectSource + lightIndirectSource); //// grab all light at max potencial if (sceneIntensity > 1.0) //// bloom defaults at > 1.1 { fragColor.rgb = fragColor.rgb / sceneIntensity; diff --git a/Assets/shaders/aciil/ACLS/ACLS_HELPERS.cginc b/Assets/shaders/aciil/ACLS/ACLS_HELPERS.cginc index dbf30bc..80f6518 100644 --- a/Assets/shaders/aciil/ACLS/ACLS_HELPERS.cginc +++ b/Assets/shaders/aciil/ACLS/ACLS_HELPERS.cginc @@ -164,8 +164,8 @@ x2 = unity_SHC.rgb * vC; return x1 + x2; } - //// - half3 SHEvalDirectL1(half4 normal) + //// get L1 by excluding the 4th array, which is L0 + half3 SHEvalDirectL1(half3 normal) { half3 L0; L0.r = dot(unity_SHAr,normal); @@ -305,7 +305,7 @@ float4 toLightY = lightPosY - pos.y; float4 toLightZ = lightPosZ - pos.z; vertTo0 = float3(toLightX[0], toLightY[0], toLightZ[0]); - if ( any(vertTo0) != 0){ + if ( any(vertTo0) && any(unityLightColor[0].rgb)){ //// black light check // if ( dot( vertTo0, vertTo0) != 0){ vertTo0 = normalize(vertTo0); } else { @@ -757,11 +757,13 @@ return ((start*cos(theta)) + (RelativeVec*sin(theta))); } - //// Lyuma. (Silent?) - float stepButAntialiased(float x0, float x) { - float u = (x - x0); - float pixwid = fwidth(u); - return clamp(u / pixwid + 0.5, 0.0, 1.0); + //// get ratio of color A on B, weighted by a Scale + half ratioOfColors(half3 colorA, half3 colorB, half colorAMultiplier) + { + half cALum = LinearRgbToLuminance_ac(colorA), cBLum = LinearRgbToLuminance_ac(colorB); + half cDiff = ((cALum * colorAMultiplier) - cBLum); + half cSum = cALum + cBLum; + return saturate(cDiff / cSum); } #endif \ No newline at end of file diff --git a/Assets/shaders/aciil/ACLS/ACLS_base_cutout.shader b/Assets/shaders/aciil/ACLS/ACLS_base_cutout.shader index f0a449d..6fe1066 100644 --- a/Assets/shaders/aciil/ACLS/ACLS_base_cutout.shader +++ b/Assets/shaders/aciil/ACLS/ACLS_base_cutout.shader @@ -45,7 +45,8 @@ Shader "ACiiL/toon/ACLS_Toon_Cutout" { _TweakHighColorOnShadow("Spec shadow mask", Range(0, 1)) = 0.5 // [Header(Reflection)] - [Enum(None,0,Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 0 + [ToggleUI] _useCubeMap("_useCubeMap",Int) = 0 + [Enum(Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 1 _ENVMix("--Reflection mix",Range(0,1)) = 1 _envRoughness("--Reflection smoothness", Range(0, 1)) = 0.34 [Enum(Off,0,Smart,1,Replace,2)] _CubemapFallbackMode("Fallback mix mode:",Int) = 0 @@ -55,6 +56,7 @@ Shader "ACiiL/toon/ACLS_Toon_Cutout" { [Enum(Off,0,On,1)] _EnvGrazeRimMix("Graze RimLights Mask mix",Int) = 0 _envOnRim("Mask on rimLights", Range(0,1)) = 0.25 _envOnRimColorize("--Colorize rim lights", Range(0,1)) = 0 + _rimLightLightsourceType("_rimLightLightsourceType", Range(0,1)) = 0 // [Header(Rimlights)] [Enum(Off,0,Add,1)] _RimLight("RimLight blend",Int) = 1 @@ -102,10 +104,15 @@ Shader "ACiiL/toon/ACLS_Toon_Cutout" { _indirectAlbedoMaxAveScale("Indirect albedo maxAve Scale",Range(0.5,2)) = 1 _indirectGIDirectionalMix("Indirect GI dir mix",Range(0,1)) = 0 _indirectGIBlur("Indirect GI blur",Range(.5,4)) = 1 - [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 0 - [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 4 - _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.1 + [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 1 + [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 0 + _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.34 [NoScaleOffset] _DynamicShadowMask("Dynamic Shadow mask",2D) = "black" {} + [ToggleUI] _shadowUseCustomRampNDL("_shadowUseCustomRampNDL",Int) = 0 + _shadowNDLStep("_shadowNDLStep",Range(0,1)) = 0.52 + _shadowNDLFeather("_shadowNDLFeather",Range(0,1)) = 0.025 + _shadowMaskPinch("_shadowMaskPinch",Range(0,1)) = 0 + [IntRange] _shadowSplits("_shadowMaskPinch",Range(0,10)) = 0 // [Header(Light Map Shift Masks)] [Enum(Off,0,On,1,Use Vertex Color Red,2)] _UseLightMap("Light Map mode", Int) = 0 diff --git a/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlpha.shader b/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlpha.shader index 3563b83..001877c 100644 --- a/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlpha.shader +++ b/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlpha.shader @@ -45,7 +45,8 @@ Shader "ACiiL/toon/ACLS_Toon_AlphaTransparent" { _TweakHighColorOnShadow("Spec shadow mask", Range(0, 1)) = 0.5 // [Header(Reflection)] - [Enum(None,0,Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 0 + [ToggleUI] _useCubeMap("_useCubeMap",Int) = 0 + [Enum(Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 1 _ENVMix("--Reflection mix",Range(0,1)) = 1 _envRoughness("--Reflection smoothness", Range(0, 1)) = 0.34 [Enum(Off,0,Smart,1,Replace,2)] _CubemapFallbackMode("Fallback mix mode:",Int) = 0 @@ -55,6 +56,7 @@ Shader "ACiiL/toon/ACLS_Toon_AlphaTransparent" { [Enum(Off,0,On,1)] _EnvGrazeRimMix("Graze RimLights Mask mix",Int) = 0 _envOnRim("Mask on rimLights", Range(0,1)) = 0.25 _envOnRimColorize("--Colorize rim lights", Range(0,1)) = 0 + _rimLightLightsourceType("_rimLightLightsourceType", Range(0,1)) = 0 // [Header(Rimlights)] [Enum(Off,0,Add,1)] _RimLight("RimLight blend",Int) = 1 @@ -102,10 +104,15 @@ Shader "ACiiL/toon/ACLS_Toon_AlphaTransparent" { _indirectAlbedoMaxAveScale("Indirect albedo maxAve Scale",Range(0.5,2)) = 1 _indirectGIDirectionalMix("Indirect GI dir mix",Range(0,1)) = 0 _indirectGIBlur("Indirect GI blur",Range(.5,4)) = 1 - [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 0 - [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 4 - _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.1 + [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 1 + [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 0 + _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.34 [NoScaleOffset] _DynamicShadowMask("Dynamic Shadow mask",2D) = "black" {} + [ToggleUI] _shadowUseCustomRampNDL("_shadowUseCustomRampNDL",Int) = 0 + _shadowNDLStep("_shadowNDLStep",Range(0,1)) = 0.52 + _shadowNDLFeather("_shadowNDLFeather",Range(0,1)) = 0.025 + _shadowMaskPinch("_shadowMaskPinch",Range(0,1)) = 0 + [IntRange] _shadowSplits("_shadowMaskPinch",Range(0,10)) = 0 // [Header(Light Map Shift Masks)] [Enum(Off,0,On,1,Use Vertex Color Red,2)] _UseLightMap("Light Map mode", Int) = 0 diff --git a/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlphaDither.shader b/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlphaDither.shader index f4e55a9..60e1b85 100644 --- a/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlphaDither.shader +++ b/Assets/shaders/aciil/ACLS/ACLS_base_cutoutAlphaDither.shader @@ -45,7 +45,8 @@ Shader "ACiiL/toon/ACLS_Toon_AlphaCutout_Dither" { _TweakHighColorOnShadow("Spec shadow mask", Range(0, 1)) = 0.5 // [Header(Reflection)] - [Enum(None,0,Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 0 + [ToggleUI] _useCubeMap("_useCubeMap",Int) = 0 + [Enum(Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 1 _ENVMix("--Reflection mix",Range(0,1)) = 1 _envRoughness("--Reflection smoothness", Range(0, 1)) = 0.34 [Enum(Off,0,Smart,1,Replace,2)] _CubemapFallbackMode("Fallback mix mode:",Int) = 0 @@ -55,6 +56,7 @@ Shader "ACiiL/toon/ACLS_Toon_AlphaCutout_Dither" { [Enum(Off,0,On,1)] _EnvGrazeRimMix("Graze RimLights Mask mix",Int) = 0 _envOnRim("Mask on rimLights", Range(0,1)) = 0.25 _envOnRimColorize("--Colorize rim lights", Range(0,1)) = 0 + _rimLightLightsourceType("_rimLightLightsourceType", Range(0,1)) = 0 // [Header(Rimlights)] [Enum(Off,0,Add,1)] _RimLight("RimLight blend",Int) = 1 @@ -102,10 +104,15 @@ Shader "ACiiL/toon/ACLS_Toon_AlphaCutout_Dither" { _indirectAlbedoMaxAveScale("Indirect albedo maxAve Scale",Range(0.5,2)) = 1 _indirectGIDirectionalMix("Indirect GI dir mix",Range(0,1)) = 0 _indirectGIBlur("Indirect GI blur",Range(.5,4)) = 1 - [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 0 - [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 4 - _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.1 + [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 1 + [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 0 + _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.34 [NoScaleOffset] _DynamicShadowMask("Dynamic Shadow mask",2D) = "black" {} + [ToggleUI] _shadowUseCustomRampNDL("_shadowUseCustomRampNDL",Int) = 0 + _shadowNDLStep("_shadowNDLStep",Range(0,1)) = 0.52 + _shadowNDLFeather("_shadowNDLFeather",Range(0,1)) = 0.025 + _shadowMaskPinch("_shadowMaskPinch",Range(0,1)) = 0 + [IntRange] _shadowSplits("_shadowMaskPinch",Range(0,10)) = 0 // [Header(Light Map Shift Masks)] [Enum(Off,0,On,1,Use Vertex Color Red,2)] _UseLightMap("Light Map mode", Int) = 0 diff --git a/Assets/shaders/aciil/ACLS/ACLS_base_solid.shader b/Assets/shaders/aciil/ACLS/ACLS_base_solid.shader index 591acf4..17d7ca1 100644 --- a/Assets/shaders/aciil/ACLS/ACLS_base_solid.shader +++ b/Assets/shaders/aciil/ACLS/ACLS_base_solid.shader @@ -46,7 +46,8 @@ Shader "ACiiL/toon/ACLS_Toon_Solid" { _TweakHighColorOnShadow("Spec shadow mask", Range(0, 1)) = 0.5 // [Header(Reflection)] - [Enum(None,0,Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 0 + [ToggleUI] _useCubeMap("_useCubeMap",Int) = 0 + [Enum(Standard,1,Override,2)] _ENVMmode("Reflection Setup:",Int) = 1 _ENVMix("--Reflection mix",Range(0,1)) = 1 _envRoughness("--Reflection smoothness", Range(0, 1)) = 0.34 [Enum(Off,0,Smart,1,Replace,2)] _CubemapFallbackMode("Fallback mix mode:",Int) = 0 @@ -56,6 +57,7 @@ Shader "ACiiL/toon/ACLS_Toon_Solid" { [Enum(Off,0,On,1)] _EnvGrazeRimMix("Graze RimLights Mask mix",Int) = 0 _envOnRim("Mask on rimLights", Range(0,1)) = 0.25 _envOnRimColorize("--Colorize rim lights", Range(0,1)) = 0 + _rimLightLightsourceType("_rimLightLightsourceType", Range(0,1)) = 0 // [Header(Rimlights)] [Enum(Off,0,Add,1)] _RimLight("RimLight blend",Int) = 1 @@ -103,10 +105,15 @@ Shader "ACiiL/toon/ACLS_Toon_Solid" { _indirectAlbedoMaxAveScale("Indirect albedo maxAve Scale",Range(0.5,2)) = 1 _indirectGIDirectionalMix("Indirect GI dir mix",Range(0,1)) = 0 _indirectGIBlur("Indirect GI blur",Range(.5,4)) = 1 - [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 0 - [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 4 - _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.1 + [Enum(HDR,0,Limit,1)] _forceLightClamp("Force scene Lights Clamp",Int) = 1 + [Enum(Real ADD,0,Safe MAX,4)] _BlendOp("Additional lights blending", Float) = 0 + _shadowCastMin_black("Dynamic Shadow Removal",Range(0.0,1.0)) = 0.34 [NoScaleOffset] _DynamicShadowMask("Dynamic Shadow mask",2D) = "black" {} + [ToggleUI] _shadowUseCustomRampNDL("_shadowUseCustomRampNDL",Int) = 0 + _shadowNDLStep("_shadowNDLStep",Range(0,1)) = 0.52 + _shadowNDLFeather("_shadowNDLFeather",Range(0,1)) = 0.025 + _shadowMaskPinch("_shadowMaskPinch",Range(0,1)) = 0 + [IntRange] _shadowSplits("_shadowMaskPinch",Range(0,10)) = 0 // [Header(Light Map Shift Masks)] [Enum(Off,0,On,1,Use Vertex Color Red,2)] _UseLightMap("Light Map mode", Int) = 0 diff --git a/Assets/shaders/aciil/ACLS/Editor/ACLSInspector.cs b/Assets/shaders/aciil/ACLS/Editor/ACLSInspector.cs index 06a4740..baf71de 100644 --- a/Assets/shaders/aciil/ACLS/Editor/ACLSInspector.cs +++ b/Assets/shaders/aciil/ACLS/Editor/ACLSInspector.cs @@ -49,6 +49,7 @@ public class ACLSInspector : ShaderGUI MaterialProperty _Is_SpecularToHighColor = null; MaterialProperty _TweakHighColorOnShadow = null; // Reflection + MaterialProperty _useCubeMap = null; MaterialProperty _ENVMmode = null; MaterialProperty _ENVMix = null; MaterialProperty _envRoughness = null; @@ -71,6 +72,7 @@ public class ACLSInspector : ShaderGUI MaterialProperty _RimLightAreaOffset = null; MaterialProperty _LightDirection_MaskOn = null; MaterialProperty _Tweak_LightDirection_MaskLevel = null; + MaterialProperty _rimLightLightsourceType = null; // Matcap MaterialProperty _MatCap = null; MaterialProperty _MatCapColMult = null; @@ -102,6 +104,12 @@ public class ACLSInspector : ShaderGUI MaterialProperty _BlendOp = null; MaterialProperty _shadowCastMin_black = null; MaterialProperty _DynamicShadowMask = null; + MaterialProperty _shadowUseCustomRampNDL = null; + MaterialProperty _shadowNDLStep = null; + MaterialProperty _shadowNDLFeather = null; + MaterialProperty _shadowMaskPinch = null; + MaterialProperty _shadowSplits = null; + MaterialProperty _indirectGIDirectionalMix = null; MaterialProperty _indirectGIBlur = null; // Light Map Shift Masks @@ -237,14 +245,23 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro EditorGUI.indentLevel++; materialEditor.TextureScaleOffsetProperty(_DynamicShadowMask); EditorGUI.indentLevel--; + materialEditor.ShaderProperty(_shadowUseCustomRampNDL, new GUIContent("Dynamic shadow Backface","Force natural PBR Dynamic Shadowcast when surface is away from Direct light.")); + EditorGUI.indentLevel++; + materialEditor.ShaderProperty(_shadowNDLStep,new GUIContent("Step of Shadow","Angle Shadow Falloff begins.\nRecommend setting so complete shadow is perpendicular to light.\nDefault: 1. NPR: 0.52")); + materialEditor.ShaderProperty(_shadowNDLFeather,new GUIContent("Feather of Shadow","Softness of Dynamic shadow. Recommend adjesting so complete shadow is perpendicular to light.\nDefault: 0.5. NPR: 0.025")); + EditorGUI.indentLevel--; + ACLStyles.PartingLine(); + materialEditor.ShaderProperty(_shadowSplits,new GUIContent("Shadow Steps","Use this for stylizing NPR by settings \"Steps\" of intensity.")); + materialEditor.ShaderProperty(_shadowMaskPinch,new GUIContent("Shadow Pinch","\"Pinches\" the frindge zone were shadow transitions from nothing to complete.\nUse this to stylize shadow as NPR.")); + ACLStyles.PartingLine(); materialEditor.ShaderProperty(_TweakHighColorOnShadow, new GUIContent("Specular Shadow Reactivity", "Affects Shine lobe's dimming in dynamic shadow. 0.0 is ignore dynamic shadows completely.")); materialEditor.ShaderProperty(_TweakMatCapOnShadow, new GUIContent("Specular Matcap Shadow Reactivity", "Specular matcaps visibility in dynamic shadow. This depends on context looking like it reacts to direct light or not. 0.0 ignores masking by dynamic shadows.")); ACLStyles.PartingLine(); materialEditor.ShaderProperty(_directLightIntensity, new GUIContent("Direct Light Intensity", "Soft counter for overbright maps. Dim direct light sources and thus rely more on map ambient.")); + materialEditor.ShaderProperty(_indirectAlbedoMaxAveScale, new GUIContent("Static GI Max:Ave", "How overall Indirect light is sampled by object, abstracted to two sources \"Max\" or \"Average\" color, is used on Diffuse (Toon Ramping).\n1: Use Max color with Average intelligently.\n>1:Strongly switch to Average color as Max color scales brighter, which matches a few NPR shaders behaviour and darkness.")); ACLStyles.PartingLine(); materialEditor.ShaderProperty(_indirectGIDirectionalMix, new GUIContent("Indirect GI Directionality", "How Indirect light is sampled in the scene.\n0: Use a simple statistical color by object position.\n1: Use surface angle to light, which is PBR.")); EditorGUI.indentLevel++; - materialEditor.ShaderProperty(_indirectAlbedoMaxAveScale, new GUIContent("Static GI Max:Ave", "How overall Indirect light is sampled by object, abstracted to two sources \"Max\" or \"Average\" color, is used on Diffuse (Toon Ramping).\n1: Use Max color with Average intelligently.\n>1:Strongly switch to Average color as Max color scales brighter, which matches a few NPR shaders behaviour and darkness.")); materialEditor.ShaderProperty(_indirectGIBlur, new GUIContent("Angular GI Blur", "Default 1.\nRaise to blur Indirect GI and reduce distinctness of surface angle. Good for converting Indirect GI from PRB to NPR.")); EditorGUI.indentLevel--; ACLStyles.PartingLine(); @@ -354,6 +371,14 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro showReflection = ACLStyles.ShurikenFoldout("Cubemap Reflection Behavour", showReflection); if (showReflection) { + materialEditor.ShaderProperty(_useCubeMap, new GUIContent("Use Cubemap", "Enable sampling of CubeMap.")); + ACLStyles.PartingLine(); + materialEditor.ShaderProperty(_ENVMmode, new GUIContent("Control Method", "Standard: Follows Standard Shader formula.\nOverride: You define Intensity and Roughness exactly and Intensitys follow roughness formula.")); + EditorGUI.indentLevel++; + materialEditor.ShaderProperty(_ENVMix, new GUIContent("Intensity", "With Standard: Rescales value by this.\nWith Override: Replace the value from smoothness and ignores roughness mask (can use this to blur Cubemap into abstract tone).")); + materialEditor.ShaderProperty(_envRoughness, new GUIContent("Roughness", "For Override only.")); + EditorGUI.indentLevel--; + ACLStyles.PartingLine(); materialEditor.ShaderProperty(_CubemapFallbackMode, new GUIContent("Fallback Mode", "Fallback Cubemap intensifies to average lighting.\nSmart: Enables when map gives nothing.\nAlways: Always override with custom.")); EditorGUI.indentLevel++; materialEditor.TexturePropertySingleLine(new GUIContent("Fallback Cubemap", ""), _CubemapFallback); @@ -362,12 +387,6 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro // // EditorGUI.indentLevel--; EditorGUI.indentLevel--; ACLStyles.PartingLine(); - materialEditor.ShaderProperty(_ENVMmode, new GUIContent("Enable & Controls", "Cubemap visibility is off unless set here.\nStandard: Follows Standard Shader formula.\nOverride: You define Intensity and Roughness exactly.")); - EditorGUI.indentLevel++; - materialEditor.ShaderProperty(_ENVMix, new GUIContent("Intensity", "With Standard: Rescales value by this.\nWith Override: Replace the value from smoothness and ignores roughness mask (can use this to blur Cubemap into abstract tone).")); - materialEditor.ShaderProperty(_envRoughness, new GUIContent("Roughness", "For Override only.")); - EditorGUI.indentLevel--; - ACLStyles.PartingLine(); materialEditor.ShaderProperty(_EnvGrazeMix, new GUIContent("Use Natural Fresnel", "Natural unmaskable specular at sharp angles linked to Specular.")); materialEditor.ShaderProperty(_EnvGrazeRimMix, new GUIContent("Use RimLight Fresnel", "Unmaskable specular at sharp angles linked to Specular. Uses Rim Lighting visibility as mask.")); @@ -395,10 +414,13 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro materialEditor.ShaderProperty(_RimLight_InsideMask, new GUIContent("Sharpness", "Tampers falloff to a shaper edge. Good for toony lines.")); materialEditor.ShaderProperty(_RimLightAreaOffset, new GUIContent("Offset Wrap", "Shifts RimLights \"warp\". To control how the high and low of the rim curve appear.")); ACLStyles.PartingLine(); + materialEditor.ShaderProperty(_rimLightLightsourceType, new GUIContent("Light Type: Diffuse:Cubemap", "Light Rim Lights like a surface diffuse or Cubemap. First good for subsurface effects and 2nd for metallic/smoothness effect.")); + EditorGUI.indentLevel++; materialEditor.ShaderProperty(_envOnRim, new GUIContent("Mask by Cubemap", "Masks Rim Lighting by Cubemap colors. Uses Cubemap settings (even its off as a specular effect). I recommend overriding Cubemap Fallback and Roughness settings when applying this.")); EditorGUI.indentLevel++; materialEditor.ShaderProperty(_envOnRimColorize, new GUIContent("Colorize by Cubemap", "Give Cubemap Color to tint RimLight.")); EditorGUI.indentLevel--; + EditorGUI.indentLevel--; } showMatcap = ACLStyles.ShurikenFoldout("Matcaps", showMatcap); diff --git a/Assets/shaders/aciil/ACLS/Editor/ACLStyles.cs b/Assets/shaders/aciil/ACLS/Editor/ACLStyles.cs index 790e5a7..cf0b1d3 100644 --- a/Assets/shaders/aciil/ACLS/Editor/ACLStyles.cs +++ b/Assets/shaders/aciil/ACLS/Editor/ACLStyles.cs @@ -10,7 +10,7 @@ [InitializeOnLoad] public class ACLStyles : MonoBehaviour { - public static string ver = "ACLS-Shader v" + "1.2 "; + public static string ver = "ACLS-Shader v" + "1.3 "; private static Rect DrawShuriken(string title, Vector2 contentOffset, int HeaderHeight) { @@ -167,14 +167,18 @@ public static void gitSourcebutton(int Width, int Height) public static void wikiButton(int Width, int Height) { - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); if (GUILayout.Button("Show Wiki", GUILayout.Width(Width), GUILayout.Height(Height))) { Application.OpenURL("https://github.com/ACIIL/ACLS-Shader/wiki"); } - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); + } + + public static void linksButton(int Width, int Height) + { + if (GUILayout.Button("Links", GUILayout.Width(Width), GUILayout.Height(Height))) + { + Application.OpenURL("https://github.com/ACIIL/ACLS-Shader/wiki/Links"); + } } public static void ShurikenHeader(string title) @@ -201,6 +205,11 @@ public static void DrawButtons() ACLStyles.gitSourcebutton(100, 30); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); ACLStyles.wikiButton(100,30); + ACLStyles.linksButton(100,30); + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); } } \ No newline at end of file