From 745e7ece53942d6e66a5635a5c9e5f09ece1975e Mon Sep 17 00:00:00 2001 From: spatialfree Date: Sat, 9 Nov 2024 19:52:32 -0500 Subject: [PATCH] just color shader/mat --- Assets/justcolor.hlsl | 33 +++++++++++++++++++++++++++++++++ src/Arts.cs | 1 + 2 files changed, 34 insertions(+) create mode 100644 Assets/justcolor.hlsl diff --git a/Assets/justcolor.hlsl b/Assets/justcolor.hlsl new file mode 100644 index 0000000..e19cacb --- /dev/null +++ b/Assets/justcolor.hlsl @@ -0,0 +1,33 @@ +#include "stereokit.hlsli" + +//--name = dofdev/justcolor +//--color:color = 1, 1, 1, 1 + +float4 color; + +struct vsIn { + float4 pos : SV_Position; + float3 norm : NORMAL0; +}; +struct psIn { + float4 pos : SV_POSITION; + float4 color : COLOR0; + uint view_id : SV_RenderTargetArrayIndex; +}; + +psIn vs(vsIn input, uint id : SV_InstanceID) { + psIn o; + o.view_id = id % sk_view_count; + id = id / sk_view_count; + + float3 world = mul(float4(input.pos.xyz, 1), sk_inst[id].world).xyz; + o.pos = mul(float4(world, 1), sk_viewproj[o.view_id]); + + float3 normal = normalize(mul(input.norm, (float3x3)sk_inst[id].world)); + + o.color = color * sk_inst[id].color; + return o; +} +float4 ps(psIn input) : SV_TARGET { + return input.color; +} \ No newline at end of file diff --git a/src/Arts.cs b/src/Arts.cs index 9ecff14..05ced94 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -10,6 +10,7 @@ static class Arts static Material mat_mono = new Material("mono.hlsl"); static Material mat_unlit = new Material("unlit.hlsl"); static Material mat_backbox = new Material("backbox.hlsl"); + static Material mat_justcolor = new Material("justcolor.hlsl"); static Quat food_ori = Quat.Identity;