浏览代码
Merge pull request #1776 from Unity-Technologies/LuxIntensityForHDRISky
Merge pull request #1776 from Unity-Technologies/LuxIntensityForHDRISky
Lux intensity for hdri sky/main
GitHub
7 年前
当前提交
8b3692f4
共有 14 个文件被更改,包括 235 次插入 和 23 次删除
-
1com.unity.render-pipelines.high-definition/CHANGELOG.md
-
1com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs
-
85com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs
-
10com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs
-
1com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
-
1com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
-
1com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISky.shader
-
21com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISkyRenderer.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs
-
31com.unity.render-pipelines.high-definition/HDRP/Sky/SkySettings.cs
-
85com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader
-
9com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader.meta
-
8com.unity.render-pipelines.high-definition/HDRP/Sky/AtmosphericScattering.meta
|
|||
Shader "Hidden/HDRenderPipeline/IntegrateHDRI" |
|||
{ |
|||
Properties |
|||
{ |
|||
[HideInInspector] |
|||
_Cubemap ("", CUBE) = "white" {} |
|||
_InvOmegaP ("", Float) = 0 |
|||
} |
|||
|
|||
SubShader |
|||
{ |
|||
Tags{ "RenderPipeline" = "HDRenderPipeline" } |
|||
Pass |
|||
{ |
|||
ZTest Always Cull Off ZWrite Off |
|||
|
|||
HLSLPROGRAM |
|||
#pragma vertex Vert |
|||
#pragma fragment Frag |
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch |
|||
|
|||
#include "CoreRP/ShaderLibrary/Common.hlsl" |
|||
#include "CoreRP/ShaderLibrary/Color.hlsl" |
|||
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl" |
|||
#include "../../ShaderVariables.hlsl" |
|||
|
|||
struct Attributes |
|||
{ |
|||
uint vertexID : SV_VertexID; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS : SV_POSITION; |
|||
float2 texCoord : TEXCOORD0; |
|||
}; |
|||
|
|||
TextureCube<float4> _Cubemap; |
|||
float _InvOmegaP; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
Varyings output; |
|||
|
|||
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); |
|||
output.texCoord = GetFullScreenTriangleTexCoord(input.vertexID); |
|||
|
|||
return output; |
|||
} |
|||
|
|||
|
|||
// Spherical integration of the upper hemisphere |
|||
real GetUpperHemisphereLuxValue(TEXTURECUBE_ARGS(skybox, sampler_skybox), real3 N) |
|||
{ |
|||
float sum = 0.0; |
|||
float dphi = 0.005; |
|||
float dtheta = 0.005; |
|||
for (float phi = 0; phi < 2.0 * PI; phi += dphi) |
|||
{ |
|||
for (float theta = 0; theta < PI / 2.0; theta += dtheta) |
|||
{ |
|||
float3 L = TransformGLtoDX(SphericalToCartesian(phi, cos(theta))); |
|||
real val = Luminance(SAMPLE_TEXTURECUBE_LOD(skybox, sampler_skybox, L, 0).rgb); |
|||
sum += cos(theta) * sin(theta) * val; |
|||
} |
|||
} |
|||
sum *= dphi * dtheta; |
|||
return sum; |
|||
} |
|||
|
|||
float4 Frag(Varyings input) : SV_Target |
|||
{ |
|||
float3 N = float3(0.0, 1.0, 0.0); |
|||
|
|||
float intensity = GetUpperHemisphereLuxValue(TEXTURECUBE_PARAM(_Cubemap, s_trilinear_clamp_sampler), N); |
|||
|
|||
return float4(intensity, 1.0, 1.0, 1.0); |
|||
} |
|||
|
|||
ENDHLSL |
|||
} |
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 48db2705cf2856d4e893eb30a6892d1b |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: d522828bc0314e14cb6faa4291bb64da |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue