From 133d8cf5998dec24dee4eb156b0299785c620c48 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 22 Dec 2019 06:14:56 +0100 Subject: [PATCH] examples: Fix plasma UV and support for float4 --- data/examples/shaders/source/plasma.effect | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/examples/shaders/source/plasma.effect b/data/examples/shaders/source/plasma.effect index 37a0376c..02e92f37 100644 --- a/data/examples/shaders/source/plasma.effect +++ b/data/examples/shaders/source/plasma.effect @@ -74,7 +74,8 @@ struct StageData { }; StageData VSDefault(StageData data) { - data.pos = mul(float4(data.pos.xyz, 1.0), ViewProj); + data.pos = mul(float4(data.pos.xyz, 1.0), ViewProj); + data.uv += 0.5; data.uv *= PlasmaUVScale; return data; } @@ -134,9 +135,9 @@ float4 ColoredPlasma(StageData data) : TARGET { float v1 = clamp(v * 2.0, 0., 1.); float v2 = clamp((v - 0.5) * 2.0, 0., 1.); - float3 col = lerp(lerp(PlasmaLowColor, PlasmaMiddleColor, v1), PlasmaHighColor, v2); + float4 col = lerp(lerp(PlasmaLowColor, PlasmaMiddleColor, v1), PlasmaHighColor, v2); - return float4(col, 1.0); + return clamp(col, 0., 1.); } technique Colored