Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how the system works #35

Open
djeedai opened this issue Nov 18, 2022 · 2 comments
Open

Clarify how the system works #35

djeedai opened this issue Nov 18, 2022 · 2 comments

Comments

@djeedai
Copy link

djeedai commented Nov 18, 2022

I've been looking at the repo, the docs, and some examples, and I'm still unsure how the system works overall.

In previous versions before the rewrite, the plugin recalculated a camera "background" each frame, unless auto-update was disabled in which case it was calculated only once. At least I think.

In this new version, which by the way looks a lot better from what I grasped, it also seems like this is still true? But there was also some mention of "update every 50ms" somewhere, so...?

Then there's the whole "skybox" thing. My two conflicting possible understandings here are:

  1. The system calculates one cube map image every so often, then save it into a texture, which is sampled every frame from a giant inverted cube representing the sky. Efficient! But requires quite a big resolution...
  2. The system directly writes the atmosphere calculated into the render target of the camera reach frame. Optionally, it can also save that data into a cube map for e.g. IBL, but that cube map is not consumed by the atmosphere system. Maybe less efficient, definitely less memory, more dynamic, forward-looking!

So, not sure which one it is?

I'd be also interested to understand, for optimization purpose, when that rendering to the camera render target happens. I suspect it's not cheap, so would be best done after all opaque rendering, to leverage the depth buffer and reject as much fragments as possible.

I'm really looking forward to integrate this new version in my project, but for now I'm unsure how. Thanks! 😊

@JonahPlusPlus
Copy link
Owner

It's 1. I go over it on my blog (https://jonahplusplus.dev/2022/08/20/bevy_atmosphere_0.4.html). I can look into adding a docs folder with some clarification on the internals.

The compute shader is specified to just run before the camera driver (maybe I could specify it to come before everything else?). The skybox material is just a normal material, I don't specify where it runs.

I'm not done with 0.5 yet, I've got more changes to make (it's going to get a huge flexibility boost this update, so stay tuned 😄)

@JonahPlusPlus
Copy link
Owner

@djeedai I added a section on how the internals work. If you could check it out and see if I need to clarify anything, that would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants