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

Refactor LightingBuffer storage #145

Open
olls opened this issue May 12, 2018 · 1 comment
Open

Refactor LightingBuffer storage #145

olls opened this issue May 12, 2018 · 1 comment

Comments

@olls
Copy link
Member

olls commented May 12, 2018

ATM the lighting buffer is used both for rendering, and for mob spawning. When spawning mobs, a new lighting buffer is created covering the spawn radius for each player. Because there is only one lighting buffer stored in a global in the c-render, and it is reallocated if the newly created buffer is not the same size as the existing one, the lighting buffer is reallocated several times each frame. Once for the mob spawning, and once for the renderer.

Ideally we could have a more intelligent LightingBuffer storage which allows us to persist separate buffers of different sizes.

Another related issue is the duplicated work the mob lighting buffer creation and the renderer lighting buffer creation are doing when the regions overlap. (Also when multiple player's overlap.) Maybe we could store lighting buffers per chunk? Allowing us to generate lighting for all the chunks we need for mob spawning, then reusing those already generated chunks for rendering... Using a hash-table, this could be a lot more efficient.

@olls
Copy link
Member Author

olls commented May 12, 2018

Depending on how expensive generating lighting buffers for the entire vertical height of a chunk is, we may need to split the "lighting-chunks" vertically too..?

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

No branches or pull requests

1 participant