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

Adjustable mesh density #131

Closed
TokisanGames opened this issue Jul 18, 2023 · 6 comments · Fixed by #296
Closed

Adjustable mesh density #131

TokisanGames opened this issue Jul 18, 2023 · 6 comments · Fixed by #296
Labels
enhancement New feature or request idea Just an idea, may or may not be implemented low priority Low Priority
Milestone

Comments

@TokisanGames
Copy link
Owner

TokisanGames commented Jul 18, 2023

Our mesh vertices are every 1 unit. The Witcher 3 uses 0.5 for their clipmap terrain, which I'd like to copy. Lower end hardware might benefit from 2+.

This would allow using a 1024px map for a 512m world, or a 2048m world instead of the current 1024px = 1024m world.

@TokisanGames TokisanGames added enhancement New feature or request idea Just an idea, may or may not be implemented low priority Low Priority labels Jul 18, 2023
@TokisanGames TokisanGames added this to the Polished Version milestone Jul 18, 2023
@Saul2022
Copy link

Maybe as of a . later pr, if i understand this correctly you can make the density decrease automatically when more far away while maintaining the distance to save some performance.

@nanodeath
Copy link

I'm going to take a look at this. I've figured out how to make the terrain scale visually, I just need to do a bunch of testing to make sure the physics and terrain sculpting/painting works. Then I'll send a PR assuming that's all working.


One open question, though. When changing the terrain size, the height scale is incorrect. That is, when changing from 1024 to 2048, the terrain is half the height it should be. Do we want to try to do anything about that? I can think of three options:

  1. Explicitly update the height scale when changing the terrain size. By this I mean when going from 1024 to 2048, automatically change the height scale in the inspector from, say, 1000 to 2000 (same factor as the terrain size change).
  2. Implicitly update the height scale. If the user specifies height scale 1000 and terrain size 2048, we internally treat it as if they'd specified 2000 for height. That is, we calculate a multiplier based on the terrain size vs 1024 and apply that when using height.
  3. Do nothing, make the user specify the height each time. And...frankly users shouldn't be importing terrain all that often (hopefully).

Each of these have merit. 1 is nice because it usually Just Works but users keep control if they want to specify the exact height. 2 is nice because it means if I have two heightmaps of the same logical region, but different sizes, I can give them the same height scale and that Just works. 3 is kinda nice because there's no magic involved.

IMO there should be a little magic here. I think I'm personally leaning slightly towards 2 because I already have problems forgetting which height scale I import my terrains at, and last thing I want is to remember more numbers.

Thoughts?

@TokisanGames
Copy link
Owner Author

There are two other devs who have implementations of adjusting mesh density. One enabled Godot's transforms, but is leaning away from this solution. The other is adjusting the vertices per distance, which we are going with. You are welcome to join the discussion.
https://discord.com/channels/691957978680786944/1065519581013229578/1192760635931508746

When changing the terrain size, the height scale is incorrect.

Heights are absolute, displaying the height stored in the height data.

The importer could use an option to resize maps and already has an option to scale or offset height. I don't think it needs more than that. In the future, the tools menu needs some image manipulation tools which can expose resizing images and scaling heights. See #81.

So the user could change the height data with the importer, future image tools, or externally.

And...frankly users shouldn't be importing terrain all that often (hopefully).

Yes, generally set and forget. Changing mesh density should be instant. Then with included image tools, they can adjust the height data. Maybe we'll add a realtime height scaler.

@nanodeath
Copy link

Okay, I'll join the Discord when I can...

But I was able to revert this commit and get that working with a 1-line code change. Is that approach fundamentally flawed or something?

@TokisanGames
Copy link
Owner Author

That commit came out of #77, and you can read about why it was temporarily disabled. Not the same thing as mesh density, in this ticket.

Subsequent changes may allow other region sizes to work, but it needs further testing before it can be enabled again.

@TokisanGames
Copy link
Owner Author

Implemented in #296

@TokisanGames TokisanGames modified the milestones: 0.9.1, Beta 0.9.x Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea Just an idea, may or may not be implemented low priority Low Priority
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants