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

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

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 OUT = (pOut)0;
OUT.color = IN.color;
return OUT;
}

technique t
{
pass p0
{
}
}


(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 on other sites
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 on other sites
I see, thanks. I seem to have missed that somehow.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 17
• 10
• 14
• 10
• Forum Statistics

• Total Topics
632660
• Total Posts
3007696
• Who's Online (See full list)

There are no registered users currently online

×