Jump to content
  • Advertisement
Sign in to follow this  
SeraphLance

[HLSL] Getting an effect to show in DXViewer (solved)

This topic is 3828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Recently I've started learning HLSL, and after numerous problems with FX Composer and what I'm assuming is due to a heavy reliance on Collada, I've decided to try to find another tool for viewing shaders. I tried XSI, but it's still a bit buggy in that regard (so is FX Composer, but that's another story). Hearing about EffectEdit, a ran a search, and discovered it had been replaced by DXViewer, so I downloaded the June SDK. However, I can't get any of my shaders to render. The output told me fairly quickly that I was missing a global parameter, so I read the docs to figure out how to do it, and after using that, the effect "loads" properly, but still doesn't render. The effect renders properly in FX Composer 2.5 (without the global parameter semantic, which it doesn't recognize) and XSI Mod Tool (with or without the semantic), and a similar shader (one that doesn't render in DXViewer) works in XNA, so I'm at a loss as to what's wrong. I thought it might be some nuance of SAS, but I haven't found anything relevant in the documentation. I've included the simple shader for reference here:

int glob : SasGlobal
<
	int3 SasVersion = {1,0,0};
>;

struct vIn
{
	float4 pos : POSITION;
	float4 color : COLOR;
};

struct vOut
{
	float4 pos : POSITION;
	float4 color : COLOR;
};

struct pOut
{
	float4 color : COLOR;
};	


float4 green = float4(0.0,1.0,0.0,1.0);
float4 red = float4(1.0,0.0,0.0,1.0);
float4 blue = float4(0.0,0.0,1.0,1.0);

float4x4 WorldViewProj : WORLDVIEWPROJECTION;

vOut vShader(vIn IN, uniform float4 vcol)
{
	vOut OUT = (vOut)0;
	OUT.pos = mul(IN.pos, WorldViewProj);
	OUT.color = vcol;
	return OUT;
}

pOut pShader(vOut IN) : COLOR
{
	pOut OUT = (pOut)0;
	OUT.color = IN.color;
	return OUT;
}

technique t
{
	pass p0
	{
		VertexShader = compile vs_3_0 vShader(red);
		PixelShader = compile ps_3_0 pShader();
	}
}



(there's a bit of useless code that could be omitted, but I opted for a as-is pasting, for obvious reasons.) The shader is about as trivial as it gets (constant). Does anyone know a reason why this might not run in DXViewer? [Edited by - SeraphLance on June 20, 2008 11:49:03 AM]

Share this post


Link to post
Share on other sites
Advertisement
Did you use all of the SaS data binding stuff for your vars?

it looks like you need to make

float4x4 WorldViewProj : WORLDVIEWPROJECTION;

sas compliant





//--------------------------------------------------------------------------------------
// Variables
//--------------------------------------------------------------------------------------
SasAmbientLight AmbientLight <string SasBindAddress = "Sas.AmbientLight[0]";>;
SasDirectionalLight DirectionalLight <string SasBindAddress = "Sas.DirectionalLight[0]";>;

float4x4 World <string SasBindAddress = "Sas.Skeleton.MeshToJointToWorld[0]";>;
float4x4 View <string SasBindAddress = "Sas.Camera.WorldToView";>;
float4x4 Projection <string SasBindAddress = "Sas.Camera.Projection";>;


float4 MaterialDiffuse <string SasBindAddress = "Microsoft.Material.Diffuse";>;
float4 MaterialAmbient <string SasBindAddress = "Microsoft.Material.Ambient";>;
float4 MaterialEmissive <string SasBindAddress = "Microsoft.Material.Emissive";>;
texture MaterialTexture <string SasBindAddress = "Microsoft.Material.Texture";>;
bool IsMaterialTextured <string SasBindAddress = "Microsoft.Material.IsTextured";>;




Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!