Simul Support ExchangeCategory: CloudstrueSky in OpenSceneGraph based IG
Nick.Simultec asked 6 months ago

Hi community,
we are coming from the flight simulation domain and we already have an IG that is developed on top of OpenSceneGraph. At present we are evaluating trueSky as OpenGL plugin to our IG. The first show stop is the GL headers. As we see, trueSky uses glad which has some extensions and we use GL2 default headers and libs and there is a conflict. Is there a way to resolve this?
Thanks a bunch for any hints!
 
Cheers,
Nick

4 Answers
Andrew Richards Staff answered 6 months ago

Hi Nick,

We use OpenGL 4.5+ for trueSKY. From my understanding, I think you are using OpenGLES 2.0? Please inform me on which version you are using. It’s possible to recompile trueSKY using the GL2 header but would likely require heavily modifying the source code.

Please let me know the platform, API and API version you are using, and how you’d like to proceed.

I hope this helps.

Best Wishes,
Andrew

Nick.Simultec replied 6 months ago

Hi Andrew,

we are using OpenGL 2.0 (we can use 3.0 as well), and that’s it.

The whole story is that we seriously consider to use truSKy for our DirectX11/12 Havok Image Generator for most of our high end projects, also OpenGL version for some smaller projects as well. SInce I am not DirectX engineer at the moment I am to test it with the OpenGL platform.

I went a bit further since yesterday when I post my first question. I generated OpenGL 2.0 glad loader and built the samples and it worked too. Also I was able to wrap up the sample code into plugin for our. IG with mixing of GL2 headers and glad, but that is working only in debug in release it crashes.

I used trueSky 10 years ago on a different project and the integration with OSG was very smooth but I forgot the details :).

Thanks a bunch for any hints and help. It will be awesome if we can get GL2/3 version.

Cheers,
Nick

Nick.Simultec answered 6 months ago

Hi again Andrew,
I am having progress ;-). I was able to build and run trueSky with the default GL2 headers, both in release and debug and now I have it as a working plugin in our OSG IG. Attached is what I am seeing. Is there a simple way to get rid of the debug quads from the image?
Thanks again for the support!
Nick
https://pasteboard.co/JSt1l7V.jpg

Andrew Richards Staff answered 6 months ago

Hi Nick,

It’s great to see that you have trueSKY rendering in both Debug and Release. As for the debug quad, I would check the value of simul::clouds::TrueSkyRenderer::debugOverlays. This variable control which debug-overlays are drawn.
I will check but I doubt that we would support OpenGL 2.0 / 3.0.

Thank you for using trueSKY for so long, and I hope we can resolve the debug overlay issue.

Best Wishes,
Andrew

Nick.Simultec replied 6 months ago

Hi Andrew,

I put the following line in my code and I am still getting the debug overlays
mTrueSkyRenderer->debugOverlays = simul::clouds::DebugOverlays::NONE;

Do you have any further hints?

Thanks a bunch!

Cheer,
Nick

Nick.Simultec replied 6 months ago

Hi again Andrew,

first take my apologize for lots of questions ;-).

After reading a bit more the code and trying different things I figured out that this line is causing the debug quads:
mTrueSkyRenderer->GetSimulWeatherRenderer()->GetCloudRenderer()->RenderCrossSections(deviceContext);

Anyway, I don’t needed it. I have (partially) what I need for the moment. A bit of more progress:
https://pasteboard.co/JSLoXBZ.jpg

As you can see in the image the frame buffer is flipped. I need to resolve this. Also how to render the sky too. I can not get it rendered even I have set mTrueSkyRenderer->SetRenderSky(true);

and then the DepthBuffer, but I think I have a handle of it to give it through external Texture2D.

I think after resolving these issues I will be fine for a moment and will have a solid state for testing the real features of trueSky

Thanks a bunch again!

Cheers,
Nick

Nick.Simultec replied 6 months ago

Hi Andrew,

I figured that out. Also I am able to load my simple scene so I think for now I am good :-). I will sure have more questions. Thanks for the support so far!

Here some snapshot
https://pasteboard.co/JSMFSUBB.jpg

Cheers,
Nick

Nick.Simultec replied 6 months ago

Hi Andrew,

I am struggling with providing my own OpenGL Depth Texture2D. I see in the sample code this and also in the documentation, but for me is not clear, these void* pointers that seams to be not documented well

auto hdrDepth = (simul::opengl::Texture*)mHDR_MSAA_Fbo->GetDepthTexture();
mExternalDepth->InitFromExternalTexture2D(mRenderPlatform, (void*)hdrDepth->GetGLMainView(), nullptr, false, true, simul::crossplatform::UNKNOWN, false, false, true, hdrDepth->GetSampleCount());

My question is how to wrap up existing GL Texture2D with simul Texture

My intention is to make flight through the clouds and have the sky always rendered first. If there are any other hints they are appreciated !

Thanks a bunch once again!

Cheers,
Nick

Nick.Simultec replied 6 months ago

Hi again,

finally I managed to have my external depth buffer working as a simul::crossplatform::texture with the trueSky Renderer. There is something with the settings I guess since my image is black now. Will keep studying the code

Cheers,
Nick

Nick.Simultec answered 6 months ago

Hi community,
 
so finally I have it integrated in our OpenSceneGraph IG. I have the basics working with external buffers. Took a bit but at the end we are all happy! Very good product just here and there maybe some things at first look were not so clear. But after reading the code I got a handle of it
 
Here is some test I just did. We will try to put into our simulator and see how it works. At least we have now something working to test the real features.
 
https://pasteboard.co/JVvt33d.jpg
 
Cheers,
Nick

Andrew Richards Staff replied 4 months ago

Hi Nick,

Sorry for the delay in getting back to you on this issue.
It’s good to hear that you have trueSKY working OpenSceneGraph IG, and thank you for your posts for the community.

Best Wishes,
Andrew