浏览代码

now fastbatch shader use fixed bind slot 0, and UnityPerDraw too (changed in UnityShaderVariables.cginc )

/batch_rendering
Arnaud Carré arnaud@unity3d.com 8 年前
当前提交
2913ae51
共有 6 个文件被更改,包括 27 次插入29 次删除
  1. 6
      Assets/BasicRenderBatching/BasicBatching.unity
  2. 27
      Assets/BasicRenderBatching/BasicRenderBatchingShader.shader
  3. 2
      Assets/BasicRenderBatching/Scripts/PopulateScene.cs
  4. 10
      ProjectSettings/ProjectSettings.asset
  5. 2
      ProjectSettings/QualitySettings.asset
  6. 9
      Assets/TestScenes/HDTest/LayeredLitTest/Mesh/Materials.meta

6
Assets/BasicRenderBatching/BasicBatching.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.12731749, g: 0.13414757, b: 0.1210787, a: 1}
m_IndirectSpecularColor: {r: 0.12731704, g: 0.13414727, b: 0.121078536, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

type: 2}
m_CenterPoint: {fileID: 970523335}
m_Material: {fileID: 2100000, guid: 4c676c131a81b634988506c3023ea7a5, type: 2}
m_GridWidth: 32
m_GridWidth: 64
m_Spacing: 0.4
--- !u!114 &870320119
MonoBehaviour:

m_GameObject: {fileID: 870320112}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dd3f3fa5c40a66f44a9444b42845b28f, type: 3}
m_Name:

27
Assets/BasicRenderBatching/BasicRenderBatchingShader.shader


// but the inspector UI expects all these to exist.
Properties
{
_Color("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
// _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 { "LightMode" = "BasicPass" }
// Use same blending / depth states as Standard shader
Blend[_SrcBlend][_DstBlend]
ZWrite[_ZWrite]
Blend One Zero
ZWrite On
#pragma shader_feature _METALLICGLOSSMAP
#include "UnityCG.cginc"
//#pragma shader_feature _METALLICGLOSSMAP
//#include "UnityCG.cginc"
#include "HLSLSupport.cginc"
float4 _Color;

// Global ambient/SH probe, similar to unity_SH* built-in variables.
float4 globalSH[7];
CBUFFER_END
CBUFFER_START(FastBatch_PerObjectData : register(b0) )
float4 myColor;
CBUFFER_END
/*
CBUFFER_START(UnityPerDraw) // 352 bytes, uploaded per object (even if just position change position )

{
i.normalWS = normalize(i.normalWS);
float4 color;
color.rgb = EvaluateOneLight(0, i.positionWS, i.normalWS, _Color.rgb);
color = half4(EvaluateOneLight(0, i.positionWS, i.normalWS, myColor.rgb),1);
return color;
}

2
Assets/BasicRenderBatching/Scripts/PopulateScene.cs


Renderer renderer = m_Objects[iIndex].GetComponent<Renderer>();
Material mat = Instantiate(m_Material);
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
mat.color = oColor;
mat.SetColor("myColor", oColor);
renderer.material = mat;
}
iIndex++;

10
ProjectSettings/ProjectSettings.asset


androidShowActivityIndicatorOnLoading: -1
tizenShowActivityIndicatorOnLoading: -1
iosAppInBackgroundBehavior: 0
displayResolutionDialog: 2
displayResolutionDialog: 1
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1

wiiUAllowScreenCapture: 1
wiiUControllerCount: 0
m_SupportedAspectRatios:
4:3: 1
5:4: 1
16:10: 1
4:3: 0
5:4: 0
16:10: 0
Others: 1
Others: 0
bundleIdentifier: com.Company.ProductName
bundleVersion: 1.0
preloadedAssets: []

2
ProjectSettings/QualitySettings.asset


softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
vSyncCount: 0
lodBias: 2
maximumLODLevel: 0
particleRaycastBudget: 4096

9
Assets/TestScenes/HDTest/LayeredLitTest/Mesh/Materials.meta


fileFormatVersion: 2
guid: 23b9d3adb0194ef43b3808e102e01e26
folderAsset: yes
timeCreated: 1481125188
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存