Monogame - Shader parameters missing

Posted by Layoric on Game Development See other posts from Game Development or by Layoric
Published on 2012-10-25T03:50:50Z Indexed on 2012/10/25 5:21 UTC
Read the original article Hit count: 439

Filed under:
|
|
|

I am currently working on a simple game that I am building in Windows 8 using MonoGame (develop3d). I am using some shader code from a tutorial (made by Charles Humphrey) and having an issue populating a 'texture' parameter.

I'm not well versed writing shaders, so this might be caused by a more obvious problem.

I have debugged through MonoGame's Content processor to see how this shader is being parsed, all the non 'texture' parameters are there and look to be loading correctly. Shader code below

#include "PPVertexShader.fxh"

float2 lightScreenPosition;

float4x4 matVP;

float2 halfPixel;

float SunSize;

texture flare;

sampler2D Scene: register(s0){
    AddressU = Clamp;
    AddressV = Clamp;
};

sampler Flare = sampler_state
{
    Texture = (flare);
    AddressU = CLAMP;
    AddressV = CLAMP;
};

float4 LightSourceMaskPS(float2 texCoord : TEXCOORD0 ) : COLOR0
{
    texCoord -= halfPixel;

    // Get the scene
    float4 col = 0;

    // Find the suns position in the world and map it to the screen space.
        float2 coord;

        float size = SunSize / 1;

        float2 center = lightScreenPosition;

        coord = .5 - (texCoord - center) / size * .5;
        col += (pow(tex2D(Flare,coord),2) * 1) * 2;                     


    return col * tex2D(Scene,texCoord); 
}

technique LightSourceMask
{
    pass p0
    {
        VertexShader = compile vs_4_0 VertexShaderFunction();
        PixelShader = compile ps_4_0 LightSourceMaskPS();
    }
}

I've removed default values as they are currently not support in MonoGame and also changed ps and vs to v4 instead of 2. Could this be causing the issue?

As I debug through 'DXConstantBufferData' constructor (from within the MonoGameContentProcessing project) I find that the 'flare' parameter does not exist. All others seem to be getting created fine.

Any help would be appreciated.

© Game Development or respective owner

Related posts about XNA

Related posts about shaders