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
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: RT Shader System Component

Post by Wolfmanfx »

Thats also an option but what if there are more subrenderstates the want to override texcoords (or anything else) so the last subrenderstate would just override everything regardless the scope of the parameter (just think you alter texcoord in several stage and it is a valid input for the next stage otherwise it would be just wrong). I think that is what xad means with dataflow
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

Post by Nir Hasson »

Just a small update – I’m made the changes suggested by Sinbad regarding the extensions build.
Now the user have control over which sub-render states are build into the RTSS library.
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=53716.
I also integrated a custom sub render state that implements PSSM integrated shadow of 3 shadow splits. It is currently under some testing at my place and will be merged to trunk when wolfmanx will give his approve after testing on Mac and provide GLSL implementation.
RTSS - Integrated PSSM3
RTSS - Integrated PSSM3
rtss_pssm3.JPG (120.81 KiB) Viewed 3222 times
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 66
Contact:

Re: RT Shader System Component

Post by sinbad »

Great work!
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: RT Shader System Component

Post by Wolfmanfx »

So got it working i mean both parallax and pssm with glsl.
screenshot11192009_010049523.jpg
screenshot11192009_010049523.jpg (130.74 KiB) Viewed 3194 times
Can someone generate a parallax map (in the alpha channel) for the normalmap which is used by the demo because i can not remember where i got this textures :)
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Re: RT Shader System Component

Post by Vectrex »

I have to say this a huge feature for Ogre. I can see it being quite easy to mod the 'tecnofreak' node editor to work with this system which artists would LOVE :)
Really great 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

Post by Nir Hasson »

Can someone generate a parallax map (in the alpha channel) for the normalmap which is used by the demo because i can not remember where i got this textures
I'll update the normal maps with height data on the alpha channel -
Anyway I think we should give the user a way to tell the parallax sub render state from which texture and which channel to grab the height info.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: RT Shader System Component

Post by xadhoom »

I´ve checked out the pssm version and see two issues:

- when enabling fog, the shadow is disabled (exp, exp2) or screwed up (linear)
- when activating another light the newly lit area shows shadow aliasing artifacts

xad
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: RT Shader System Component

Post by Wolfmanfx »

WhIch language? Cg, glsl or hlsl or is it consitent over all three versions?
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: RT Shader System Component

Post by xadhoom »

Its a consistent behaviour in cg and hlsl.

xad
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

Post by Nir Hasson »

@xad - I fixed the fog + PSSM issue. It caused because the fog was enabled during the caster pass - I simply disabled it by overriding with FOG_NONE.
Currently I did it in the code level but I think it should be done in the material script.

Regarding the other lights issues - In this sample only the Directional light cast shadow, I guess this is the main scenario of using PSSM.
If the UI system had the feature of disabling widget I think I would use it to disable the point and spot light. (I can actually hide ...).
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: RT Shader System Component

Post by Wolfmanfx »

Nice...
just small progress update working right now on parallax subrenderstate and AOMapSubrenderstate + SpecularMapSubrenderstate hope that it fits in the system but we will see.
I attached the textures that i use
Attachments
Panels_Parallax.png
Panels_Parallax.png (135.94 KiB) Viewed 3049 times
Panels_Specular.png
Panels_Specular.png (206.64 KiB) Viewed 3049 times
Panels_Occlusion.png
Panels_Occlusion.png (153.63 KiB) Viewed 3049 times
User avatar
Azgur
Goblin
Posts: 264
Joined: Thu Aug 21, 2008 4:48 pm

Re: RT Shader System Component

Post by Azgur »

I've been following this project for a while and it's opening up really exciting doors.
Recently, I've begun integrating this into our project and I'm stuck with a few questions.

Our system doesn't assume a single scene manager and allows for multiple separate scenes to exist.
However, it seems the Shader system only offers a setSceneManager() rather than an addSceneManager() and removeSceneManager().
Is there a particular reason it assumes only a single scene manager or can I safely try to change this in my local version?

I've noted the current version on SVN as implemented in the sample browser uses the directory containing all the shader templates as the cache directory.
Are there any problems with using a different directory for caching the generated shaders?
I'd prefer to keep the input data clean and store all runtime generated files elsewhere.

The current examples seem to generate all extra features at runtime by generating the shader, clearing it and setting it up from scratch again with different extensions.
However, I'd like to have the shader system generate normal map shaders if they're defined in the material file and I've enabled the shadergenerator extension in code.
What kind of setup code am I looking at here? I've noticed some factories for the extensions, is registering these sufficient to get the shader generator to automatically generate normal shaders based on settings in the material file?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: RT Shader System Component

Post by Wolfmanfx »

It should be no problem to set another cache directory (the dependong shader files are fetched through resourcemanager so do not forget to register the dir where the lib shaders are). Regarding scenemanager try it...the impl of SGSceneManagerListener, SGScriptTranslatorManager is registred for the scenemanager you pass over. But i think it should work.
User avatar
Azgur
Goblin
Posts: 264
Joined: Thu Aug 21, 2008 4:48 pm

Re: RT Shader System Component

Post by Azgur »

Wolfmanfx wrote:It should be no problem to set another cache directory (the dependong shader files are fetched through resourcemanager so do not forget to register the dir where the lib shaders are).
Thank you, good to know. This should help keeping things clean a bit :)
Wolfmanfx wrote:Regarding scenemanager try it...the impl of SGSceneManagerListener, SGScriptTranslatorManager is registred for the scenemanager you pass over. But i think it should work.
I'll try it and report how it goes.

