Comments (5)
The issue happens because that decal was implemented at a time Godot did not have any decal system. Therefore, it's actually a small plane placed just above the terrain. That works well enough for common usages, however:
The downside of that is that if you are very close with a tiny brush, the offset becomes too apparent, leading to that discrepancy. You can especially notice with a cube rendered at the location of the decal.
There are some solutions, but they all have drawbacks:
-
Reduce displacement in the decal shader: there is a number that can be be reduced in
decal.gdshader
so that the cursor is rendered closer to the terrain. However this doesn't work on slopes, because there isn't enough geometry to cover error margins (needs some investigation though, maybe there is something to improve here):
-
Render cursor directly with the terrain shader: while efficient, this has a number of annoying drawbacks regarding shader maintainance:
- It requires every terrain shader to include code and parameters to position and render the cursor (there are more than one shader this plugin provides)
- As a result, it also requires to somehow remove that extra code when exporting the game, because that would be unnecessary overhead to process editor-only features there. Does Godot have a predefined shader #define symbol telling whether it runs in editor at least?
- It requires users with custom terrain shaders to also include that code just so they can see the cursor
-
Use an actual decal: Godot 4 added decals, which then could be used instead. However, by default, decals would project on everything, including all things placed on top of terrain. That could be solved by putting terrain in a specific render layer, but that also messes with the choice of layers users might have made. At the very least, it requires to reserve a specific render layer for terrain ground, just to fix that discrepancy, hoping users don't need that layer for other things...
-
Disable depth-test: if the issue is clipping with ground, we could disable depth-testing and remove the vertical offset so that the cursor always renders on top, even if it is behind stuff. The drawback is like with decals: it will still render even if there are props in front, including grass.
from godot_heightmap_plugin.
Looks like this happens specifically when using very small brush size and very close to the terrain. Looks also like an issue with the decal rather than the functionality, since you noticed it still performs the action at the right position.
from godot_heightmap_plugin.
decal.gdshader .......
...........
......
depth_test_disabled
.
.
//VERTEX += 1.0 * n;
.
Turned off Z-depth testing and removed adjustment of specific displacement values.
I like this setup.
thank you
from godot_heightmap_plugin.
I found the decal didn't apply a half-pixel offset terrain shaders are applying (therefore heights of the decal were slightly off).
That fixed some of the issues with reducing the distance from ground, but still wasn't good enough on higher slopes.
So I also increased the amount of subdivisions at low brush sizes, and dynamically adjusted distance from ground based on the size of the brush, and now it looks mostly fine.
Did the changes in 616088d
from godot_heightmap_plugin.
I plan to just slightly modify the current shader.
.
It seems like a change occurred in decal.gd...
.
First of all, I plan to use a slightly modified version of the shader.
.
This is pretty good too ^^
.
If hterrain is updated to a later version, I will update the entire thing at that time.
from godot_heightmap_plugin.
Related Issues (20)
- Color Paint erase HOT 4
- filter_nearest HOT 3
- 4K Texture looks blurry and normal / roughness do not work HOT 2
- Get texture at a given coordinate? HOT 3
- Procgen terrain - script debugged but not working HOT 1
- Collision detection broken after Linux/MacOS dedicated server export HOT 10
- Lowering of terrain not showing up for single coordinates HOT 11
- LOD Scale Slider does not update its own value HOT 1
- Assertion Failed HOT 2
- assetion failed HOT 3
- Detail layers infinite synchronized clones. HOT 11
- Proposal: Allow more than 16 textures HOT 1
- Scrollable Dialogue fix request for Android smartphones HOT 2
- How can I detect where the player clicks ? HOT 3
- Is it possible to do hard texture blends, ie no gradient blending? HOT 2
- Visuals do not match collision shape at highest LOD - 5 HOT 3
- tile reduction issue HOT 4
- Import textures dialog is so large it does not fit on screen and is unusable HOT 3
- Pixel art texture is blurred. HOT 1
- No Terrain Data saved on disk HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot_heightmap_plugin.