浏览代码

add a new scene for fast batch, using light probes only

/batch_rendering
Arnaud Carre 8 年前
当前提交
7500d3c2
共有 34 个文件被更改,包括 1422 次插入1375 次删除
  1. 3
      Assets/BasicRenderBatching/BasicBatching.unity
  2. 2
      Assets/BasicRenderBatching/BasicMat_ColorsFlat.mat
  3. 2
      Assets/BasicRenderBatching/BasicMat_ColorsFlat.mat.meta
  4. 2
      Assets/BasicRenderBatching/LightingBatching/LightingData.asset.meta
  5. 999
      Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_dir.png
  6. 2
      Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_dir.png.meta
  7. 1001
      Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_light.exr
  8. 2
      Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_light.exr.meta
  9. 2
      Assets/BasicRenderBatching/LightingBatching/ReflectionProbe-0.exr.meta
  10. 4
      Assets/BasicRenderBatching/Prefabs/Capsule.prefab
  11. 4
      Assets/BasicRenderBatching/Prefabs/cube.prefab
  12. 4
      Assets/BasicRenderBatching/Prefabs/cylinder.prefab
  13. 4
      Assets/BasicRenderBatching/Prefabs/sphere.prefab
  14. 37
      Assets/BasicRenderBatching/Scripts/PopulateScene.cs
  15. 7
      Assets/TestScenes/HDTest/Editor/Generator.cs
  16. 2
      Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron50.mat
  17. 2
      Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron51.mat
  18. 2
      Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron52.mat
  19. 2
      Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron53.mat
  20. 4
      ProjectSettings/EditorBuildSettings.asset
  21. 107
      Assets/BasicRenderBatching/BasicMat_Colors8Textures.mat
  22. 8
      Assets/BasicRenderBatching/BasicMat_Colors8Textures.mat.meta
  23. 148
      Assets/BasicRenderBatching/BasicRenderBatchingShaderFlat.shader
  24. 17
      Assets/BasicRenderBatching/BasicRenderBatchingShaderFlat.shader.meta
  25. 9
      Assets/BasicRenderBatching/LightingBatchingProbe.meta
  26. 8
      Assets/BasicRenderBatching/LightingBatchingProbe.unity.meta
  27. 335
      Assets/BasicRenderBatching/LightingBatchingProbe/LightingData.asset
  28. 8
      Assets/BasicRenderBatching/LightingBatchingProbe/LightingData.asset.meta
  29. 1
      Assets/BasicRenderBatching/LightingBatchingProbe/ReflectionProbe-0.exr
  30. 69
      Assets/BasicRenderBatching/LightingBatchingProbe/ReflectionProbe-0.exr.meta

3
Assets/BasicRenderBatching/BasicBatching.unity


- {fileID: 1877103646185790, guid: 8f7529457c6468241a2043fcfcc241d5, type: 2}
m_CenterPoint: {fileID: 970523335}
m_Material: {fileID: 2100000, guid: 4c676c131a81b634988506c3023ea7a5, type: 2}
m_MaterialFlat: {fileID: 2100000, guid: a210f34e3be3934469873bc52280e018, type: 2}
m_Textures:
- {fileID: 2800000, guid: 4425fca2a65e78c49b2415476d1cc5ec, type: 3}
- {fileID: 2800000, guid: 04b429f47f1e0d54ca799a2a31986801, type: 3}

- {fileID: 2800000, guid: 2d69bdda1399802499987e9f68ae88ed, type: 3}
- {fileID: 2800000, guid: 14d974c88ade21747938eb13f6cfc152, type: 3}
- {fileID: 2800000, guid: 8e18cf146b7c0d0449454cdeb8653d94, type: 3}
m_GridWidth: 32
m_GridWidth: 128
m_GridLayers: 1
m_Spacing: 0.4
--- !u!114 &870320119

2
Assets/BasicRenderBatching/BasicMat_ColorsFlat.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: BasicMat_ColorsFlat
m_Shader: {fileID: 4800000, guid: 915ec92038355ed418b43639259468cc, type: 3}
m_Shader: {fileID: 4800000, guid: 552f186b9e84fe1409a0c237fff4c3e6, type: 3}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: -1

