RT Shader System Component (RTSS)

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
jj
Halfling
Posts: 50
Joined: Thu Apr 03, 2008 1:33 am

Re: RT Shader System Component (RTSS)

Post by jj »

Hi there,

I have integrated Ogre 1.7RC1 + RT Shadery System (which is awesome!) into my own project. I am using the RTSS/PerPixel_SinglePass material, and it works great with Stencil SHADOWTYPE_STENCIL_MODULATIVE, but it renders material completely black with SHADOWTYPE_STENCIL_ADDITIVE.

The code I use to init the system:

Code: Select all

	if (Ogre::RTShader::ShaderGenerator::initialize())
	{
		// Grab the shader generator pointer.
		mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();

		// Set the scene manager.
		mShaderGenerator->addSceneManager(ogreSceneManager);
		
		// Add the shader libs resource location.
		Ogre::ResourceGroupManager& rgm = Ogre::ResourceGroupManager::getSingleton();

		String shaderLibPath = cingDataFolder + "RTShaderLib";
		rgm.createResourceGroup("RTShaderSystem", false);
		rgm.addResourceLocation(shaderLibPath + "/materials", "FileSystem", "RTShaderSystem");
		rgm.initialiseResourceGroup("RTShaderSystem");
		rgm.loadResourceGroup( "RTShaderSystem", true );

		// Set shader cache path.
		mShaderGenerator->setShaderCachePath(shaderCachePath);		

		// Make this viewport work with shader generator scheme.
		Window& window = GraphicsManager::getSingleton().getMainWindow();
		window.getViewport(0)->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
	}
The code I use to set the material

Code: Select all

	cube.init( "Prefab_Sphere" );
	cube.setMaterial( "RTSS/PerPixel_SinglePass" );
	cube.getEntity()->setCastShadows(true);
Any ideas?

Thanks!
User avatar
XenoPhoenix
Gnoblar
Posts: 14
Joined: Mon Feb 08, 2010 1:40 am

Re: RT Shader System Component (RTSS)

Post by XenoPhoenix »

Yeah I thought my script was alright :/ unfortunately I'm currently running in an unpriveledged environment and I need root to install NVperfHUD, I might see if i can set up another machine to sort out this crashing issue with many lights :/
User avatar
Nir Hasson
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 363
Joined: Wed Nov 05, 2008 4:40 pm
Location: TLV - Israel
x 2
Contact:

Re: RT Shader System Component (RTSS)

Post by Nir Hasson »

@jj -
When you work with addative lighting techniques you should use multipass material.
I guess the fact the you used the single pass material caused that problem.
Use the normal map multi pass material - It should solve the problem. If you'd like to use only per pixel, use the multipass as reference and split your material technique into 3 passes required by
addative lighting approach.
jj
Halfling
Posts: 50
Joined: Thu Apr 03, 2008 1:33 am

Re: RT Shader System Component (RTSS)

Post by jj »

it makes sense. I will use the normal map material then (and will post back if still does not fix the problem, but I assume so)...

thanks!
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: RT Shader System Component (RTSS)

Post by masterfalcon »

Does anyone else see behavior like this? I've seen it on several versions of Mac OS X 10.6 on the NVIDIA 9600. Only occurs with GLSL shaders.
http://public.me.com/ix/davidrogers/ShaderSystem.m4v
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: RT Shader System Component (RTSS)

Post by Assaf Raman »

Disco!
Watch out for my OGRE related tweets here.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Re: RT Shader System Component (RTSS)

Post by sinbad »

Wow. I don't get this on my 9800 (WinXP), I suspect that it's something specific to the OS X glsl driver. Do you get any interesting messages in the log when it compiles the glsl?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100
Contact:

Re: RT Shader System Component (RTSS)

Post by Wolfmanfx »

Is it a MBP with dual gpu 9400/9600? Whats the result of the 9400 GPU?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: RT Shader System Component (RTSS)

Post by masterfalcon »

Nope, nothing in the log. I would not be surprised at all if it does end up being a driver issue. I'll try it with the 9400 in a little bit.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: RT Shader System Component (RTSS)

Post by masterfalcon »

Just checked here. Happens on this machine with either GPU. :(
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: RT Shader System Component (RTSS)

Post by Klaim »

I've seen something similar one day, when the gpu of my laptop fried. (not totally but enough to make the system instable)

But if you don't smell anything it's probably something else. :)
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: RT Shader System Component (RTSS)

Post by Assaf Raman »

An uninitialized shader parameter? Does it happen also in debug config?
Watch out for my OGRE related tweets here.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: RT Shader System Component (RTSS)

Post by masterfalcon »

I haven't seen any odd GPU behavior except in that demo.

