-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef CUSTOM_COMMON_INCLUDED | ||
#define CUSTOM_COMMON_INCLUDED | ||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" | ||
#include "UnityInput.hlsl" | ||
#define UNITY_MATRIX_M unity_ObjectToWorld | ||
#define UNITY_MATRIX_I_M unity_WorldToObject | ||
#define UNITY_MATRIX_V unity_MatrixV | ||
#define UNITY_MATRIX_VP unity_MatrixVP | ||
#define UNITY_MATRIX_P glstate_matrix_projection | ||
|
||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" | ||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl" | ||
|
||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef CUSTOM_UNITY_INPUT_INCLUDED | ||
#define CUSTOM_UNITY_INPUT_INCLUDED | ||
CBUFFER_START(UnityPerDraw) | ||
float4x4 unity_ObjectToWorld; | ||
float4x4 unity_WorldToObject; | ||
float4 unity_LODFade; | ||
real4 unity_WorldTransformParams; | ||
CBUFFER_END | ||
float4x4 unity_MatrixVP; | ||
float4x4 unity_MatrixV; | ||
float4x4 glstate_matrix_projection; | ||
|
||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using UnityEngine; | ||
|
||
public class MeshBall : MonoBehaviour | ||
{ | ||
static int baseColorId = Shader.PropertyToID("_BaseColor"); | ||
|
||
[SerializeField] | ||
Mesh mesh = default; | ||
|
||
[SerializeField] | ||
Material material = default; | ||
|
||
static MaterialPropertyBlock block; | ||
|
||
Matrix4x4[] matrices = new Matrix4x4[1023]; | ||
Vector4[] colors = new Vector4[1023]; | ||
private void Awake() | ||
{ | ||
for (int i = 0; i < matrices.Length; i++) | ||
{ | ||
matrices[i] = Matrix4x4.TRS(Random.insideUnitSphere * 10f, Quaternion.identity, Vector3.one); | ||
colors[i] = new Vector4(Random.value, Random.value, Random.value, 1); | ||
} | ||
} | ||
|
||
void Update() | ||
{ | ||
if (null == block) | ||
{ | ||
block = new MaterialPropertyBlock(); | ||
block.SetVectorArray(baseColorId, colors); | ||
} | ||
Graphics.DrawMeshInstanced(mesh, 0, material, matrices, 1023, block); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using UnityEngine; | ||
|
||
[DisallowMultipleComponent] | ||
public class PerObjectMaterialProperties : MonoBehaviour | ||
{ | ||
static int baseColorId = Shader.PropertyToID("_BaseColor"); | ||
[SerializeField] | ||
Color baseColor = Color.white; | ||
|
||
static MaterialPropertyBlock block; | ||
void Awake() | ||
{ | ||
OnValidate(); | ||
} | ||
private void OnValidate() | ||
{ | ||
if (null == block) | ||
{ | ||
block = new MaterialPropertyBlock(); | ||
} | ||
block.SetColor(baseColorId, baseColor); | ||
GetComponent<Renderer>().SetPropertyBlock(block); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!21 &2100000 | ||
Material: | ||
serializedVersion: 6 | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_Name: Unlit | ||
m_Shader: {fileID: 4800000, guid: fcd16ff2db67f9d41bf5ead2b2fef676, type: 3} | ||
m_ShaderKeywords: | ||
m_LightmapFlags: 4 | ||
m_EnableInstancingVariants: 1 | ||
m_DoubleSidedGI: 0 | ||
m_CustomRenderQueue: 3000 | ||
stringTagMap: {} | ||
disabledShaderPasses: [] | ||
m_SavedProperties: | ||
serializedVersion: 3 | ||
m_TexEnvs: | ||
- _BaseMap: | ||
m_Texture: {fileID: 2800000, guid: 429938808ed85064dbbb99ebfa6d369e, type: 3} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
m_Floats: | ||
- _DstBlend: 10 | ||
- _SrcBlend: 5 | ||
- _ZWrite: 0 | ||
m_Colors: | ||
- _BaseColor: {r: 0, g: 0.735849, b: 0.56452936, a: 0.9019608} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Shader "Custom RP/Unlit" | ||
{ | ||
Properties | ||
{ | ||
_BaseMap("Texture",2D) = "white" {} | ||
_BaseColor("Color",Color) = (1.0,1.0,1.0,1.0) | ||
_Cutoff("Cutoff",Range(0.0, 1.0)) = 0.2 | ||
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Src Blend", Float) = 1 | ||
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Dst Blend", Float) = 0 | ||
[Enum(Off, 0, On, 1)] _ZWrite("Z Write", Float) = 1 | ||
[Toggle(_CLIPPING)] _Clipping("Alpha Clipping", Float) = 0 | ||
} | ||
SubShader | ||
{ | ||
Tags { "RenderType"="Opaque" } | ||
LOD 100 | ||
|
||
Pass | ||
{ | ||
Blend[_SrcBlend][_DstBlend] | ||
ZWrite [_ZWrite] | ||
HLSLPROGRAM | ||
#pragma multi_compile_instancing | ||
#pragma shader_feature _CLIPPING | ||
#pragma vertex UnlitPassVertex | ||
#pragma fragment UnlitPassFragment | ||
#include "UnlitPass.hlsl" | ||
ENDHLSL | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!21 &2100000 | ||
Material: | ||
serializedVersion: 6 | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_Name: Unlit2 | ||
m_Shader: {fileID: 4800000, guid: fcd16ff2db67f9d41bf5ead2b2fef676, type: 3} | ||
m_ShaderKeywords: _CLIPPING | ||
m_LightmapFlags: 4 | ||
m_EnableInstancingVariants: 0 | ||
m_DoubleSidedGI: 0 | ||
m_CustomRenderQueue: 3000 | ||
stringTagMap: {} | ||
disabledShaderPasses: [] | ||
m_SavedProperties: | ||
serializedVersion: 3 | ||
m_TexEnvs: | ||
- _BaseMap: | ||
m_Texture: {fileID: 2800000, guid: 429938808ed85064dbbb99ebfa6d369e, type: 3} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _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: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _MainTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
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} | ||
m_Floats: | ||
- _BumpScale: 1 | ||
- _Clipping: 1 | ||
- _Cutoff: 0.2 | ||
- _DetailNormalMapScale: 1 | ||
- _DstBlend: 10 | ||
- _GlossMapScale: 1 | ||
- _Glossiness: 0.5 | ||
- _GlossyReflections: 1 | ||
- _Metallic: 0 | ||
- _Mode: 0 | ||
- _OcclusionStrength: 1 | ||
- _Parallax: 0.02 | ||
- _SmoothnessTextureChannel: 0 | ||
- _SpecularHighlights: 1 | ||
- _SrcBlend: 5 | ||
- _UVSec: 0 | ||
- _ZWrite: 0 | ||
m_Colors: | ||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} | ||
- _Color: {r: 1, g: 1, b: 1, a: 1} | ||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |