-
Notifications
You must be signed in to change notification settings - Fork 116
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
Implement slope sculpting tool #297
Implement slope sculpting tool #297
Conversation
tested and it works well, though it freezing when painting a slop when drawable is off. Specifically after you pinned the first pin , when you try to position the second one the engine freezes, which doesn't happen when drawable is on. Also when you have terrain 3d with other build already enabled, and then you replace it with this one, at first the function doesn't appear unless you re enable it again in the project sethings |
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.
Thanks for this PR. Excellent work.
Some notes:
-
The insta-slope is obviously slow. 10-50x slower than just using the drawable brush, so I looked into why. In
gradient_operation_builder.gd:apply_operation
the movementdir
of 1 is unnecessarily small, especially on large brushes. I found that the movement can be 1/3rd the brush size for optimal speed without gaps. So a 60m brush can move 20 each iteration. And a 9m brush, 3m brush, 1.This makes the tool much more usable. It's more than 10x faster. It makes long slopes across many regions possible. And now opacity makes more of a difference. At 100% it has a similar appearance as when movement is 1, but at 10%, it has only a subtle effect as it should.
-
If 2 points are selected with drawable on, then drawable is turned off, the 2 points are still selected. On the next click it draws another slope between the two points. I think it should clear the points when drawable is turned off.
-
Pressing Escape, switching to another tool, or deselecting Terrain3D should cancel picking. Currently:
- Escape deselects Terrain3D (as it does for all nodes) and whenever Terrain3D is reselected, it's still picking
- If you pick, then click another tool, say flatten, the picker decal is still there. If you click the terrain, the pick happens and flattening doesn't until another click.
project/addons/terrain_3d/editor/components/gradient_operation_builder.gd
Outdated
Show resolved
Hide resolved
73b8a53
to
2c0839e
Compare
Thanks for the great feedback. I've implemented your suggestions. |
2c0839e
to
126a6d2
Compare
Excellent, thank you. I increased the frequency from .333 to .2 for now. |
Admin edit:
Fixes #96
This PR implements the slope sculpting feature discussed in #96.
Screencast.from.2024-01-09.17-18-00-edit.webm
Quick word on naming first: I've used both 'Gradient' and 'Slope' here, but to mean different things. A slope is a gradient applied to the height map, whereas a gradient operation could theoretically apply to other maps like color and roughness (if implemented).
UI is shown in the above video. Click two points, then if drawable is unchecked there's a little pause as it builds a straight-line slope. If drawable is unchecked you can click and drag to make wiggly slopes. If you selected the wrong point, you can use the dropper buttons in the tool settings bar to pick a different one.
Figuring out how to implement the non-drawable gradient was pretty difficult because the flow is significantly different from other tools that are already present. I've created an OperationBuilder abstraction to avoid turning
editor.gd
,ui.gd
, andtoolbar_settings.gd
into spaghetti. Gradient operations are the only ones that use this currently.The gradient operation in
terrain_3d_editor.cpp
uses the direction of movement of the brush as well as its position. This to keep winding slopes from having one edge higher than another. The following screenshots demonstrate the difference this makes: