[SOLVED] Opendungeons : RTShader System generates wrong shaders

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
paul424
Goblin
Posts: 214
Joined: Thu May 24, 2012 7:16 pm
x 4

[SOLVED] Opendungeons : RTShader System generates wrong shaders

Post by paul424 »

system: OpenSuse 15.1 x64
ogreversion : Ogre 12 2 0
graphic : nvidia 750gtx, NVIDIA Driver Version: 435.21
shaders: RTShader System

As in topic,

After upgrade for Opendungeons : https://github.com/tomluchowski/OpenDun ... ode-polish , and running game I keep getting shader errors :
High-level program 'ac67f8fa97b37639bf05ec5ffa16a68d_VS' is not supported: 'ac67f8fa97b37639bf05ec5ffa16a68d_VS' 0(58) : error C1035: assignment of incompatible types

Here's generated, aforementionded shader :

Code: Select all

#version 460
#define texture1D texture
#define texture2D texture
#define shadow2DProj textureProj
#define texture3D texture
#define textureCube texture
#define texture2DLod textureLod
//-----------------------------------------------------------------------------
// Program Type: Vertex shader
// Language: glsl
// Created by Ogre RT Shader Generator. All rights reserved.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//                         FORWARD DECLARATIONS
//-----------------------------------------------------------------------------
void FFP_Transform(in mat3, in vec3, out vec3);
void FFP_Transform(in mat4, in vec4, out vec3);
void FFP_Transform(in mat4, in vec4, out vec4);

//-----------------------------------------------------------------------------
//                         GLOBAL PARAMETERS
//-----------------------------------------------------------------------------

uniform	mat4	worldviewproj_matrix;
uniform	vec3	camera_position;
uniform	mat4	world_matrix;
uniform	mat3	inv_world_rotation_matrix0;
uniform	vec4	light_position;
uniform	mat3	inv_world_rotation_matrix1;

//-----------------------------------------------------------------------------
// Function Name: main
// Function Desc: Vertex Program Entry point
//-----------------------------------------------------------------------------
in	vec4	vertex;
in	vec3	normal;
in	vec4	uv0;
out	vec2	iTexcoord2_0;
out	vec3	iTexcoord3_1;
out	vec4	iTexcoord4_2;
void main(void) {
	vec4	lLocalParam_0;
	vec4	lLocalParam_1;
	vec3	lNormalMapTempDir;
	vec3	lLocalParam_3;

	FFP_Transform(worldviewproj_matrix, vertex, gl_Position);
	lLocalParam_0	=	vec4(1.00000,1.00000,1.00000,1.00000);
	lLocalParam_1	=	vec4(0.00000,0.00000,0.00000,0.00000);
	iTexcoord2_0	=	uv0.xy;
	FFP_Transform(world_matrix, vertex, lLocalParam_3);
	lNormalMapTempDir	=	camera_position.xyz-lLocalParam_3.xyz;
	FFP_Transform(inv_world_rotation_matrix1, lNormalMapTempDir, lNormalMapTempDir);
	iTexcoord3_1	=	lNormalMapTempDir;
	lNormalMapTempDir	=	light_position.xyz-lLocalParam_3;
	FFP_Transform(inv_world_rotation_matrix1, lNormalMapTempDir, lNormalMapTempDir);
	iTexcoord4_2	=	lNormalMapTempDir;
}
How such a noob as I fix that ?
Last edited by paul424 on Wed Feb 05, 2020 1:52 pm, edited 1 time in total.

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

Re: Opendungeons : RTShader System generates wrong shaders

Post by paroj »

this was fixed in master recently. You either have to update the RTSS to read like this (GCT_FLOAT3):
https://github.com/OGRECave/ogre/blob/m ... #L266-L278

or change

Code: Select all

lighting_stage normal_map ... object_space ...
to

Code: Select all

lighting_stage normal_map ... tangent_space ...
in your material files

paul424
Goblin
Posts: 214
Joined: Thu May 24, 2012 7:16 pm
x 4

Re: Opendungeons : RTShader System generates wrong shaders

Post by paul424 »

Thanks , very much , I tried the second solution, however I have to have nuke the current ~/materials/RTShaderLib/ and cp /usr/share/OGRE/Media/RTShaderLib to OD folder ... Is this a standard procedure for games like opendungeons, forgive my lame questions , but I am total noob when it comes to shaders ... . From logs I deduce there were RTShaders for ogre 1 9 0 ...

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

Re: Opendungeons : RTShader System generates wrong shaders

Post by paroj »

paul424 wrote:
Wed Feb 05, 2020 12:13 pm
Thanks , very much , I tried the second solution, however I have to have nuke the current ~/materials/RTShaderLib/ and cp /usr/share/OGRE/Media/RTShaderLib to OD folder ... Is this a standard procedure for games like opendungeons,
yes

paul424
Goblin
Posts: 214
Joined: Thu May 24, 2012 7:16 pm
x 4

Re: [SOLVED] Opendungeons : RTShader System generates wrong shaders

Post by paul424 »

I got lost ;
https://github.com/OpenDungeons/OpenDungeons

you write : " use upstream RTShaderLib with Ogre 1.12+" I don't know how to use your patch, when I apply what I have on top of it I get
1) OD hangs on 'quit' button
2) The game models has the same / almost the same shading
so can you rewrite your patch so it works with what there is after the dust have fallen from several of my pull requests merging ?
please please please :D

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

Re: [SOLVED] Opendungeons : RTShader System generates wrong shaders

Post by paroj »

you should try that branch as is without merging it. If you have access to snapd, you can just take that version: https://snapcraft.io/opendungeons

It basically boils down to reverting this commit: https://github.com/OpenDungeons/OpenDun ... 92487d2b04
That one changes the shading, regardless of the ogre version.

I also cherry-picked some of your commits to this branch: https://github.com/paroj/OpenDungeons/commits/snapcraft
you can test-drive it using the edge channel on snapcraft

paul424
Goblin
Posts: 214
Joined: Thu May 24, 2012 7:16 pm
x 4

Re: [SOLVED] Opendungeons : RTShader System generates wrong shaders

Post by paul424 »

Hmm seems the snap version does not contain 'ogre.cfg' , that way the game starts with the smallest resolution in the smallest window ...

and

Code: Select all

cp: cannot create regular file '/snap/opendungeons/27/usr/share/games/opendungeons/config/ogre.cfg': Read-only file system
and to completly discredit myself : FROM where I should copy over the RTShader directory when applying your patch ? ( yes me so stupdio ... )
EDIT: Can you also apply / cherry-pick "Multiple tile types for the same neighbourhood " commit to the snap branch so the other people can use it :) ?
EDIT2 : If it's too ugly don't bother anyway ....

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

Re: [SOLVED] Opendungeons : RTShader System generates wrong shaders

Post by paroj »

paul424 wrote:
Fri Mar 27, 2020 9:18 am
Hmm seems the snap version does not contain 'ogre.cfg' , that way the game starts with the smallest resolution in the smallest window ...
I think OD is responsible for ensuring sane default values. You can copy your current config though to:
~/snap/opendungeons/current/.config/opendungeons/
paul424 wrote:
Fri Mar 27, 2020 9:18 am
and to completly discredit myself : FROM where I should copy over the RTShader directory when applying your patch ? ( yes me so stupdio ... )
will continue at github

paul424
Goblin
Posts: 214
Joined: Thu May 24, 2012 7:16 pm
x 4

Re: [SOLVED] Opendungeons : RTShader System generates wrong shaders

Post by paul424 »

Yeah, the snap installment lacks the config.cfg file, after placing it, it is much better....

Post Reply