It happens in both release and debug. :(

I might do some OS regression tonight. See if it was introduced in 10.6.1 or 10.6.2, I don't recall always seeing this.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: RT Shader System Component (RTSS)

Post by al2950 »

NASTY BUG FOUND, i think!

If you have two meshes (or more) with the SAME material (using RTSS) it produces some very odd effects. I have tested with normal maps and PSSM shadows, and they both exibit odd behaviour. I first saw it my own meshes, but to be sure i tested it with athene.

This bug effects different objects in different ways (some very subtle) but the following method gives the most obvious bad behaviour;

1) setup up a scene with a directional light ( i used caelum for my test)
2) load in two athene models (one above the other)
3) set the material of both entities to something like below (Make sure RTSS is enabled!)
4) Rotate (yaw) one of the models at about 100 Degrees/second.
5) You should then notice that the model not moving will pulsate in time with the other model rotating

test Material file

Code: Select all

material testOddBug
{
	technique
	{
		pass
		{
			texture_unit 
			{
				texture diffuse.dds
			}
			
			rtshader_system
			{
				lighting_stage normal_map normalMap.dds tangent_space 0
			}
		}

	}
}

I can have a few guess why this happens but i have no idea how to fix it. Can someone please try this simple test.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: RT Shader System Component (RTSS)

Post by al2950 »

I have done a bit more testing into the bug a reported in my last post, Per_Pixel lighting seems to work fine, but both Normal map lighting and PSSM shadows do not.

It almost as if the different entities inherit various values from the entity that is rendered first with that material. So it depends in what order they are in the scene graph as to which ones exhibit the wrong behavior. I have created a you tube video to show the problem; (My first youtube video :) )

http://www.youtube.com/watch?v=N4UfvUYYtzA

I have started to go through the RTSS code, but before i start tearing my hair out can someone confirm this is a bug!!

*EDIT* I have tested with directional lights and point lights, same problem
User avatar
Nir Hasson
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 363
Joined: Wed Nov 05, 2008 4:40 pm
Location: TLV - Israel
x 2
Contact:

Re: RT Shader System Component (RTSS)

Post by Nir Hasson »

Thanks for reporting - I'll take a look at that...
User avatar
Nir Hasson
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 363
Joined: Wed Nov 05, 2008 4:40 pm
Location: TLV - Israel
x 2
Contact:

Re: RT Shader System Component (RTSS)

Post by Nir Hasson »

@al2950 - I just fixed it and commit to 1.7 branch.
There were some object space related parameters both in normal map and PSSM extensions that were not update when render object has been switched.
I simply updated their variability to include the GPV_PER_OBJECT flag..
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: RT Shader System Component (RTSS)

Post by al2950 »

Wow, very quick. Thanks Nir.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: RT Shader System Component (RTSS)

Post by al2950 »

@Nir

Your patch fixed most of my main scene, but the problem still exits in my test program. I thought it was becuase i messed up the ogre update, but triple checked everything and this bug is still there. I also noticed you only changed the directional light parameters, this is fine for me but the bug is visible in all light types.

PS Just noticed parts of my main scene that dont work. :(
User avatar
Nir Hasson
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 363
Joined: Wed Nov 05, 2008 4:40 pm
Location: TLV - Israel
x 2
Contact:

Re: RT Shader System Component (RTSS)

Post by Nir Hasson »

You are right - I didn't test on point and spot light...
Just commited another bunch of fixes for normal map + point and spot lights.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: RT Shader System Component (RTSS)

Post by al2950 »

Thanks Nir, all working beautifully now!
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: RT Shader System Component (RTSS)

Post by Mattan Furst »

Hello Everyone,

I am working on a sub render state which requires a lot of variables in order to be configured. The createInstance(...) function which exist in the Sub Render State Factories receives only property values (i.e. PropertyAbstractNode) from the compiler. I wish to change this into the more general AbstractNode so that Sub Render State Factories may receive both properties or objects (i.e. ObjectAbstractNode) from the compiler. Receiving objects from the compiler will allow me to receive multiple properties at once

Are there any objections to this change?
it's turtles all the way down
User avatar
Nir Hasson
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 363
Joined: Wed Nov 05, 2008 4:40 pm
Location: TLV - Israel
x 2
Contact:

Re: RT Shader System Component (RTSS)

Post by Nir Hasson »

@Mattan -

As long as you keep the old behaviour of all the sub render states factories that implemented the createInstance method it's ok.
But since it's an interface breaking I think your patch should go to the trunk..
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: RT Shader System Component (RTSS)

Post by Assaf Raman »

Layered blending modes has just been added - see this post.
Watch out for my OGRE related tweets here.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: RT Shader System Component (RTSS)

Post by masterfalcon »

Just noticed something strange today. Polygon modes aren't respected if the RTSS is active. I looked around the code and I'm not sure where it would fit in. The bezier patch sample shows it pretty easily.
Post Reply