FX file not loading:

Started by
1 comment, last by CodeReaver 16 years, 5 months ago
I've been using fx files with my models, but I decided to add a few more variables and now it won't load. I'm not using any shaders or HLSL, I just want to change a few render states. I think it's probably the variable names I've chosen, although I don't know what the correct ones would be. Most reference information just shows how to use shaders and the rest just recomends using FX composer, but it crashes because of some "Plugin Creation Error". I think that's to do with my driver or graphics gard being too old. Anyway, here's the effect file that works:

texture texture0;
float4 diffuse0;

technique ModelExObject
{
	pass p0
	{
		Texture[0] = <texture0>;
		MaterialDiffuse = <diffuse0>;
		Lighting = TRUE;
		ColorVertex = FALSE;
		CullMode = NONE;
		ZEnable = TRUE;
		ZWriteEnable = TRUE;
		DitherEnable = TRUE;
		SpecularEnable = FALSE;
		NormalizeNormals = TRUE;
		AlphaTestEnable = TRUE;
		AlphaFunc = GREATER;
		AlphaRef = 0xA0;
		ColorOp[0] = MODULATE;
		ColorArg1[0] = TEXTURE;
		ColorArg2[0] = CURRENT;
		AlphaOp[0] = MODULATE;
		AlphaArg1[0] = TEXTURE;
		AlphaArg2[0] = DIFFUSE;
		MagFilter[0] = LINEAR;
		MinFilter[0] = LINEAR;
		AmbientMaterialSource = MATERIAL;
		DiffuseMaterialSource = MATERIAL;
	}
}

And here's the one that doesn't:

texture xTexture0;
float4 xDiffuse;
integer xLighting;
integer xColorVertex;
integer xColorOp;
integer xAmbientMaterialSource;
integer xDiffuseMaterialSource;

technique ModelExDefault
{
	pass p0
	{
		Texture[0] = <xTexture0>;
		MaterialDiffuse = <xDiffuse>;
		Lighting = <xLighting>;
		ColorVertex = <xColorVertex>;
		CullMode = NONE;
		ZEnable = TRUE;
		ZWriteEnable = TRUE;
		DitherEnable = TRUE;
		SpecularEnable = FALSE;
		NormalizeNormals = TRUE;
		AlphaTestEnable = TRUE;
		AlphaFunc = GREATER;
		AlphaRef = 0xA0;
		ColorOp[0] = <xColorOp>;
		ColorArg1[0] = TEXTURE;
		ColorArg2[0] = CURRENT;
		AlphaOp[0] = MODULATE;
		AlphaArg1[0] = TEXTURE;
		AlphaArg2[0] = DIFFUSE;
		MagFilter[0] = LINEAR;
		MinFilter[0] = LINEAR;
		AmbientMaterialSource = <xAmbientMaterialSource>;
		DiffuseMaterialSource = <xDiffuseMaterialSource>;
	}
}

Advertisement
Run fxc.exe against the one that doesn't - it's the command line compiler and it should give you error messages explaining why it doesn't work.

To be honest, it's very hard to do static code analysis for this sort of thing! We really could do with some error numbers/messages [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Typical... I found out what was going wrong soon after I posted this. I was using the wrong data types. I must have been thinking of EffectDefaultType that only has floats, integers and strings. I think I saw that program in Utilities/Bin/x86 but there wasn't anything to say what it was.

BTW, do you know where I could find any info on getting my effect to be SAS complient?

This topic is closed to new replies.

Advertisement