Comments (7)
For future reference, if anyone else tries to tackle this:
#1739 (comment)
from flaxengine.
Hello, I don't know if it's related, but I think the splatmap painting quantization algorithm is iccorect (Source/Editor/Tools/Terrain/Paint/SingleLayerMode.cs -> Apply).
In the deepest of the loop, we can see that we add paintAmount to the current layer (c) and subtract this same amount to all other layers.
I think instead we should decrease each other layers by the paintAmount multiplied by their contribution (minus current layer's contribution).
Something like this:
// Paint on the active splatmap texture
var c1 = (c + 1) % 4;
var c2 = (c + 2) % 4;
var c3 = (c + 3) % 4;
var otherLayersSum = src[c1] + src[c2] + src[c3] + other[0] + other[1] + other[2] + other[3];
var decreaseAmount = paintAmount / otherLayersSum;
src[c] = Mathf.Saturate(src[c] + paintAmount);
src[c1] = Mathf.Saturate(src[c1] - decreaseAmount * src[c1]);
src[c2] = Mathf.Saturate(src[c2] - decreaseAmount * src[c2]);
src[c3] = Mathf.Saturate(src[c3] - decreaseAmount * src[c3]);
p.TempBuffer[z * p.ModifiedSize.X + x] = src;
var other = (Color)p.SourceDataOther[zz * p.HeightmapSize + xx];
//if (other.ValuesSum > 0.0f) // Skip editing the other splatmap if it's empty
{
// Remove 'paint' from the other splatmap texture
other[0] = Mathf.Saturate(other[0] - decreaseAmount * other[0]);
other[1] = Mathf.Saturate(other[1] - decreaseAmount * other[1]);
other[2] = Mathf.Saturate(other[2] - decreaseAmount * other[2]);
other[3] = Mathf.Saturate(other[3] - decreaseAmount * other[3]);
p.TempBufferOther[z * p.ModifiedSize.X + x] = other;
otherModified = true;
}
from flaxengine.
@Menotdan could you attach terrain material you use in here? (no need for textures, just material asset would be fine)
from flaxengine.
Also, usually using more advanced blending logic than simple Lerp yields better results in realistic terrains:
from flaxengine.
@Menotdan could you attach terrain material you use in here? (no need for textures, just material asset would be fine)
from flaxengine.
Also, usually using more advanced blending logic than simple Lerp yields better results in realistic terrains
Is Linear Blend more complicated than Lerp? Anyways that wouldn't affect the splatmap being blocky.
from flaxengine.
Thanks @Vizepi . I used your code here 0ee5ef8. It did improve blending.
Regarding the blockiness of the paint, it's related to the implementation of this system which stores layer weights per-vertex and uses hardware interpolation of the values in-between:
To provide higher resolution or this blend use heightmap-aware blending (like suggested above) or use tessellation (also with displacement/height-based blend) or increase vertex density (eg. by scaling terrain down a little).
from flaxengine.
Related Issues (20)
- C# method GPURender.Resize causes fatal C++ Error when using invalid parameters HOT 4
- Terrain physical materials do not persist after an editor reload. HOT 3
- [Suggestion] Add overrides for physical materials on terrain chunks similar to the terrain material itself.
- Terrain height is allowed to go negative, resulting in flipped normals. HOT 1
- Add lights and cameras importing from model files
- Add automatic monitoring of which mesh is static or animated when importing model as prefab
- Add importing meshes as instances
- [Feature Request] Support camera stacking
- Inconsistency in the appearance of Materials when viewed through a transparent surface
- The NetworkRpcParams TargetIds list doesn't work if empty. HOT 1
- Suggestion: Show a reference count on certain objects
- Add Ability to select a spline point under surfaces. HOT 1
- [Suggestion] Automatic assignment of Materials from Material Entries to submeshes in Model Prefab, when the model is imported without Materials HOT 1
- Private visual script members still have a per-instance value when added to an actor.
- UI on Linux: focus handling is way too aggressive HOT 1
- bUG] Editor freeze when
- [Bug] Editor freezes after trying to delete ModelPrefab instance with missing reference
- Vulkan: Scene rendered in purple
- [Issue] Something wrong with DDGI HOT 6
- Potential issue with PlayerController/PlayerPawn HOT 1
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 flaxengine.