Page 7 of 18
Re: RT Shader System Component
Posted: Tue Nov 17, 2009 3:38 pm
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
Re: RT Shader System Component
Posted: Wed Nov 18, 2009 5:41 pm
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_pssm3.JPG (120.81 KiB) Viewed 6780 times
Re: RT Shader System Component
Posted: Wed Nov 18, 2009 6:35 pm
by sinbad
Great work!
Re: RT Shader System Component
Posted: Thu Nov 19, 2009 12:56 am
by Wolfmanfx
So got it working i mean both parallax and pssm with glsl.

- screenshot11192009_010049523.jpg (130.74 KiB) Viewed 6752 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

Re: RT Shader System Component
Posted: Thu Nov 19, 2009 6:08 am
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.
Re: RT Shader System Component
Posted: Thu Nov 19, 2009 8:07 am
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.
Re: RT Shader System Component
Posted: Sun Nov 22, 2009 12:14 pm
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
Re: RT Shader System Component
Posted: Sun Nov 22, 2009 1:10 pm
by Wolfmanfx
WhIch language? Cg, glsl or hlsl or is it consitent over all three versions?
Re: RT Shader System Component
Posted: Sun Nov 22, 2009 2:12 pm
by xadhoom
Its a consistent behaviour in cg and hlsl.
xad
Re: RT Shader System Component
Posted: Sun Nov 22, 2009 8:49 pm
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 ...).
Re: RT Shader System Component
Posted: Sun Nov 22, 2009 11:19 pm
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
Re: RT Shader System Component
Posted: Mon Nov 30, 2009 3:03 pm
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?
Re: RT Shader System Component
Posted: Mon Nov 30, 2009 3:18 pm
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.
Re: RT Shader System Component
Posted: Mon Nov 30, 2009 3:47 pm
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

Re: RT Shader System Component
Posted: Mon Nov 30, 2009 4:13 pm
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.
Re: RT Shader System Component
Posted: Tue Dec 01, 2009 6:03 pm
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.
Re: RT Shader System Component
Posted: Fri Dec 04, 2009 9:36 pm
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
Re: RT Shader System Component
Posted: Sat Dec 05, 2009 12:14 am
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.
Re: RT Shader System Component
Posted: Sat Dec 05, 2009 4:14 am
by Seikent
Great job

!
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

Re: RT Shader System Component
Posted: Mon Dec 07, 2009 9:02 am
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
Re: RT Shader System Component
Posted: Mon Dec 07, 2009 9:31 am
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.
Re: RT Shader System Component
Posted: Mon Dec 07, 2009 9:45 am
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…
Re: RT Shader System Component
Posted: Mon Dec 07, 2009 10:16 am
by boyamer
Could you post link of the wiki page?
Thanks
Re: RT Shader System Component
Posted: Mon Dec 07, 2009 10:21 am
by Nir Hasson
Sure - it is here - still under construction but better than nothing...
http://www.ogre3d.org/wiki/index.php/RT_Shader_System
Re: RT Shader System Component
Posted: Wed Dec 09, 2009 2:42 pm
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)