I’m trying to implement projected texturing by editing the standard SpriteEffect.fx using this tutorial - Quadrilateral Interpolation, Part 1 – Nathan Reed’s coding blog
But when I try and build the effect (or for that matter if I just copy and paste the contents of SpriteEffect.fx in there without editing so doesn’t seem to be something I’ve done) it fails to build. But I don’t see any information in MGCB about why it failed. Am I missing something? Also why wouldn’t the plain SpriteEffect.fx compile through the content builder?
Current attempt
#if OPENGL #define SV_POSITION POSITION #define VS_SHADERMODEL vs_3_0 #define PS_SHADERMODEL ps_3_0 #else #define VS_SHADERMODEL vs_4_0_level_9_1 #define PS_SHADERMODEL ps_4_0_level_9_1 #endif
#include "Macros.fxh"
DECLARE_TEXTURE(Texture, 0);
BEGIN_CONSTANTS MATRIX_CONSTANTS
float4x4 MatrixTransform _vs(c0) _cb(c0);
END_CONSTANTS
struct VSOutput { float4 position : SV_Position; float4 color : COLOR0; float3 texCoord : TEXCOORD0; };
VSOutput SpriteVertexShader( float4 position : POSITION0, float4 color : COLOR0, float3 texCoord : TEXCOORD0) { VSOutput output; output.position = mul(position, MatrixTransform); output.color = color; output.texCoord = texCoord; return output; }
float4 SpritePixelShader(VSOutput input) : SV_Target0 { return SAMPLE_TEXTURE(Texture, input.texCoord.xy / input.texCoord.z) * input.color; }
TECHNIQUE( SpriteBatch, SpriteVertexShader, SpritePixelShader );