Arbitrary Colors

This commit is contained in:
2021-02-01 09:25:22 +08:00
parent 9e6b1592ef
commit dd11842558
4 changed files with 82 additions and 34 deletions

View File

@@ -2,6 +2,21 @@
StructuredBuffer<float3x4> _Matrices;
#endif
float4 _ColorA, _ColorB;
float2 _SequenceNumbers;
float4 GetFractalColor () {
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
return lerp(
_ColorA, _ColorB,
frac(unity_InstanceID * _SequenceNumbers.x + _SequenceNumbers.y)
);
#else
return _ColorA;
#endif
}
void ConfigureProcedural () {
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
float3x4 m = _Matrices[unity_InstanceID];
@@ -12,10 +27,12 @@ void ConfigureProcedural () {
#endif
}
void ShaderGraphFunction_float (float3 In, out float3 Out) {
void ShaderGraphFunction_float (float3 In, out float3 Out, out float4 FractalColor) {
Out = In;
FractalColor = GetFractalColor();
}
void ShaderGraphFunction_half (half3 In, out half3 Out) {
void ShaderGraphFunction_half (half3 In, out half3 Out, out half4 FractalColor) {
Out = In;
FractalColor = GetFractalColor();
}