Hydrax Shadows

floobieg

05-04-2012 16:17:50

Hi all :)

I have an extremely frustrating problem involving the use of textured shadows with hydrax. I have used the shadow caster material and shader from the hydrax/skyx demo and everything works great when just casting shadows onto an island. To extend this to other objects, I adapted an ogre shadow receiver material and shader so that shadows could be received onto simple cuboid shapes.

Now, everything works fine for most viewing angles, however at others, the cuboids turn to complete shadow. The strange thing is, although hydrax does not cast or receive any shadows, if I set the visibility of hydrax to false, the shadows are perfect?! I have been stuck with this for well over a week and frankly I would love to get this sorted, so any help at all would really be greatly appreciated!!!

Things I have tried:

- I have added a SceneManager listener for the shadows and tried to set the visibility of hydrax to false before the cast/receive of shadows, and true after. This produces an error in onexit.c, I guess this is some form of lock on hydrax during the rendering stage?
- I have added a rendertarget listener to do the same as above, however this produces similar errors.
- I have tried to disable the materials and compositors of hydrax instead but the problem remains.
- I have tried to change the shader files several times to other implementations, however, no change and also, because the shadows are perfect without hydrax, I believe the problem does not lie here.
- I have tried changing the source of hydrax to set all shadow aspects to false.
- I have saved 2 shadow textures of a static scene with and without hydrax, but they both produce the same shadow map, so I know that that the problem resides in the receiver part.
- Many other approaches with no luck :(

So, I have a few questions...

1) Is there any way to change the rendering order of the scene so that everything can be rendered with invisible hydrax before switching the visibility and then rendering hydrax after?
2) Is there something specific within hydrax that will change how the shadows are mapped onto the scene?
3) Is there any other way of completely separating the rendering of hydrax from the rest of the scene? Maybe using different viewports? (Very loose idea :/)

I hope this is enough information, however if not, more information or images can be provided.

I really really hope someone can help! :D

Edit: Ok, so still not much further to solving this issue :( However, I think i may have a lead. I tried adding the main render queue to the setDisableReflectionCustomNearCliplPlaneRenderQueues of hydrax and this seemed to improve the glitch. I think it must be that hydrax is reflecting some kind of shadow. Does anyone have any idea if there is a specific render queue that would need to be passed to this function to improve the shadows? Note that I am also using caelum and so there are quite a few for the skydome etc.

Again, any ideas at all would be greatly appreciated! :D

scrawl

18-04-2012 22:43:54

Hey,

I havn't worked with Hydrax, so i'm not sure if this is the problem here, but: I have implemented by own water solution using RTTs in Ogre and I had a similiar problem like you - basically enabling of the water caused artifacts to appear in the shadow textures, even though water didn't cast shadows and the RTT viewports had shadows turned off.

In my case, it was fixed by creating a seperate camera for the RTT rendering. You'll have to modify hydrax source for this, but it shouldn't be hard. Just create your own camera in the hydrax constructor and copy its settings from the main camera (FOV, aspect ratio, etc)

Now, everything works fine for most viewing angles, however at others, the cuboids turn to complete shadow.
This is exactly the same that I have experienced.