I've edited the previous post with some more questions, probably while you were posting.
In case it didn't get noticed or someone else wants to take a stab at them :)
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: RT Shader System Component

Post by Wolfmanfx »

There is a material script in the subfolder where the shader cache is. There are several materials, inside this file, which should give you a clue how you can set up normal mapping through ogre material script. The sample in the sample browser show you how you can set things programaticly for example how to add a normalmap subrenderstate and pass the normal map texture to it.
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

Post by Nir Hasson »

Our system doesn't assume a single scene manager and allows for multiple separate scenes to exist
The current implementation doesn’t support multiple scene managers - there is no reason for that - it is just the current state.
You can swap them using the set* method, but in case of some differences between scene settings like different light setup or fog for each one of them some internal steps of the RTSS will occur per frame.
So bottom line - adding multiple scene manager support requires internal changes to the system - maybe by adding another layer of hierarchy above the SGScheme.
If you'll dig into it and want to add it - a patch is more than welcome.
However, I'd like to have the shader system generate normal map shaders if they're defined in the material file and I've enabled the shadergenerator extension in code.
What kind of setup code am I looking at here?
Take a look at the Dot3 sample - there are two materials called RTSS/NormalMapping_SinglePass and RTSS/NormalMapping_MultiPass at the end that demonstrates how to use the RTSS to generate shaders based on script files.
When you'll pick one of these materials you won't see the normal map until you'll turn on the RTSS by pressing F2 which switches the current viewport material scheme.
I think this is the scenario you look for.
is registering these sufficient to get the shader generator to automatically generate normal shaders based on settings in the material file?
Yes - in one condition - you'll have to implement the parsing method:

Code: Select all

SubRenderState* SubRenderStateFactory::createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass)

Take a look at the ShaderExReflectionMapFactory in the Shader System sample.

There is a new wiki page I’ve started which can give you some other useful information... Search for RT Shader System.
User avatar
boyamer
Orc
Posts: 459
Joined: Sat Jan 24, 2009 11:16 am
Location: Italy
x 6

Re: RT Shader System Component

Post by boyamer »

I have a question,is possible to use the RT Shader System without parsing attributes from material scripts? I saw that it uses MaterialSerializer,ScriptTranslator and so,its possible to generate shaders without using them?

Thanks
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

Post by Nir Hasson »

I have a question,is possible to use the RT Shader System without parsing attributes from material scripts? I saw that it uses MaterialSerializer,ScriptTranslator and so,its possible to generate shaders without using them?
Yes - you can do it by code - take a look at the Shader System sample.
Seikent
Gnoblar
Posts: 12
Joined: Wed Sep 05, 2007 5:05 pm

Re: RT Shader System Component

Post by Seikent »

Great job :D!

I didn't read this post because RTShader sounded complicated xD, but this is a great tool for Ogre3D. It helps game developers to have good visuals without too much budget :) . I'm still understanding and learning how to use shaders in ogre, but I feel that this will help a lot.

Thanks :D
User avatar
boyamer
Orc
Posts: 459
Joined: Sat Jan 24, 2009 11:16 am
Location: Italy
x 6

Re: RT Shader System Component

Post by boyamer »

I've started using the shader system,but felt in problem,would be possible for you write a simple.short guide on how to create a new shaders? SubRenderStates,etc?
Would be really appreciated

Thanks
User avatar
Azgur
Goblin
Posts: 264
Joined: Thu Aug 21, 2008 4:48 pm

Re: RT Shader System Component

Post by Azgur »

Regarding the multiple SceneManagers, I've decided to let that slide for now. It looks indeed it's a bit more than a trivial fix.

I've been using the RT Shader System for a short while now and I have to say, it's awesome.
Being able to mix and match different materials (diffuse, normal map, etc) and have the system generate shaders for them is great.
What I love the most is how PSSM integration is conveniently placed in such way it gets automatically added to all materials needing it. This previously was a pain to support multiple shadow types or complete lack of shadows.
The same goes for global scene effects like fog. I'm loving it.
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

Post by Nir Hasson »

@boymer – I started writing down a wiki page for the RTSS, you can read there but I haven’t reached to the SubRenderState part yet – hope to do it soon. In the meanwhile take a look at the Shader System sample you can follow the implementation of the Reflection map to get a clue how to extend the system.

@Azgur – I’m happy to hear that you are using it and take advantage of it features.
Regarding the multiple scene managers – I’ll add it to my task list – if you can refer me to a base starting point it would really help me. I mean just a simple frame work with two different managers will do the job…
User avatar
boyamer
Orc
Posts: 459
Joined: Sat Jan 24, 2009 11:16 am
Location: Italy
x 6

Re: RT Shader System Component

Post by boyamer »

Could you post link of the wiki page?

Thanks
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

Post by Nir Hasson »

Sure - it is here - still under construction but better than nothing...

http://www.ogre3d.org/wiki/index.php/RT_Shader_System
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

Post by al2950 »

Quick Question:

Will the RT shader system be able to handle things like HardwareSkinning which need a special 'shadow_caster_vertex_program_ref' in material file for shadows??

**EDIT** Thinking about it, the skeleton demo works with the RT shader system on (Although the shadows dont work perfectly)
Post Reply