After more than a week of steady troubleshooting and workarounds, I am left with the following:
1. cg shaders and RTShader System cannot coexist.
With RTShader System enabled, my cg shaders do not execute -- or if they DO execute, their results are not visible. The only way to display the results of my cg shaders is to disable the RTShader Sysytem. cg shaders and RTShaders are mutually exclusive.
2. Texture swaps execute in code but do not display on materials with associated cg shaders -- while RTShader System is running.
I tried the workaround suggested by Wolfmanfx:
1. Call mShaderGenerator->removeAllShaderBasedTechniques("Examples/Flare3"); which will remove all shaderbased techniques which were generated and injected by rtss. So you can
use material->getBestTechnique() again.
This workaround did not work since the material in question (with my cg shader) was never intentionally applied to the RTShader system by using the following:
Code: Select all
GenerateShaders(someEntity, colorSpecularSetting, rSpecularShinySetting);
Repeat: this was NOT used for the object whose material included my cg code.
This was confirmed because queries of the for the object's materials returned NULL.
Code: Select all
And even if I was able to swap the texture for the material in question (despite the code actually showing the the texture was in fact swapped -- but not displaying), I would still have the problem of the associated cg shader not displaying while the RTShader System existed.
the cg code in question is for my moon. Never used the RTShader system on that.
I have used the RTShader system in the past mainly on my terrain for nice specular effects and spotlights.
I have had a very frustrating couple of weeks Ogre 1.9.0 -- trying to hammer out solutions to this problem.
I have tried adapting a phong shader from Nvidia's fx Composer. Crazy hard to do and crazy hard to debug. No success.
I have tried a perpixel shader from Nvidia's cg Tutorial book (ch. 5). No luck. Material displays semi-transparent.
I have tried reverse engineering the actual shader written for my terrain material written to disc by the RTShader System. No luck. Material also displays semi-transparent.
I have tried using shaders from the Ogre examples. But with the myriad of delegates and cascading references, I found it so confusing and bloated that I gave up.
So, I would say, I have given it a solid attempt... with no success.
All I want to do is display phases of my moon (cg shader) and headlight cones on my terrain (perpixel shader).
Please pardon my rant.
Thank you, and Happy New Year.