2
Assets/BasicRenderBatching/BasicMat_ColorsFlat.mat.meta


fileFormatVersion: 2
guid: 4c676c131a81b634988506c3023ea7a5
guid: a210f34e3be3934469873bc52280e018
timeCreated: 1481127206
licenseType: Pro
NativeFormatImporter:

2
Assets/BasicRenderBatching/LightingBatching/LightingData.asset.meta


fileFormatVersion: 2
guid: 44aa08b82f029c24c9caf197abd44104
timeCreated: 1484930574
timeCreated: 1485275241
licenseType: Pro
NativeFormatImporter:
userData:

999
Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_dir.png
文件差异内容过多而无法显示
查看文件

2
Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_dir.png.meta


fileFormatVersion: 2
guid: ad22e7bf57a4379458b82f1ad1d811ec
timeCreated: 1484930573
timeCreated: 1485275241
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}

1001
Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_light.exr
文件差异内容过多而无法显示
查看文件

2
Assets/BasicRenderBatching/LightingBatching/Lightmap-0_comp_light.exr.meta


fileFormatVersion: 2
guid: 48d7ce7bf1faaf54985ad930e4ba99e0
timeCreated: 1484930573
timeCreated: 1485275240
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}

2
Assets/BasicRenderBatching/LightingBatching/ReflectionProbe-0.exr.meta


fileFormatVersion: 2
guid: a25c50b9d16c49847a970c85ab120a4b
timeCreated: 1484930574
timeCreated: 1485275241
licenseType: Pro
TextureImporter:
fileIDToRecycleName:

4
Assets/BasicRenderBatching/Prefabs/Capsule.prefab


m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4091326064044868
Transform:

m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}

4
Assets/BasicRenderBatching/Prefabs/cube.prefab


m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4091326064044868
Transform:

m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}

4
Assets/BasicRenderBatching/Prefabs/cylinder.prefab


m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4091326064044868
Transform:

m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}

4
Assets/BasicRenderBatching/Prefabs/sphere.prefab


m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4091326064044868
Transform:

m_CastShadows: 1
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: de48705454e39554fb09f6cd7f8e9cdf, type: 2}

37
Assets/BasicRenderBatching/Scripts/PopulateScene.cs


public GameObject[] m_ObjectsPrefab = new GameObject[4];
public Transform m_CenterPoint;
public Material m_Material;
public Material m_Material;
public Material m_MaterialFlat;
public Texture2D[] m_Textures = new Texture2D[8];

public static bool m_ChangeTexture = false;
public static bool m_Use8Textures = false;
private GameObject[] m_Objects; //
private Material[] m_Materials; //

