浏览代码

Fixed occlusion strength. All LWRP shaders are defined with target model 2.0.

/main
Felipe Lira 7 年前
当前提交
2a043f5d
共有 2 个文件被更改,包括 5 次插入6 次删除
  1. 5
      com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/InputSurfacePBR.hlsl
  2. 6
      com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Lighting.hlsl

5
com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/InputSurfacePBR.hlsl


half SampleOcclusion(float2 uv)
{
#ifdef _OCCLUSIONMAP
#if (SHADER_TARGET < 30)
// SM20: instruction count limitation
// SM20: simpler occlusion
// TODO: Controls things like these by exposing SHADER_QUALITY levels (low, medium, high)
#if defined(SHADER_API_GLES)
return SAMPLE_TEXTURE2D(_OcclusionMap, sampler_OcclusionMap, uv).g;
#else
half occ = SAMPLE_TEXTURE2D(_OcclusionMap, sampler_OcclusionMap, uv).g;

6
com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Lighting.hlsl


// If lightmap is not defined than we evaluate GI (ambient + probes) from SH
// We might do it fully or partially in vertex to save shader ALU
#if !defined(LIGHTMAP_ON)
#if defined(SHADER_API_GLES) || (SHADER_TARGET < 30) || !defined(_NORMALMAP)
// TODO: Controls things like these by exposing SHADER_QUALITY levels (low, medium, high)
#if defined(SHADER_API_GLES) || !defined(_NORMALMAP)
// Evaluates SH fully in vertex
#define EVALUATE_SH_VERTEX
#elif !SHADER_HINT_NICE_QUALITY

half ReflectivitySpecular(half3 specular)
{
#if (SHADER_TARGET < 30)
// SM2.0: instruction count limitation
#if defined(SHADER_API_GLES)
return specular.r; // Red channel - because most metals are either monocrhome or with redish/yellowish tint
#else
return max(max(specular.r, specular.g), specular.b);

正在加载...
取消
保存