Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

TextureFX Update 2.0 #575

Open
wants to merge 4 commits into
base: preview/2021.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,11 @@ shader ShaderUtils
float y = cos(a) * pt.y - sin(a) * pt.x;
return float2(x,y);
}

// TRANSFORM 2D ==============================================================

float2 TransformUV(float2 uv, float4x4 transform)
{
return mul(float4((uv.xy * 2 - 1) * float2(1, -1) * 0.5, 0, 1), transform).xy * float2(1, -1) + 0.5;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
[Tags("chessboard")]
shader Checkerboard_TextureFX : TextureFX
{
int2 CellCount = int2(8, 8);
[Default(8.0f, 8.0f)]
compose ComputeFloat2 CellCount;

[Color]
float4 Black = float4(0, 0, 0, 1);
[Color]
float4 White = float4(1, 1, 1, 1);

float4x4 Transform;

stage override float4 Shading()
{
//compute size
float2 stepHV = 1 / float2(CellCount.x, CellCount.y);
float2 uv = streams.TexCoord;
float2 cellCount = CellCount.Compute();
float2 stepHV = 1 / float2(cellCount.x, cellCount.y);
float2 uv = TransformUV(streams.TexCoord, Transform);

//compute black|white
float2 cHV = abs(uv) / stepHV;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// <auto-generated>
// Do not edit this file yourself!
//
// This code was generated by Stride Shader Mixin Code Generator.
// To generate it yourself, please install Stride.VisualStudio.Package .vsix
// and re-save the associated .sdfx.
// </auto-generated>

using System;
using Stride.Core;
using Stride.Rendering;
using Stride.Graphics;
using Stride.Shaders;
using Stride.Core.Mathematics;
using Buffer = Stride.Graphics.Buffer;

namespace Stride.Rendering
{
public static partial class Checkerboard_TextureFXKeys
{
public static readonly ValueParameterKey<Color4> Black = ParameterKeys.NewValue<Color4>(new Color4(0,0,0,1));
public static readonly ValueParameterKey<Color4> White = ParameterKeys.NewValue<Color4>(new Color4(1,1,1,1));
public static readonly ValueParameterKey<Matrix> Transform = ParameterKeys.NewValue<Matrix>();
}
}