m_Objects[iIndex] = Instantiate(m_ObjectsPrefab[r], vPos, m_CenterPoint.rotation) as GameObject;
Renderer renderer = m_Objects[iIndex].GetComponent<Renderer>();
Material mat = Instantiate(m_Material);
Material mat;
if ( m_Use8Textures )
mat = Instantiate(m_Material);
else
mat = Instantiate(m_MaterialFlat);
mat.SetTexture("myTexture1", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture2", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture3", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture4", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture5", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture6", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture7", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture8", m_Textures[Random.Range(0, 7 + 1)]);
if (m_Use8Textures)
{
mat.SetTexture("myTexture1", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture2", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture3", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture4", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture5", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture6", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture7", m_Textures[Random.Range(0, 7 + 1)]);
mat.SetTexture("myTexture8", m_Textures[Random.Range(0, 7 + 1)]);
}
renderer.material = mat;
renderer.material.InitUniformBuffers();

// Update is called once per frame
void Update ()
{
if ( m_ChangeTexture )
/*
if ( m_Use8Textures )
{
int r = Random.Range(0, m_GridWidth * m_GridWidth * m_GridLayers);
m_Materials[r].SetTexture("myTexture1", m_Textures[Random.Range(0, 7 + 1)]);

m_Materials[r].SetTexture("myTexture7", m_Textures[Random.Range(0, 7 + 1)]);
m_Materials[r].SetTexture("myTexture8", m_Textures[Random.Range(0, 7 + 1)]);
}
*/
}

GUI.changed = false;
m_ChangeTexture = GUI.Toggle(new Rect(10, 10, 200, 20), m_ChangeTexture, "change rand texture");
m_Use8Textures = GUI.Toggle(new Rect(10, 10, 200, 20), m_Use8Textures, "change rand texture");
if (GUI.changed)
{

7
Assets/TestScenes/HDTest/Editor/Generator.cs


foreach (var o in toErase)
Object.DestroyImmediate(o);
toErase = (Object.FindObjectsOfType(typeof(GameObject)) as GameObject[]).Where(o => o.name.Contains("Iron5") && o.name.Contains("(Clone)"));
foreach (var o in toErase)
Object.DestroyImmediate(o);
Random.InitState(31415926);

GameObject obj = GameObject.Instantiate(m_ObjectsPrefab[Random.Range(0, 4)], vPos, Quaternion.identity) as GameObject;
Renderer renderer = obj.GetComponent<Renderer>();
Material mat = Material.Instantiate(m_MaterialPrefab[Random.Range(0, 4)]);
int matN = 0; // Random.Range(0, 4)
Material mat = Material.Instantiate(m_MaterialPrefab[matN]);
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
mat.SetColor("myColor", oColor);

2
Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron50.mat


m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 2800000, guid: 9ff9c6d475294cf43ab097544fa80acb, type: 3}
m_Texture: {fileID: 2800000, guid: 01d4711c76f1a124e9e34627ca2a6dc3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:

2
Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron51.mat


m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 2800000, guid: 9ff9c6d475294cf43ab097544fa80acb, type: 3}
m_Texture: {fileID: 2800000, guid: 94a2ed6817826da4f8b7f7c1c7e7f6ec, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:

2
Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron52.mat


m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 32c4b9c8ddc1c5d49ac7d10122540447, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:

2
Assets/TestScenes/HDTest/Material/BatchingTest/Materials/Iron53.mat


m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 2800000, guid: 9ff9c6d475294cf43ab097544fa80acb, type: 3}
m_Texture: {fileID: 2800000, guid: 21bed8c058c65f84e92fd4e28dd6ec51, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:

4
ProjectSettings/EditorBuildSettings.asset


path: Assets/BasicRenderBatching/BasicBatching.unity
- enabled: 0
path: Assets/TestScenes/HDTest/GlobalIlluminationTest.unity
- enabled: 1
- enabled: 0
- enabled: 1
path: Assets/BasicRenderBatching/LightingBatchingProbe.unity

107
Assets/BasicRenderBatching/BasicMat_Colors8Textures.mat


%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: BasicMat_Colors8Textures
m_Shader: {fileID: 4800000, guid: 915ec92038355ed418b43639259468cc, type: 3}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 2, y: 2}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 2, y: 2}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture1:
m_Texture: {fileID: 2800000, guid: 4425fca2a65e78c49b2415476d1cc5ec, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture2:
m_Texture: {fileID: 2800000, guid: 04b429f47f1e0d54ca799a2a31986801, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture3:
m_Texture: {fileID: 2800000, guid: 70233265683595f468e46f6300a0c7f5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture4:
m_Texture: {fileID: 2800000, guid: b94537f3a7934f84a9e66c662bc06800, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture5:
m_Texture: {fileID: 2800000, guid: ff3ba92a36048274ab6eb2ec4567fa44, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture6:
m_Texture: {fileID: 2800000, guid: 2d69bdda1399802499987e9f68ae88ed, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture7:
m_Texture: {fileID: 2800000, guid: 14d974c88ade21747938eb13f6cfc152, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- myTexture8:
m_Texture: {fileID: 2800000, guid: 8e18cf146b7c0d0449454cdeb8653d94, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.474
- _GlossyReflections: 1
- _Metallic: 0.194
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.97794116, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- myColor: {r: 1, g: 1, b: 1, a: 1}

8
Assets/BasicRenderBatching/BasicMat_Colors8Textures.mat.meta


fileFormatVersion: 2
guid: 4c676c131a81b634988506c3023ea7a5
timeCreated: 1481127206
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

148
Assets/BasicRenderBatching/BasicRenderBatchingShaderFlat.shader


// Upgrade NOTE: replaced 'glstate_matrix_invtrans_modelview0' with 'UNITY_MATRIX_IT_MV'
// Upgrade NOTE: replaced 'glstate_matrix_modelview0' with 'UNITY_MATRIX_MV'
// Upgrade NOTE: replaced 'glstate_matrix_mvp' with 'UNITY_MATRIX_MVP'
// Example shader for a scriptable render loop that calculates multiple lights
// in a single forward-rendered shading pass. Uses same PBR shading model as the
// Standard shader.
//
// The parameters and inspector of the shader are the same as Standard shader,
// for easier experimentation.
Shader "RenderLoop/Batching/StandardFlat"
{
// Properties is just a copy of Standard.shader. Our example shader does not use all of them,
// but the inspector UI expects all these to exist.
Properties
{
// _Color("Color", Color) = (1,1,1,1)
myColor("Color", Color) = (1,1,1,1)
// [HideInInspector] _Mode("__mode", Float) = 0.0
// [HideInInspector] _SrcBlend("__src", Float) = 1.0
// [HideInInspector] _DstBlend("__dst", Float) = 0.0
// [HideInInspector] _ZWrite("__zw", Float) = 1.0
}
SubShader
{
Tags { "RenderType" = "Opaque" "PerformanceChecks" = "False" }
LOD 300
// Multiple lights at once pass, for our example Basic render loop.
Pass
{
Tags { "LightMode" = "BasicPass" }
// Use same blending / depth states as Standard shader
Blend One Zero
ZWrite On
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
//#pragma shader_feature _METALLICGLOSSMAP
//#include "UnityCG.cginc"
#include "HLSLSupport.cginc"
//float4 _Color;
// Global lighting data (setup from C# code once per frame).
CBUFFER_START(GlobalLightData)
// The variables are very similar to built-in unity_LightColor, unity_LightPosition,
// unity_LightAtten, unity_SpotDirection as used by the VertexLit shaders, except here
// we use world space positions instead of view space.
half4 globalLightColor[8];
float4 globalLightPos[8];
float4 globalLightSpotDir[8];
float4 globalLightAtten[8];
int4 globalLightCount;
// Global ambient/SH probe, similar to unity_SH* built-in variables.
float4 globalSH[7];
CBUFFER_END
CBUFFER_START(UniformBuffer_FastBatch : register(b1) )
float4 myColor;
CBUFFER_END
/*
CBUFFER_START(UnityPerDraw) // 352 bytes, uploaded per object (even if just position change position )
float4x4 UNITY_MATRIX_MVP;
float4x4 UNITY_MATRIX_MV;
float4x4 UNITY_MATRIX_IT_MV;
float4x4 unity_ObjectToWorld;
float4x4 unity_WorldToObject;
float4 unity_LODFade; // x is the fade value ranging within [0,1]. y is x quantized into 16 levels
float4 unity_WorldTransformParams; // w is usually 1.0, or -1.0 for odd-negative scale transforms
CBUFFER_END
*/
// Compute attenuation & illumination from one light
half3 EvaluateOneLight(int idx, float3 positionWS, half3 normalWS, float3 vAlbedo)
{
// direction to light
float3 dirToLight = globalLightPos[idx].xyz;
dirToLight -= positionWS * globalLightPos[idx].w;
// distance attenuation
float att = 1.0;
float distSqr = dot(dirToLight, dirToLight);
att /= (1.0 + globalLightAtten[idx].z * distSqr);
if (globalLightPos[idx].w != 0 && distSqr > globalLightAtten[idx].w) att = 0.0; // set to 0 if outside of range
distSqr = max(distSqr, 0.000001); // don't produce NaNs if some vertex position overlaps with the light
dirToLight *= rsqrt(distSqr);
// spotlight angular attenuation
// Fill in light & indirect structures, and evaluate Standard BRDF
half3 light = globalLightColor[idx].rgb * att;
half3 c = dot(dirToLight, normalWS) * light * vAlbedo;
return c;
}
// Vertex shader
struct v2f // vertex to fragment
{
float2 uv : TEXCOORD0;
float3 positionWS : TEXCOORD1;
float3 normalWS : TEXCOORD2;
float4 hpos : SV_POSITION;
};
struct s2v // stream to vertex
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 texcoord : TEXCOORD0;
};
v2f vert(s2v v)
{
v2f o;
o.uv = v.texcoord.xy;
o.hpos = mul(UNITY_MATRIX_MVP, v.vertex);
o.positionWS = mul(unity_ObjectToWorld, v.vertex).xyz;
o.normalWS = normalize(mul((float3x3)unity_WorldToObject, v.normal));
return o;
}
// Fragment shader
half4 frag(v2f i) : SV_Target
{
i.normalWS = normalize(i.normalWS);
float4 color;
float4 diffuseAlbedo = float4(1, 1, 1, 1);
color = half4(EvaluateOneLight(0, i.positionWS, i.normalWS, diffuseAlbedo.rgb * myColor.rgb),1);
return color;
}
ENDCG
}
}
// CustomEditor "StandardShaderGUI"
}

17
Assets/BasicRenderBatching/BasicRenderBatchingShaderFlat.shader.meta


fileFormatVersion: 2
guid: 552f186b9e84fe1409a0c237fff4c3e6
timeCreated: 1483608332
licenseType: Pro
ShaderImporter:
defaultTextures:
- myTexture1: {fileID: 2800000, guid: 4425fca2a65e78c49b2415476d1cc5ec, type: 3}
- myTexture2: {fileID: 2800000, guid: 04b429f47f1e0d54ca799a2a31986801, type: 3}
- myTexture3: {fileID: 2800000, guid: 70233265683595f468e46f6300a0c7f5, type: 3}
- myTexture4: {fileID: 2800000, guid: b94537f3a7934f84a9e66c662bc06800, type: 3}
- myTexture5: {fileID: 2800000, guid: ff3ba92a36048274ab6eb2ec4567fa44, type: 3}
- myTexture6: {fileID: 2800000, guid: 2d69bdda1399802499987e9f68ae88ed, type: 3}
- myTexture7: {fileID: 2800000, guid: 14d974c88ade21747938eb13f6cfc152, type: 3}
- myTexture8: {fileID: 2800000, guid: 8e18cf146b7c0d0449454cdeb8653d94, type: 3}
userData:
assetBundleName:
assetBundleVariant:

9
Assets/BasicRenderBatching/LightingBatchingProbe.meta


fileFormatVersion: 2
guid: 41f174a20bda91d4a8692d971d52c93f
folderAsset: yes
timeCreated: 1485274825
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

8
Assets/BasicRenderBatching/LightingBatchingProbe.unity.meta


fileFormatVersion: 2
guid: 31f42ae1e6cc3974891437c90e52bfa5
timeCreated: 1481127663
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

335
Assets/BasicRenderBatching/LightingBatchingProbe/LightingData.asset
文件差异内容过多而无法显示
查看文件

8
Assets/BasicRenderBatching/LightingBatchingProbe/LightingData.asset.meta


fileFormatVersion: 2
guid: c3a6e4b0d5368cc47bd136cb4b389e6b
timeCreated: 1485275198
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

1
Assets/BasicRenderBatching/LightingBatchingProbe/ReflectionProbe-0.exr


v/1channelschlist7BGRcompressioncompressiondataWindowbox2i�displayWindowbox2i�lineOrderlineOrderpixelAspectRatiofloat�?screenWindowCenterv2fscreenWindowWidthfloat�?Y�u��~@ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ ��~@ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@��~@ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������`��~@ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

69
Assets/BasicRenderBatching/LightingBatchingProbe/ReflectionProbe-0.exr.meta


fileFormatVersion: 2
guid: 5e85d9fdddd5f59459945a8d96f79f0b
timeCreated: 1485275198
licenseType: Pro
TextureImporter:
fileIDToRecycleName:
8900000: generatedCubemap
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 1
seamlessCubemap: 1
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: 2
aniso: 0
mipBias: 0
wrapMode: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 100
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存