Problem with Ogre 1.10.10 and param_named_auto Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
Pellaeon
Halfling
Posts: 77
Joined: Thu Apr 28, 2011 12:23 pm

Problem with Ogre 1.10.10 and param_named_auto

Post by Pellaeon » Mon Feb 05, 2018 9:22 am

Hi,

we migrated from Ogre 1.9 (or 1.10.0) to 1.10.10. I have a material script which worked fine before, but with the new version I get an error for the following material definition:

Code: Select all

fragment_program PlainTexture_PS hlsl            
{
    source 		FlowMat.hlsl
	target 		ps_2_0
    entry_point mainFS
	
	default_params
	{
		param_named_auto lightPos light_position 0
		
		param_named energyColor float4 1.0 1.0 1.0 1.0
		
		param_named texFactor float 1.0
	}
}
The log says:

Code: Select all

08:59:07: Compiler error: invalid parameters in FlowMat.material(26): Parameter called lightPos does not exist. Known names are: energyColor energyColor[0] texFactor texFactor[0] 
I am confused because the material worked fine all the time. Are there some changes in the newer ogre 1.10 version which makes my "old" material obsolete?

Best regards

Pellaeon
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 567
Joined: Sun Mar 30, 2014 2:51 pm
x 81
Contact:

Re: Problem with Ogre 1.10.10 and param_named_auto

Post by paroj » Mon Feb 05, 2018 1:42 pm

the error means that there is no parameter 'lightPos' in 'mainFS' of 'FlowMat.hlsl'.
0 x

Pellaeon
Halfling
Posts: 77
Joined: Thu Apr 28, 2011 12:23 pm

Re: Problem with Ogre 1.10.10 and param_named_auto

Post by Pellaeon » Tue Feb 06, 2018 8:18 am

paroj wrote:
Mon Feb 05, 2018 1:42 pm
the error means that there is no parameter 'lightPos' in 'mainFS' of 'FlowMat.hlsl'.
I know. But there is! As I stated out: it worked before and nothing was changed.
0 x

Pellaeon
Halfling
Posts: 77
Joined: Thu Apr 28, 2011 12:23 pm

Re: Problem with Ogre 1.10.10 and param_named_auto

Post by Pellaeon » Tue Feb 06, 2018 9:10 am

This is the corresponding fragment shader. As you can see 'lightPos' is defined

Code: Select all

////////////////////////////////////////////////////////////
// fragment shader
////////////////////////////////////////////////////////////

sampler Tex0: register(s0);
 
float4 mainFS
(
	float4 texCoord0 : TEXCOORD0,
	float3 worldpos  : TEXCOORD1,
	float3 normal    : TEXCOORD2,
	
	uniform float4 	 lightPos,
	uniform float4 	 energyColor,
	uniform float 	 texFactor
): COLOR0
{
	//float3 lightDir = normalize(lightPos - worldpos);	
	//float dotNL 	= dot(normal, lightDir);	
	float dotNL = 1.0;
	
	float4 baseColor = (energyColor * tex2D(Tex0, texFactor * texCoord0));
	
	return 0.2 * dotNL * baseColor + 0.8 * baseColor;	
	
	//return dotNL * (energyColor * tex2D(Tex0, texCoord0));	
}
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 567
Joined: Sun Mar 30, 2014 2:51 pm
x 81
Contact:

Re: Problem with Ogre 1.10.10 and param_named_auto

Post by paroj » Tue Feb 06, 2018 12:21 pm

some drivers do unused shader parameter elimination for optimization. This seems to be the case for you.

You can either ignore that error or drop that unused param from your material script as well.
0 x

Post Reply