-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Enable extreme render distances using LOD chunks #4452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
engine/src/main/java/org/terasology/rendering/AABBRenderer.java
Outdated
Show resolved
Hide resolved
nearby = new ClosenessComparator(center); | ||
neededChunks = new PriorityBlockingQueue<>(11, nearby); | ||
for (int i = 0; i < 2; i++) { | ||
Thread thread = new Thread(this::createChunks, "LOD Chunk Generation " + i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use separate thread, please.
You reimplement TaskMaster now :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a central ThreadPool or ExecutorService to use for this sort of thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's the ThreadManagerSubsystem
, but that doesn't support tasks with priorities like this, and there's TaskMaster
, which is basically just a slightly more abstract way of doing the same thing.
Ensure that the sky is visible even at the lowest view distances. Remove unused code from the AABB renderer. Reduce the amount of gaps between chunks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feeling standing in a world with this near infinity view distance is amazing! It's hard to stop posting screenshots of this ^^
I'd like to the this stabilize a bit more in the future (holes in generated chunks, removing LOD chunks before the replacement is ready), and I'm curious how to extend this to other structures (trees, buildings) and even hand-made changes to the world at some point 😍
(The code looks fine to me, but I haven't looked at it in detail...)
engine/src/main/java/org/terasology/world/block/BlockRegion.java
Outdated
Show resolved
Hide resolved
package org.terasology.world.generation; | ||
|
||
public interface ScalableFacetProvider extends FacetProvider { | ||
void process(GeneratingRegion region, float scale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the facet providers assume something about the scale, e.g., the range the value is in? Can they query the min/max scale somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the scale is never less than 1, or more than about 1000 (because the LODs slider doesn't go past 10). Do you think that some sort of pre-computed stuff in setSeed
or initialize
might be useful? I can't think of any use cases for that information (except that a ScalableFacetProvider
might rely on the scale never being less than 1, but that's more of an algorithmic simplicity thing, and being able to query it wouldn't really help).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about a facets that would want to use a simplified model (e.g., just 3 stages of LOD or something like that). However, I think I was missing some pieces about how this works, and that we are not generating placeholder meshes that get scaled to the correct size, but instead try to generate the world (features) in lower resolution.
I think those are two essentially different ways of doing the LOD effect (your's keeping the blockiness, while the other approach could do more interpolation/low-poly effect). I'm totally fine with what we have here in this PR, just trying to get my head around this. 😉
Generate less detailed meshes of far away chunks without actually loading them. I have been able to test it with an effective view distance of around 8000 chunks in each direction just fine without using particularly much memory. In order for this feature to be enabled, the world generator needs to support scalable generation. This can be added for a subset of facet providers and rasterizers (the others will just be ignored), so it is backwards-compatible. This has been implemented for the default world generator in Terasology/CoreWorlds#26 (although scaled trees have not been implemented yet).
There is room for improvement in the scheduling of loading and unloading LOD chunks (gaps appear while the game waits for replacements to be generated), and this PR also introduces some new occasional lighting bugs, but I thought I'd just get it merged and fix those later.
This resolves #319.