My HLSL Shader Parameters not showing in Ofusion? [FIXED]

Evak

02-07-2007 22:45:20

I'm able to make shaders work with ofusion, but I can't adjust the parameters from my HLSL shaders in ofusion. I get the following popup:



I've tried changing to other shaders and going back to mine again to refresh but it doesn't change. I thought I'd post a simple color shader made in ShaderFX and convertes to ogre. Maybe someone can tell me if they can see what I'm doing wrong.

.Program
vertex_program orange_vs hlsl
{
source orange.hlsl
entry_point v
target vs_2_0

default_params
{
param_named_auto lightPosition LIGHT_POSITION 0
param_named_auto wvp WORLDVIEWPROJ_MATRIX
param_named_auto worldI INVERSE_WORLD_MATRIX
}
}

fragment_program orange_ps hlsl
{
source orange.hlsl
entry_point f
target ps_2_0


default_params
{
param_named_auto lightColor LIGHT_DIFFUSE_COLOUR 0
param_named UIColor_8885 float4 .8, 0.3, 0.0, 1.0

}
}


.HLSL
// input from application
struct a2v {
float4 position : POSITION;


};

// output to fragment program
struct v2f {
float4 position : POSITION;


};

//Ambient and Self-Illum Pass Vertex Shader
v2f v(a2v In, uniform float4 lightPosition, uniform float4x4 wvp, uniform float4x4 worldI)
{
v2f Out = (v2f)0;
Out.position = mul(wvp, In.position); //transform vert position to homogeneous clip space
return Out;
}

//Ambient and Self-Illum Pass Pixel Shader
float4 f(v2f In, uniform float4 lightColor, uniform float4 UIColor_8885) : COLOR
{

float3 input1 = UIColor_8885;

float4 ret = float4(0,0,0,1);
ret = float4(input1, 1);
return ret;
}


The ofusion shader parameters editor is simply empty, I was hoping to have param_named UIColor_8885 float4 .8, 0.3, 0.0, 1.0 display as a editable parameter in ofusions shader editor.

Evak

03-07-2007 01:16:04

Decided to write a support ticket for this one.

Evak

03-07-2007 20:07:15

Ok, I changed the HLSL defines to CG but am still using the same HLSL pixel and vertex shaders. Now the shader parameter editor in ofusion works.

So it looks like there is no HLSL support for shader parameters in ofusion, and the editor only works with CG files, or its broken?

Lioric

03-07-2007 21:47:49

It seems this has been fixed (for your ticket)

I tested with your shader and it works correctly in HLSL

Evak

03-07-2007 22:08:11

Oooh! excellent news :). Look forward to getting the support ticket update on my page :)

Evak

09-07-2007 23:18:12

hmm, I still seem to be having a problem with this, I updated the support ticket.

I uninstalled the old version of ofusion, and installed the new one, but I'm still getting the same problem. I'm pretty sure that the new ofusion is installed correctly since the manual LOD part of the object UI is there.

Lioric

11-07-2007 00:23:39

All the HLSL issues has been fixed in your updated version

A suggestion, you might want to bind your samplers (the texture units used by the shader) to a register, this way the texture units will be in the correct order every time, there are some specific situations that the shader compiler optimizes some parameters and the texture unit order can change, resulting in using the diffuse texture as normal map and the normal map as diffuse in the shader



...
uniform sampler terrain_map : register(s0),
uniform sampler rock_map : register(s1),
uniform sampler grass_map : register(s2),
uniform sampler light_map : register(s3),
...



In this case the terrain will be the first texture unit of the pass, the rock the next, then grass and then the lightmap texture unit

Evak

11-07-2007 06:24:58

hey, thanks for the Tip, I can see how this might make things a little easier. Nice to finaly have these parameters editable too, was getting quite frustrated the last few days.