OGRECave / ogre-caelum

Library for rendering of dynamic and realistic skies
https://ogrecave.github.io/ogre-caelum/
MIT License
16 stars 10 forks source link

Two volume terrain issues #6

Open Belsnickle opened 5 years ago

Belsnickle commented 5 years ago

In my project I am using the Volume component of Ogre. I ran into two issues with Caelum.

  1. Fog color of Caelum is grey.

  2. At night the sky color is the same blue sky as daytime. Also the starfield never shows up. I traced this to the following code:

mShaderGenerator->invalidateScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mViewport->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);

Removing these lines gives me a night time experience like in the CaelumDemo, however the terrain is without texture.

No fog isn't a game breaker. No texture on my terrain is. I know Caelum was developed with the legacy terrain system in mind. I would like to add support for the Volume component of Ogre. Any advice would be greatly appreciated.

Belsnickle commented 5 years ago

https://forums.ogre3d.org/viewtopic.php?f=22&t=79793

I just read that you can invalidate schemes based on name. What would I enter for the volume terrain material generated by RTSS? I theorize invalidating only this material instead of the entire rtss default will allow for integration of Caelum and the volume terrain.

Belsnickle commented 5 years ago

Using setRTSSWriteShadersToDisk(true); before I call

mShaderGenerator->invalidateScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mViewport->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);

gives me several KB more data than if I call the code above. Something is getting thrown away that Caelum needs.

Note that the code above gets called before any Caelum and volume terrain code. Without it my volume terrain is untextured. With it Caelum sky colour never changes.

paroj commented 5 years ago

I theorize invalidating only this material instead of the entire rtss default will allow for integration of Caelum and the volume terrain.

unfortunately the RTSS is all or nothing currently as the schemes are set per viewport.

Note that the code above gets called before any Caelum and volume terrain code. Without it my volume terrain is untextured. With it Caelum sky colour never changes.

this is an insightful finding. Probably Caelum does not account for RTSS generated techniques and just always uses technique 0 instead of calling getBestTechnique().

Belsnickle commented 5 years ago

I tried changing all instances of getTechnique(0) to getBestTechnique() to no avail.