Light Probe Proxy Volume component
来源:互联网 发布:java 面试常见问题 编辑:程序博客网 时间:2024/06/05 10:56
Light Probe Proxy Volume component
https://docs.unity3d.com/Manual/class-LightProbeProxyVolume.html
The Light Probe Proxy Volume (LPPV) component allows you to use more lighting information for large dynamic GameObjects that cannot use baked lightmaps (for example, large Particle Systems or skinned Meshes).
By default, a probe-lit Renderer receives lighting from a single Light Probe that is interpolated between the surrounding Light Probes in the Scene. Because of this, GameObjects have constant ambient lighting across the surface. This lighting has a rotational gradient because it is using spherical harmonics, but it lacks a spatial gradient. This is more noticeable on larger GameObjects or Particle Systems. The lighting across the GameObject matches the lighting at the anchor point, and if the GameObject straddles a lighting gradient, parts of the GameObject may look incorrect.
The Light Probe Proxy Volume component generates a 3D grid of interpolated Light Probes inside a Bounding Volume. You can specify the resolution of this grid in the UI of the component. The spherical harmonics (SH) coefficients of the interpolated Light Probes are uploaded into 3D textures. The 3D textures containing SH coefficients are then sampled at render time to compute the contribution to the diffuse ambient lighting. This adds a spatial gradient to probe-lit GameObjects.
The Standard Shader supports this feature. To add this to a custom shader, use theShadeSHPerPixel
function. To learn how to implement this function, see theParticle System sample Shader code example at the bottom of this page.
When to use the component
Most of the Renderer components in Unity contain Light Probes. There are three options for Light Probes:
Off: the Renderer doesn’t use any interpolated Light Probes.
Blend Probes (default value): the Renderer uses one interpolated Light Probe.
Use Proxy Volume: the Renderer uses a 3D grid of interpolated Light Probes.
When you set the Light Probes property to Use Proxy Volume, the GameObject must have aLight Probe Proxy Volume (LPPV) component attached. You can add a LPPV component on the same GameObject, or you can use (borrow) a LPPV component from another GameObject using theProxy Volume Override property. If Unity cannot find a LPPV component in the current GameObject or in the Proxy Volume Override GameObject, a warning message is displayed at the bottom of the Renderer.
Example
An example of a simple Mesh Renderer using a Light Probe Proxy Volume componentIn the Scene above, there are two planes on the floor using Materials that emit a lot of light. Note that:
The ambient light changes across the geometry when using a LPPV component. Use one interpolated Light Probe to create a constant color on each side of the geometry.
The geometry doesn’t use static lightmaps, and the spheres represent interpolated Light Probes. They are part of theGizmo Renderer.
How to use the component
The area in which the 3D grid of interpolated Light Probes are generated is affected by theBounding Box Mode property.
There are three options available:
The main difference between Automatic Local and Automatic World is that inAutomatic Local, the bounding box is more resource-intensive to compute when a large hierarchy of GameObjects uses the same LPPV component from a parent GameObject. However, the resulting bounding box may be smaller in size, meaning the lighting data is more compact.
The number of interpolated Light Probes from within the bounding volume is affected by theProxy Volume Resolution property. There are two options:
Automatic (default value) - The resolution on each axis is computed using the number of interpolated Light Probes per unit area that you specify, and the size of the bounding box.
Custom - Allows you to specify a different resolution on each axis (see below).
Note: The final resolution on each axis must be a power of two, and the maximum value of the resolution is 32.
Probe Position Mode specifies the relative position of an interpolated Light Probe to a cell center. This option may be useful in situations when some of the interpolated Light Probes pass through walls or other geometries and cause light leaking. The example below shows the difference between Cell Corner andCell Center in a 2D view, using a 4x4 grid resolution:
Images for comparison
A simple Mesh Renderer using a Standard Shader:
With Light Probe Proxy Volume (resolution: 4x1x1)Without Light Probe Proxy VolumeA skinned Mesh Renderer using a Standard Shader:
With Light Probe Proxy Volume (resolution: 2x2x2)Without Light Probe Proxy Volume
Particle System sample Shader using the ShadeSHPerPixel function
Shader "Particles/AdditiveLPPV" {Properties { _MainTex ("Particle Texture", 2D) = "white" {} _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)}Category { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Blend SrcAlpha One ColorMask RGB Cull Off Lighting Off ZWrite Off SubShader { Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma multi_compile_particles #pragma multi_compile_fog // Specify the target #pragma target 3.0 #include "UnityCG.cginc" // You must include this header to have access to ShadeSHPerPixel #include "UnityStandardUtils.cginc" fixed4 _TintColor; sampler2D _MainTex; struct appdata_t { float4 vertex : POSITION; float3 normal : NORMAL; fixed4 color : COLOR; float2 texcoord : TEXCOORD0; }; struct v2f { float4 vertex : SV_POSITION; fixed4 color : COLOR; float2 texcoord : TEXCOORD0; UNITY_FOG_COORDS(1) float3 worldPos : TEXCOORD2; float3 worldNormal : TEXCOORD3; }; float4 _MainTex_ST; v2f vert (appdata_t v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.worldNormal = UnityObjectToWorldNormal(v.normal); o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; o.color = v.color; o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex); UNITY_TRANSFER_FOG(o,o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { half3 currentAmbient = half3(0, 0, 0); half3 ambient = ShadeSHPerPixel(i.worldNormal, currentAmbient, i.worldPos); fixed4 col = _TintColor * i.color * tex2D(_MainTex, i.texcoord); col.xyz += ambient; UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode return col; } ENDCG } } }}
Hardware requirements
The component requires at least Shader Model 4 graphics hardware and API support, including support for 3D Textures with 32-bit floating-point format and linear filtering.
To work correctly, the Scene needs to contain Light Probes via Light Probe Group components. If a requirement is not fulfilled, the Renderer or Light Probe Proxy Volume component Inspector displays a warning message.
Did you find this page useful? Please give it a rating:
Report a problem on this page
- Light Probe Proxy Volume component
- 淺談Unity 5.4新功能:Light Probe Proxy Volume
- Unity 之 Light : Light Probe
- 光照探针 (light probe)
- react-bits:Proxy Component
- Tetrahedron based light probe interpolation(基于四面体的Light Probe插值)
- Unity 3D笔记——Light Probe
- unity3d Light Probe Group图解超详细使用方法
- unity3d Light Probe Group图解超详细使用方法
- probe
- boss1接受light probe影响且能 cut off 且能 不透
- Support All : light probe, 透贴剔除(clip) , 中枪散红。。
- 我的Unity 3D之旅——杂记之LightMapping和Light Probe
- volume
- volume
- “UNMOUNTABLE-BOOT-VOLUME及Lsass.exe unable to locate component” 解决
- Light
- @Component
- idea 从数据库快速生成Spring Data JPA实体类
- new、delete和malloc、free
- Eclipse安装SVN插件
- 代理模式
- 定义一个Language类
- Light Probe Proxy Volume component
- TCP编程
- Go语言操作mysql实现增删改查
- 区块链开发(六)本地部署 Browser-solidity
- Java集合框架之Collections类的常用方法
- HttpClient请求
- 支付宝手机网页支付之golang版
- C/C++中#pragma once的使用
- ThreadLocal相关