OSDN Git Service

Added Assets for main menu
[mindgames/Mindgames_main.git] / Mindgames / Library / PackageCache / com.unity.render-pipelines.high-definition@6.9.0-preview / Runtime / Material / Builtin / BuiltinData.cs
1 //-----------------------------------------------------------------------------
2 // structure definition
3 //-----------------------------------------------------------------------------
4 using UnityEngine.Experimental.Rendering.HDPipeline.Attributes;
5
6 namespace UnityEngine.Experimental.Rendering.HDPipeline
7 {
8     public class Builtin // Note: This particular class doesn't derive from RenderPipelineMaterial
9     {
10         //-----------------------------------------------------------------------------
11         // BuiltinData
12         // This structure include common data that should be present in all material
13         // and are independent from the BSDF parametrization.
14         // Note: These parameters can be store in GBuffer or not depends on storage available
15         //-----------------------------------------------------------------------------
16         [GenerateHLSL(PackingRules.Exact, false, false, true, 100)]
17         public struct BuiltinData
18         {
19             [MaterialSharedPropertyMapping(MaterialSharedProperty.Alpha)]
20             [SurfaceDataAttributes("Opacity")]
21             public float opacity;
22
23             // These are lighting data.
24             // We would prefer to split lighting and material information but for performance reasons,
25             // those lighting information are fill
26             // at the same time than material information.
27             [SurfaceDataAttributes("Bake Diffuse Lighting", false, true)]
28             public Vector3 bakeDiffuseLighting; // This is the result of sampling lightmap/lightprobe/proxyvolume
29             [SurfaceDataAttributes("Back Bake Diffuse Lighting", false, true)]
30             public Vector3 backBakeDiffuseLighting; // This is the result of sampling lightmap/lightprobe/proxyvolume from the back for transmission
31
32             // Use for float instead of vector4 to ease the debug (no performance impact)
33             // Note: We have no way to remove these value automatically based on either SHADEROPTIONS_BAKED_SHADOW_MASK_ENABLE or s_BakedShadowMaskEnable here. Unless we make two structure... For now always keep this value
34             [SurfaceDataAttributes("Shadow Mask 0")]
35             public float shadowMask0;
36             [SurfaceDataAttributes("Shadow Mask 1")]
37             public float shadowMask1;
38             [SurfaceDataAttributes("Shadow Mask 2")]
39             public float shadowMask2;
40             [SurfaceDataAttributes("Shadow Mask 3")]
41             public float shadowMask3;
42
43             [SurfaceDataAttributes("Emissive Color", false, false)]
44             public Vector3 emissiveColor;
45
46             // These is required for motion blur and temporalAA
47             [SurfaceDataAttributes("MotionVector")]
48             public Vector2 motionVector;
49
50             // Distortion
51             [SurfaceDataAttributes("Distortion")]
52             public Vector2 distortion;
53             [SurfaceDataAttributes("Distortion Blur")]
54             public float distortionBlur;           // Define the color buffer mipmap level to use
55
56             // Misc
57             [SurfaceDataAttributes("RenderingLayers")]
58             public uint renderingLayers;
59
60             [SurfaceDataAttributes("Depth Offset")]
61             public float depthOffset; // define the depth in unity unit to add in Z forward direction
62         };
63
64         //-----------------------------------------------------------------------------
65         // LightTransportData
66         // This struct is use to store information for Enlighten/Progressive light mapper. both at runtime or off line.
67         //-----------------------------------------------------------------------------
68         [GenerateHLSL(PackingRules.Exact, false)]
69         public struct LightTransportData
70         {
71             [SurfaceDataAttributes("", false, true)]
72             public Vector3 diffuseColor;
73             public Vector3 emissiveColor; // HDR value
74         };
75
76         public static GraphicsFormat GetLightingBufferFormat()
77         {
78             return GraphicsFormat.B10G11R11_UFloatPack32;
79         }
80
81         public static GraphicsFormat GetShadowMaskBufferFormat()
82         {
83             return GraphicsFormat.R8G8B8A8_UNorm;
84         }
85
86         public static GraphicsFormat GetMotionVectorFormat()
87         {
88             return GraphicsFormat.R16G16_SFloat; // TODO: We should use 16bit normalized instead, better precision // RGInt
89         }
90
91         public static GraphicsFormat GetDistortionBufferFormat()
92         {
93             // TODO: // This format need to be additive blendable and include distortionBlur, blend mode different for alpha value
94             return GraphicsFormat.R16G16B16A16_SFloat;
95         }
96     }
97 }