浏览代码
Merge remote-tracking branch 'origin/Unity-2017.3' into Reorganize-HDRP-GraphicTests
/Yibing-Project-2
Merge remote-tracking branch 'origin/Unity-2017.3' into Reorganize-HDRP-GraphicTests
/Yibing-Project-2
Remy
7 年前
当前提交
972c7922
共有 54 个文件被更改,包括 1441 次插入 和 1385 次删除
-
8SampleScenes/HDTest/DistortionTest.unity
-
22SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Reject.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_plane_Clear_ior101.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_plane_Clear_ior15.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_plane_Dragon.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_plane_EarthMap.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_sphere_Clear_ior101.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_sphere_Clear_ior15.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_sphere_Dragon.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_sphere_EarthMap.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_sphere_EarthMap_RefractionMask.mat
-
2SampleScenes/HDTest/GraphicTest/Common/Material/Mat_refraction_sphere_EarthMap_pretransparent.mat
-
32SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Unlit_Voronoi.mat
-
986SampleScenes/HDTest/GraphicTest/Common/Textures/EarthColorandMask.png
-
2ScriptableRenderPipeline/Core/Debugging/DebugMenuManager.cs
-
39ScriptableRenderPipeline/Core/Debugging/DebugMenuState.cs
-
9ScriptableRenderPipeline/Core/Debugging/Editor/DebugMenuEditor.cs
-
5ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
-
6ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
-
21ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs.hlsl
-
8ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
8ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
-
2ScriptableRenderPipeline/HDRenderPipeline/Sky/BlacksmithlSky/BlacksmithSkyRenderer.cs
-
28ScriptableRenderPipeline/LightweightPipeline/Editor/LegacyShadersToLightweightPipelineUpgrader.cs
-
22ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetInspector.cs
-
4ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightPipelineUpgraders.cs
-
8ScriptableRenderPipeline/LightweightPipeline/Editor/StandardToLightweightMaterialUpgrader.cs
-
124ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
-
5ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.asset
-
25ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs
-
5ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineUtils.cs
-
2ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightBlit.shader
-
2ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCopyDepth.shader
-
203ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCore.cginc
-
239ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightLighting.cginc
-
244ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPassLit.cginc
-
14ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightShadows.cginc
-
21ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader
-
9ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardSimpleLighting.shader
-
2ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader
-
3Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/021_Lighting_BasicPoint.unity
-
10SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_2DNoise.mat.meta
-
183SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_Ripple.mat
-
10SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_Ripple.mat.meta
-
183SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Voronoi.mat
-
10SampleScenes/HDTest/GraphicTest/Common/Prefabs/Refraction ThinPlane Clear Dragon.prefab.meta
-
58ScriptableRenderPipeline/LightweightPipeline/Editor/GenerateTextures.cs
-
13ScriptableRenderPipeline/LightweightPipeline/Editor/GenerateTextures.cs.meta
-
9ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightInput.cginc.meta
-
220ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightInput.cginc
-
0/SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Unlit_Voronoi.mat.meta
-
0/SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Unlit_Voronoi.mat
986
SampleScenes/HDTest/GraphicTest/Common/Textures/EarthColorandMask.png
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
#ifndef LIGHTWEIGHT_PIPELINE_CORE_INCLUDED |
|||
#define LIGHTWEIGHT_PIPELINE_CORE_INCLUDED |
|||
|
|||
#include "LightweightInput.cginc" |
|||
#include "LightweightLighting.cginc" |
|||
#include "LightweightShadows.cginc" |
|||
#include "UnityCG.cginc" |
|||
|
|||
#define MAX_VISIBLE_LIGHTS 16 |
|||
#if defined(_SPECGLOSSMAP) || defined(_SPECULAR_COLOR) |
|||
#define LIGHTWEIGHT_SPECULAR_HIGHLIGHTS |
|||
#if defined(UNITY_COLORSPACE_GAMMA) |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(gammaColor) gammaColor * gammaColor |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(linColor) sqrt(color) |
|||
#else |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(color) color |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(color) color |
|||
#define kDieletricSpec half4(0.04, 0.04, 0.04, 1.0 - 0.04) // standard dielectric reflectivity coef at incident angle (= 4%) |
|||
#ifdef _SPECULAR_SETUP |
|||
#define SAMPLE_METALLICSPECULAR(uv) tex2D(_SpecGlossMap, uv) |
|||
#else |
|||
#define SAMPLE_METALLICSPECULAR(uv) tex2D(_MetallicGlossMap, uv) |
|||
#endif |
|||
|
|||
CBUFFER_START(_PerObject) |
|||
half4 unity_LightIndicesOffsetAndCount; |
|||
half4 unity_4LightIndices0; |
|||
half4 unity_4LightIndices1; |
|||
half _Shininess; |
|||
CBUFFER_END |
|||
|
|||
CBUFFER_START(_PerCamera) |
|||
float4 _MainLightPosition; |
|||
half4 _MainLightColor; |
|||
float4 _MainLightAttenuationParams; |
|||
half4 _MainLightSpotDir; |
|||
|
|||
half4 _AdditionalLightCount; |
|||
float4 _AdditionalLightPosition[MAX_VISIBLE_LIGHTS]; |
|||
half4 _AdditionalLightColor[MAX_VISIBLE_LIGHTS]; |
|||
float4 _AdditionalLightAttenuationParams[MAX_VISIBLE_LIGHTS]; |
|||
half4 _AdditionalLightSpotDir[MAX_VISIBLE_LIGHTS]; |
|||
CBUFFER_END |
|||
half SpecularReflectivity(half3 specular) |
|||
CBUFFER_START(_PerFrame) |
|||
half4 _GlossyEnvironmentColor; |
|||
sampler2D _AttenuationTexture; |
|||
CBUFFER_END |
|||
|
|||
half3 TangentToWorldNormal(half3 normalTangent, half3 tangent, half3 binormal, half3 normal) |
|||
#if (SHADER_TARGET < 30) |
|||
// SM2.0: instruction count limitation |
|||
// SM2.0: simplified SpecularStrength |
|||
return specular.r; // Red channel - because most metals are either monocrhome or with redish/yellowish tint |
|||
half3x3 tangentToWorld = half3x3(tangent, binormal, normal); |
|||
return normalize(mul(normalTangent, tangentToWorld)); |
|||
} |
|||
|
|||
float ComputeFogFactor(float z) |
|||
{ |
|||
float clipZ_01 = UNITY_Z_0_FAR_FROM_CLIPSPACE(z); |
|||
|
|||
#if defined(FOG_LINEAR) |
|||
// factor = (end-z)/(end-start) = z * (-1/(end-start)) + (end/(end-start)) |
|||
float fogFactor = saturate(clipZ_01 * unity_FogParams.z + unity_FogParams.w); |
|||
return half(fogFactor); |
|||
#elif defined(FOG_EXP) |
|||
// factor = exp(-density*z) |
|||
float unityFogFactor = unity_FogParams.y * clipZ_01; |
|||
return half(saturate(exp2(-unityFogFactor))); |
|||
#elif defined(FOG_EXP2) |
|||
// factor = exp(-(density*z)^2) |
|||
float unityFogFactor = unity_FogParams.x * clipZ_01; |
|||
return half(saturate(exp2(-unityFogFactor*unityFogFactor))); |
|||
return max(max(specular.r, specular.g), specular.b); |
|||
return 0.0h; |
|||
#endif |
|||
} |
|||
|
|||
void ApplyFog(inout half3 color, half fogFactor) |
|||
{ |
|||
#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) |
|||
color = lerp(unity_FogColor, color, fogFactor); |
|||
#endif |
|||
} |
|||
|
|||
half4 OutputColor(half3 color, half alpha) |
|||
{ |
|||
#if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) |
|||
return half4(LIGHTWEIGHT_LINEAR_TO_GAMMA(color), alpha); |
|||
#else |
|||
return half4(LIGHTWEIGHT_LINEAR_TO_GAMMA(color), 1); |
|||
inline void InitializeSurfaceData(LightweightVertexOutput i, out SurfaceData outSurfaceData) |
|||
inline half Alpha(half albedoAlpha) |
|||
float2 uv = i.uv01.xy; |
|||
half4 albedoAlpha = tex2D(_MainTex, uv); |
|||
#if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) |
|||
half alpha = _Color.a; |
|||
#else |
|||
half alpha = albedoAlpha * _Color.a; |
|||
#endif |
|||
|
|||
#if defined(_ALPHATEST_ON) |
|||
clip(alpha - _Cutoff); |
|||
#endif |
|||
|
|||
return alpha; |
|||
} |
|||
outSurfaceData.albedo = LIGHTWEIGHT_GAMMA_TO_LINEAR(albedoAlpha.rgb) * _Color.rgb; |
|||
outSurfaceData.alpha = Alpha(albedoAlpha.a); |
|||
outSurfaceData.metallicSpecGloss = MetallicSpecGloss(uv, albedoAlpha); |
|||
outSurfaceData.normalWorld = Normal(i); |
|||
outSurfaceData.ao = OcclusionLW(uv); |
|||
outSurfaceData.emission = EmissionLW(uv); |
|||
half3 Normal(float2 uv) |
|||
{ |
|||
#if _NORMALMAP |
|||
return UnpackNormal(tex2D(_BumpMap, uv)); |
|||
#else |
|||
return half3(0.0h, 0.0h, 1.0h); |
|||
#endif |
|||
inline void InitializeBRDFData(SurfaceData surfaceData, out BRDFData outBRDFData) |
|||
inline void SpecularGloss(half2 uv, half alpha, out half4 specularGloss) |
|||
// BRDF SETUP |
|||
#ifdef _METALLIC_SETUP |
|||
half2 metallicGloss = surfaceData.metallicSpecGloss.ra; |
|||
half metallic = metallicGloss.r; |
|||
half smoothness = metallicGloss.g; |
|||
specularGloss = half4(0, 0, 0, 1); |
|||
#ifdef _SPECGLOSSMAP |
|||
specularGloss = tex2D(_SpecGlossMap, uv); |
|||
specularGloss.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(specularGloss.rgb); |
|||
#elif defined(_SPECULAR_COLOR) |
|||
specularGloss = _SpecColor; |
|||
#endif |
|||
|
|||
#ifdef _GLOSSINESS_FROM_BASE_ALPHA |
|||
specularGloss.a = alpha; |
|||
#endif |
|||
} |
|||
// We'll need oneMinusReflectivity, so |
|||
// 1-reflectivity = 1-lerp(dielectricSpec, 1, metallic) = lerp(1-dielectricSpec, 0, metallic) |
|||
// store (1-dielectricSpec) in kDieletricSpec.a, then |
|||
// 1-reflectivity = lerp(alpha, 0, metallic) = alpha + metallic*(0 - alpha) = |
|||
// = alpha - metallic * alpha |
|||
half oneMinusDielectricSpec = kDieletricSpec.a; |
|||
half oneMinusReflectivity = oneMinusDielectricSpec - metallic * oneMinusDielectricSpec; |
|||
half reflectivity = 1.0 - oneMinusReflectivity; |
|||
half4 MetallicSpecGloss(float2 uv, half albedoAlpha) |
|||
{ |
|||
half4 specGloss; |
|||
outBRDFData.diffuse = surfaceData.albedo * oneMinusReflectivity; |
|||
outBRDFData.specular = lerp(kDieletricSpec.rgb, surfaceData.albedo, metallic); |
|||
#ifdef _METALLICSPECGLOSSMAP |
|||
specGloss = specGloss = SAMPLE_METALLICSPECULAR(uv); |
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
specGloss.a = albedoAlpha * _GlossMapScale; |
|||
#else |
|||
specGloss.a *= _GlossMapScale; |
|||
#endif |
|||
#else // _METALLICSPECGLOSSMAP |
|||
#if _METALLIC_SETUP |
|||
specGloss.rgb = _Metallic.rrr; |
|||
half3 specular = surfaceData.metallicSpecGloss.rgb; |
|||
half smoothness = surfaceData.metallicSpecGloss.a; |
|||
half reflectivity = SpecularReflectivity(specular); |
|||
specGloss.rgb = _SpecColor.rgb; |
|||
#endif |
|||
outBRDFData.diffuse = surfaceData.albedo * (half3(1.0h, 1.0h, 1.0h) - specular); |
|||
outBRDFData.specular = specular; |
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
specGloss.a = albedoAlpha * _GlossMapScale; |
|||
#else |
|||
specGloss.a = _Glossiness; |
|||
#endif |
|||
outBRDFData.grazingTerm = saturate(smoothness + reflectivity); |
|||
outBRDFData.perceptualRoughness = 1.0h - smoothness; |
|||
outBRDFData.roughness = outBRDFData.perceptualRoughness * outBRDFData.perceptualRoughness; |
|||
return specGloss; |
|||
} |
|||
#ifdef _ALPHAPREMULTIPLY_ON |
|||
half alpha = surfaceData.alpha; |
|||
outBRDFData.diffuse *= alpha; |
|||
surfaceData.alpha = reflectivity + alpha * (1.0 - reflectivity); |
|||
half OcclusionLW(float2 uv) |
|||
{ |
|||
#ifdef _OCCLUSIONMAP |
|||
#if (SHADER_TARGET < 30) |
|||
// SM20: instruction count limitation |
|||
// SM20: simpler occlusion |
|||
return tex2D(_OcclusionMap, uv).g; |
|||
#else |
|||
half occ = tex2D(_OcclusionMap, uv).g; |
|||
return LerpOneTo(occ, _OcclusionStrength); |
|||
#endif |
|||
#else |
|||
return 1.0; |
|||
half4 OutputColor(half3 color, half alpha) |
|||
half3 EmissionLW(float2 uv) |
|||
#if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) |
|||
return LIGHTWEIGHT_LINEAR_TO_GAMMA(half4(color, alpha)); |
|||
#ifndef _EMISSION |
|||
return 0; |
|||
return half4(LIGHTWEIGHT_LINEAR_TO_GAMMA(color), 1); |
|||
return LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_EmissionMap, uv).rgb) * _EmissionColor.rgb; |
|||
|
|||
|
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 83ec3bd906ef2d442ad5caa8ecce9d15 |
|||
timeCreated: 1507195204 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Mat_Distorsion_Lit_Only_Ripple |
|||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3} |
|||
m_ShaderKeywords: _BLENDMODE_ALPHA _BLENDMODE_PRESERVE_SPECULAR_LIGHTING _ENABLE_FOG_ON_TRANSPARENT |
|||
_NORMALMAP_TANGENT_SPACE _SURFACE_TYPE_TRANSPARENT |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: 3000 |
|||
stringTagMap: |
|||
RenderType: Transparent |
|||
disabledShaderPasses: |
|||
- ForwardOnlyOpaque |
|||
- ForwardOnlyOpaqueDepthOnly |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _AnisotropyMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BaseColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BentNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BentNormalMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DistortionVectorMap: |
|||
m_Texture: {fileID: 8600000, guid: b47c3f363d01c934e91b198a745925eb, type: 2} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissiveColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _HeightMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MaskMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecularColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SubsurfaceRadiusMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _TangentMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _TangentMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ThicknessMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _ATDistance: 1 |
|||
- _AlbedoAffectEmissive: 0 |
|||
- _AlphaCutoff: 0.5 |
|||
- _AlphaCutoffEnable: 0 |
|||
- _Anisotropy: 0 |
|||
- _BlendMode: 0 |
|||
- _CoatCoverage: 1 |
|||
- _CoatIOR: 0.5 |
|||
- _CullMode: 2 |
|||
- _DepthOffsetEnable: 0 |
|||
- _DetailAlbedoScale: 1 |
|||
- _DetailNormalScale: 1 |
|||
- _DetailSmoothnessScale: 1 |
|||
- _DisplacementLockObjectScale: 1 |
|||
- _DisplacementLockTilingScale: 1 |
|||
- _DisplacementMode: 0 |
|||
- _DistortionBlendMode: 0 |
|||
- _DistortionBlendOp: 21 |
|||
- _DistortionBlurBlendMode: 0 |
|||
- _DistortionBlurDstBlend: 1 |
|||
- _DistortionBlurRemapMax: 0.92805755 |
|||
- _DistortionBlurRemapMin: 0 |
|||
- _DistortionBlurScale: 1 |
|||
- _DistortionBlurSrcBlend: 1 |
|||
- _DistortionDepthTest: 1 |
|||
- _DistortionDstBlend: 1 |
|||
- _DistortionEnable: 1 |
|||
- _DistortionNullify: 0 |
|||
- _DistortionOnly: 1 |
|||
- _DistortionScale: 1 |
|||
- _DistortionSrcBlend: 1 |
|||
- _DistortionStencilRef: 4 |
|||
- _DoubleSidedEnable: 0 |
|||
- _DoubleSidedNormalMode: 1 |
|||
- _Drag: 1 |
|||
- _DstBlend: 10 |
|||
- _EmissiveColorMode: 1 |
|||
- _EmissiveIntensity: 0 |
|||
- _EnableBlendModePreserveSpecularLighting: 1 |
|||
- _EnableFogOnTransparent: 1 |
|||
- _EnablePerPixelDisplacement: 0 |
|||
- _EnableSpecularOcclusion: 0 |
|||
- _EnableVertexDisplacement: 0 |
|||
- _EnableWind: 0 |
|||
- _HeightAmplitude: 0.01 |
|||
- _HeightCenter: 0.5 |
|||
- _HeightMax: 1 |
|||
- _HeightMin: -1 |
|||
- _IOR: 1 |
|||
- _InitialBend: 1 |
|||
- _InvTilingScale: 1 |
|||
- _LinkDetailsWithBase: 1 |
|||
- _MaterialID: 1 |
|||
- _Metallic: 0 |
|||
- _NormalMapSpace: 0 |
|||
- _NormalScale: 1 |
|||
- _PPDLodThreshold: 5 |
|||
- _PPDMaxSamples: 15 |
|||
- _PPDMinSamples: 5 |
|||
- _PPDPrimitiveLength: 1 |
|||
- _PPDPrimitiveWidth: 1 |
|||
- _PerPixelDisplacementObjectScale: 1 |
|||
- _PreRefractionPass: 0 |
|||
- _RefractionMode: 0 |
|||
- _ShiverDirectionality: 0.5 |
|||
- _ShiverDrag: 0.2 |
|||
- _Smoothness: 1 |
|||
- _SmoothnessRemapMax: 1 |
|||
- _SmoothnessRemapMin: 0 |
|||
- _SrcBlend: 1 |
|||
- _StencilRef: 2 |
|||
- _Stiffness: 1 |
|||
- _SubsurfaceProfile: 0 |
|||
- _SubsurfaceRadius: 1 |
|||
- _SurfaceType: 1 |
|||
- _TexWorldScale: 1 |
|||
- _Thickness: 1 |
|||
- _ThicknessMultiplier: 1 |
|||
- _UVBase: 0 |
|||
- _UVDetail: 0 |
|||
- _VertexDisplacementObjectScale: 1 |
|||
- _VertexDisplacementTilingScale: 1 |
|||
- _ZTestMode: 4 |
|||
- _ZWrite: 0 |
|||
m_Colors: |
|||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} |
|||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0} |
|||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0} |
|||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 12b78618760f1ed418b720ef565ac193 |
|||
timeCreated: 1507195204 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Mat_Distorsion_Lit_Voronoi |
|||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3} |
|||
m_ShaderKeywords: _BLENDMODE_ALPHA _BLENDMODE_PRESERVE_SPECULAR_LIGHTING _ENABLE_FOG_ON_TRANSPARENT |
|||
_NORMALMAP_TANGENT_SPACE _SURFACE_TYPE_TRANSPARENT |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: 3000 |
|||
stringTagMap: |
|||
RenderType: Transparent |
|||
disabledShaderPasses: |
|||
- ForwardOnlyOpaque |
|||
- ForwardOnlyOpaqueDepthOnly |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _AnisotropyMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BaseColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BentNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BentNormalMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DistortionVectorMap: |
|||
m_Texture: {fileID: 8600000, guid: 857ebf2cca737d54194a3a1077fec4cc, type: 2} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissiveColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _HeightMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MaskMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecularColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SubsurfaceRadiusMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _TangentMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _TangentMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ThicknessMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _ATDistance: 1 |
|||
- _AlbedoAffectEmissive: 0 |
|||
- _AlphaCutoff: 0.5 |
|||
- _AlphaCutoffEnable: 0 |
|||
- _Anisotropy: 0 |
|||
- _BlendMode: 0 |
|||
- _CoatCoverage: 1 |
|||
- _CoatIOR: 0.5 |
|||
- _CullMode: 2 |
|||
- _DepthOffsetEnable: 0 |
|||
- _DetailAlbedoScale: 1 |
|||
- _DetailNormalScale: 1 |
|||
- _DetailSmoothnessScale: 1 |
|||
- _DisplacementLockObjectScale: 1 |
|||
- _DisplacementLockTilingScale: 1 |
|||
- _DisplacementMode: 0 |
|||
- _DistortionBlendMode: 0 |
|||
- _DistortionBlendOp: 0 |
|||
- _DistortionBlurBlendMode: 0 |
|||
- _DistortionBlurDstBlend: 1 |
|||
- _DistortionBlurRemapMax: 1 |
|||
- _DistortionBlurRemapMin: 0.097841725 |
|||
- _DistortionBlurScale: 1.5 |
|||
- _DistortionBlurSrcBlend: 1 |
|||
- _DistortionDepthTest: 0 |
|||
- _DistortionDstBlend: 1 |
|||
- _DistortionEnable: 1 |
|||
- _DistortionNullify: 0 |
|||
- _DistortionOnly: 1 |
|||
- _DistortionScale: 200000 |
|||
- _DistortionSrcBlend: 1 |
|||
- _DistortionStencilRef: 4 |
|||
- _DoubleSidedEnable: 0 |
|||
- _DoubleSidedNormalMode: 1 |
|||
- _Drag: 1 |
|||
- _DstBlend: 10 |
|||
- _EmissiveColorMode: 1 |
|||
- _EmissiveIntensity: 0 |
|||
- _EnableBlendModePreserveSpecularLighting: 1 |
|||
- _EnableFogOnTransparent: 1 |
|||
- _EnablePerPixelDisplacement: 0 |
|||
- _EnableSpecularOcclusion: 0 |
|||
- _EnableVertexDisplacement: 0 |
|||
- _EnableWind: 0 |
|||
- _HeightAmplitude: 0.01 |
|||
- _HeightCenter: 0.5 |
|||
- _HeightMax: 1 |
|||
- _HeightMin: -1 |
|||
- _IOR: 1 |
|||
- _InitialBend: 1 |
|||
- _InvTilingScale: 1 |
|||
- _LinkDetailsWithBase: 1 |
|||
- _MaterialID: 1 |
|||
- _Metallic: 0 |
|||
- _NormalMapSpace: 0 |
|||
- _NormalScale: 1 |
|||
- _PPDLodThreshold: 5 |
|||
- _PPDMaxSamples: 15 |
|||
- _PPDMinSamples: 5 |
|||
- _PPDPrimitiveLength: 1 |
|||
- _PPDPrimitiveWidth: 1 |
|||
- _PerPixelDisplacementObjectScale: 1 |
|||
- _PreRefractionPass: 0 |
|||
- _RefractionMode: 0 |
|||
- _ShiverDirectionality: 0.5 |
|||
- _ShiverDrag: 0.2 |
|||
- _Smoothness: 1 |
|||
- _SmoothnessRemapMax: 1 |
|||
- _SmoothnessRemapMin: 0 |
|||
- _SrcBlend: 1 |
|||
- _StencilRef: 2 |
|||
- _Stiffness: 1 |
|||
- _SubsurfaceProfile: 0 |
|||
- _SubsurfaceRadius: 1 |
|||
- _SurfaceType: 1 |
|||
- _TexWorldScale: 1 |
|||
- _Thickness: 1 |
|||
- _ThicknessMultiplier: 1 |
|||
- _UVBase: 0 |
|||
- _UVDetail: 0 |
|||
- _VertexDisplacementObjectScale: 1 |
|||
- _VertexDisplacementTilingScale: 1 |
|||
- _ZTestMode: 8 |
|||
- _ZWrite: 0 |
|||
m_Colors: |
|||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} |
|||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0} |
|||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0} |
|||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9281ce26c9326594ebf339a7749d1382 |
|||
timeCreated: 1507017860 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 100100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.IO; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
|
|||
public class GenerateTextures : MonoBehaviour |
|||
{ |
|||
private static readonly int kTextureSize = 1024; |
|||
private static readonly float kQuadraticFac = 25.0f; |
|||
private static readonly float kToZeroFadeStart = 0.8f * 0.8f; |
|||
private static readonly string kSavePath = "Assets/ScriptableRenderPipeline/LightweightPipeline/Textures/LightweightLightAttenuation.png"; |
|||
|
|||
[MenuItem("RenderPipeline/LightweightPipeline/GenerateLightFalloffTexture")] |
|||
public static void GenerateLightFalloffTexture() |
|||
{ |
|||
Texture2D tex = new Texture2D(kTextureSize, 4, TextureFormat.Alpha8, false, true); |
|||
tex.wrapMode = TextureWrapMode.Clamp; |
|||
|
|||
byte[] bytes = new byte[kTextureSize * 4]; |
|||
for (int x = 0; x < kTextureSize; ++x) |
|||
{ |
|||
float sqrRange = (float) x/(float) kTextureSize; |
|||
byte atten = LightAttenuationNormalized(sqrRange); |
|||
bytes[x] = atten; |
|||
bytes[x + kTextureSize] = atten; |
|||
bytes[x + kTextureSize * 2] = atten; |
|||
bytes[x + kTextureSize * 3] = atten; |
|||
} |
|||
|
|||
tex.LoadRawTextureData(bytes); |
|||
tex.Apply(false); |
|||
SaveTexture(tex); |
|||
} |
|||
|
|||
public static void SaveTexture(Texture2D tex) |
|||
{ |
|||
byte[] bytes = tex.EncodeToPNG(); |
|||
File.WriteAllBytes(kSavePath, bytes); |
|||
} |
|||
|
|||
public static byte LightAttenuationNormalized(float distSqr) |
|||
{ |
|||
// 1 / 1.0 + quadAtten * distSqr attenuation function
|
|||
float atten = 1.0f / (1.0f + CalculateLightQuadFac(1.0f) * distSqr); |
|||
|
|||
// however the above does not falloff to zero at light range.
|
|||
// Start fading from ktoZeroFadeStart to light range
|
|||
float fadeMultiplier = Mathf.Clamp01((distSqr - 1.0f) / (kToZeroFadeStart - 1.0f)); |
|||
atten *= fadeMultiplier; |
|||
|
|||
//return atten;
|
|||
return (byte)Mathf.RoundToInt(atten * (float)byte.MaxValue); |
|||
} |
|||
|
|||
public static float CalculateLightQuadFac(float range) |
|||
{ |
|||
return kQuadraticFac / (range * range); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: dd9e613bcee552646a17f8b54e3519de |
|||
timeCreated: 1503914974 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 926949d7f34e3e143a1acbf6270e42e0 |
|||
timeCreated: 1488965025 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef LIGHTWEIGHT_INPUT_INCLUDED |
|||
#define LIGHTWEIGHT_INPUT_INCLUDED |
|||
|
|||
#define MAX_VISIBLE_LIGHTS 16 |
|||
|
|||
// Main light initialized without indexing |
|||
#define INITIALIZE_MAIN_LIGHT(light) \ |
|||
light.pos = _MainLightPosition; \ |
|||
light.color = _MainLightColor; \ |
|||
light.atten = _MainLightAttenuationParams; \ |
|||
light.spotDir = _MainLightSpotDir; |
|||
|
|||
// Indexing might have a performance hit for old mobile hardware |
|||
#define INITIALIZE_LIGHT(light, i) \ |
|||
half4 indices = (i < 4) ? unity_4LightIndices0 : unity_4LightIndices1; \ |
|||
int index = (i < 4) ? i : i - 4; \ |
|||
int lightIndex = indices[index]; \ |
|||
light.pos = _AdditionalLightPosition[lightIndex]; \ |
|||
light.color = _AdditionalLightColor[lightIndex]; \ |
|||
light.atten = _AdditionalLightAttenuationParams[lightIndex]; \ |
|||
light.spotDir = _AdditionalLightSpotDir[lightIndex] |
|||
|
|||
#if (defined(_MAIN_DIRECTIONAL_LIGHT) || defined(_MAIN_SPOT_LIGHT) || defined(_MAIN_POINT_LIGHT)) |
|||
#define _MAIN_LIGHT |
|||
#endif |
|||
|
|||
#ifdef _SPECULAR_SETUP |
|||
#define SAMPLE_METALLICSPECULAR(uv) tex2D(_SpecGlossMap, uv) |
|||
#else |
|||
#define SAMPLE_METALLICSPECULAR(uv) tex2D(_MetallicGlossMap, uv) |
|||
#endif |
|||
|
|||
#if defined(UNITY_COLORSPACE_GAMMA) && defined(_LIGHTWEIGHT_FORCE_LINEAR) |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(gammaColor) gammaColor * gammaColor |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(linColor) sqrt(color) |
|||
#else |
|||
#define LIGHTWEIGHT_GAMMA_TO_LINEAR(color) color |
|||
#define LIGHTWEIGHT_LINEAR_TO_GAMMA(color) color |
|||
#endif |
|||
|
|||
struct LightInput |
|||
{ |
|||
float4 pos; |
|||
half4 color; |
|||
float4 atten; |
|||
half4 spotDir; |
|||
}; |
|||
|
|||
CBUFFER_START(_PerObject) |
|||
half4 unity_LightIndicesOffsetAndCount; |
|||
half4 unity_4LightIndices0; |
|||
half4 unity_4LightIndices1; |
|||
half _Shininess; |
|||
CBUFFER_END |
|||
|
|||
CBUFFER_START(_PerCamera) |
|||
float4 _MainLightPosition; |
|||
half4 _MainLightColor; |
|||
float4 _MainLightAttenuationParams; |
|||
half4 _MainLightSpotDir; |
|||
|
|||
half4 _AdditionalLightCount; |
|||
float4 _AdditionalLightPosition[MAX_VISIBLE_LIGHTS]; |
|||
half4 _AdditionalLightColor[MAX_VISIBLE_LIGHTS]; |
|||
float4 _AdditionalLightAttenuationParams[MAX_VISIBLE_LIGHTS]; |
|||
half4 _AdditionalLightSpotDir[MAX_VISIBLE_LIGHTS]; |
|||
CBUFFER_END |
|||
|
|||
CBUFFER_START(_PerFrame) |
|||
half4 _GlossyEnvironmentColor; |
|||
sampler2D _AttenuationTexture; |
|||
CBUFFER_END |
|||
|
|||
struct LightweightVertexInput |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float3 normal : NORMAL; |
|||
float4 tangent : TANGENT; |
|||
float2 texcoord : TEXCOORD0; |
|||
float2 lightmapUV : TEXCOORD1; |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct LightweightVertexOutput |
|||
{ |
|||
float4 uv01 : TEXCOORD0; // uv01.xy: uv0, uv01.zw: uv1 |
|||
float4 posWS : TEXCOORD1; |
|||
#if _NORMALMAP |
|||
half3 tangentToWorld0 : TEXCOORD2; // tangentToWorld matrix |
|||
half3 tangentToWorld1 : TEXCOORD3; // tangentToWorld matrix |
|||
half3 tangentToWorld2 : TEXCOORD4; // tangentToWorld matrix |
|||
#else |
|||
half3 normal : TEXCOORD2; |
|||
#endif |
|||
half4 viewDir : TEXCOORD5; // xyz: viewDir |
|||
half4 fogCoord : TEXCOORD6; // x: fogCoord, yzw: vertexColor |
|||
float4 hpos : SV_POSITION; |
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
struct SurfaceData |
|||
{ |
|||
half3 albedo; |
|||
half alpha; |
|||
half4 metallicSpecGloss; |
|||
half3 normalWorld; |
|||
half ao; |
|||
half3 emission; |
|||
}; |
|||
|
|||
struct BRDFData |
|||
{ |
|||
half3 diffuse; |
|||
half3 specular; |
|||
half perceptualRoughness; |
|||
half roughness; |
|||
half grazingTerm; |
|||
}; |
|||
|
|||
inline half Alpha(half albedoAlpha) |
|||
{ |
|||
#if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) |
|||
half alpha = _Color.a; |
|||
#else |
|||
half alpha = albedoAlpha * _Color.a; |
|||
#endif |
|||
|
|||
#if defined(_ALPHATEST_ON) |
|||
clip(alpha - _Cutoff); |
|||
#endif |
|||
|
|||
return alpha; |
|||
} |
|||
|
|||
inline half3 Normal(LightweightVertexOutput i) |
|||
{ |
|||
#if _NORMALMAP |
|||
half3 normalTangent = UnpackNormal(tex2D(_BumpMap, i.uv01.xy)); |
|||
|
|||
// glsl compiler will generate underperforming code by using a row-major pre multiplication matrix: mul(normalmap, i.tangentToWorld) |
|||
// i.tangetToWorld was initialized as column-major in vs and here dot'ing individual for better performance. |
|||
// The code below is similar to post multiply: mul(i.tangentToWorld, normalmap) |
|||
half3 normalWorld = normalize(half3(dot(normalTangent, i.tangentToWorld0), dot(normalTangent, i.tangentToWorld1), dot(normalTangent, i.tangentToWorld2))); |
|||
#else |
|||
half3 normalWorld = normalize(i.normal); |
|||
#endif |
|||
|
|||
return normalWorld; |
|||
} |
|||
|
|||
inline void SpecularGloss(half2 uv, half alpha, out half4 specularGloss) |
|||
{ |
|||
specularGloss = half4(0, 0, 0, 1); |
|||
#ifdef _SPECGLOSSMAP |
|||
specularGloss = tex2D(_SpecGlossMap, uv); |
|||
specularGloss.rgb = LIGHTWEIGHT_GAMMA_TO_LINEAR(specularGloss.rgb); |
|||
#elif defined(_SPECULAR_COLOR) |
|||
specularGloss = _SpecColor; |
|||
#endif |
|||
|
|||
#ifdef _GLOSSINESS_FROM_BASE_ALPHA |
|||
specularGloss.a = alpha; |
|||
#endif |
|||
} |
|||
|
|||
half4 MetallicSpecGloss(float2 uv, half albedoAlpha) |
|||
{ |
|||
half4 specGloss; |
|||
|
|||
#ifdef _METALLICSPECGLOSSMAP |
|||
specGloss = specGloss = SAMPLE_METALLICSPECULAR(uv); |
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
specGloss.a = albedoAlpha * _GlossMapScale; |
|||
#else |
|||
specGloss.a *= _GlossMapScale; |
|||
#endif |
|||
|
|||
#else // _METALLICSPECGLOSSMAP |
|||
#if _METALLIC_SETUP |
|||
specGloss.rgb = _Metallic.rrr; |
|||
#else |
|||
specGloss.rgb = _SpecColor.rgb; |
|||
#endif |
|||
|
|||
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A |
|||
specGloss.a = albedoAlpha * _GlossMapScale; |
|||
#else |
|||
specGloss.a = _Glossiness; |
|||
#endif |
|||
#endif |
|||
|
|||
return specGloss; |
|||
} |
|||
|
|||
half OcclusionLW(float2 uv) |
|||
{ |
|||
#ifdef _OCCLUSIONMAP |
|||
#if (SHADER_TARGET < 30) |
|||
// SM20: instruction count limitation |
|||
// SM20: simpler occlusion |
|||
return tex2D(_OcclusionMap, uv).g; |
|||
#else |
|||
half occ = tex2D(_OcclusionMap, uv).g; |
|||
return LerpOneTo(occ, _OcclusionStrength); |
|||
#endif |
|||
#else |
|||
return 1.0; |
|||
#endif |
|||
} |
|||
|
|||
half3 EmissionLW(float2 uv) |
|||
{ |
|||
#ifndef _EMISSION |
|||
return 0; |
|||
#else |
|||
return LIGHTWEIGHT_GAMMA_TO_LINEAR(tex2D(_EmissionMap, uv).rgb) * _EmissionColor.rgb; |
|||
#endif |
|||
} |
|||
|
|||
#endif |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue