Comments (5)
I got some kind of 3D noise working, here's how I did it:
public float CalculateVoxelData(int worldPositionX, int worldPositionY, int worldPositionZ)
{
float voxelData = worldPositionY;
// Create 3D noise in range [-1, 1]
float overhang = noise.snoise(new float3(worldPositionX, worldPositionY, worldPositionZ) * ProceduralTerrainSettings.NoiseFrequency * 0.01f);
// Remap the 3D noise to be in range [0, 1]
overhang = (overhang + 1) * 0.5f;
// Multiply it by some constant
overhang *= 100;
voxelData -= overhang;
voxelData -= OctaveNoise(worldPositionX, worldPositionZ, ProceduralTerrainSettings.NoiseFrequency * 0.001f, ProceduralTerrainSettings.NoiseOctaveCount) * ProceduralTerrainSettings.Amplitude;
voxelData -= ProceduralTerrainSettings.HeightOffset;
voxelData *= 0.5f;
return voxelData;
}
You can change the intensity of the 3D noise by changing the multiplier, which in this example is 100
It works, but sometimes the physics are questionable, to say the least:
There's also some artifacts, but I'm pretty sure thats coming from the noise.snoise
function itself. The fix would be to use a different noise library, but I'm not sure how well that would go with the Burst compiler.
Also, you said it just looks the same: If this doesn't fix it, make sure you are in the correct scene ("Procedural World Example")
from marching-cubes-terrain.
A while ago I was playing around with 3d noise but didn't really bother polishing it. Could be a nice addition. If you want to try 3d noise yourself, you could tweak this line to use noise.snoise(int3)
, taking inspiration from the OctaveNoise() function below that line.
from marching-cubes-terrain.
Hey, I have tried changing this line to use float3 but I cannot get it to work or at least get any actual results. What I did is changed the OctaveNoise() function to accept additional float z parameter and have sent the x, y and z world position values when calling this method.
return worldPositionY - this.OctaveNoise(worldPositionX, worldPositionY, worldPositionZ, proceduralTerrainSettings.NoiseFrequency * 0.001f, proceduralTerrainSettings.NoiseOctaveCount) * proceduralTerrainSettings.Amplitude - proceduralTerrainSettings.HeightOffset;
When calling noise function I simply added z parameter and that's it
float pureNoise = (noise.snoise(new float3(octaveModifier * x * frequency, octaveModifier * y * frequency, octaveModifier * z * frequency)) + 1) / 2f;
But all I get is pretty much the same type of terrain. Seems like it's just a heightmap based terrain. Do I need to change something else?
from marching-cubes-terrain.
Thanks! After playing around with some settings like frequency and amplitude I got some pretty interesting results!
Although, there are a lot of floating parts. You think it's because of the noise function? I was thinking trying to check the size of the floating piece and if the element is big enough make the thing separate with its own collider and rigidbody and if it's small just remove it.
Although, I'm not sure how to detect these parts.
I also tried to blend two noises together, to have like a flat land with occasional mountains, I managed to make something to the extent, but I got really hard edges when the mountain starts. I suppose I need to blend the heights? Not really sure how to tho.
from marching-cubes-terrain.
Although, there are a lot of floating parts. You think it's because of the noise function?
Yep.
I'm not sure how to detect these parts.
This could be done using the flood fill algorithm to detect different areas. One problem though would be the edges of the visible world, where the terrain has not yet been generated so you don't know if a part is either floating or attached to something that has not been loaded yet.
And about the biomes, see #40
from marching-cubes-terrain.
Related Issues (20)
- Project Structure HOT 3
- Generate chunks around the player in a circular shape
- Implement unit tests for the project
- Be able to give a random seed to the procedural density generator
- When you repeatedly add and remove densities from the same position, it leaves floating parts
- Increase Procedural Terrain Generation Performance HOT 3
- Have an ability to generate procedural cave systems with 3D noise
- If you modify the edge of the chuck the side chunk that will be generated will not connect HOT 5
- Convert this project into a Unity Package Manager package HOT 3
- Create different Biomes HOT 10
- Unable to deform certain chunks HOT 8
- Create an IncrementVoxelData function to VoxelDataStore
- Player far from origin jitter issue HOT 2
- When reloading a chunk changes made to terrain using left click and right click are overwritten HOT 1
- generate assets with mesh HOT 1
- Detect floating islands feature request
- A debugging panel
- Include NativeArray in custom VoxelDataGenerator HOT 1
- Memory is never freed
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 marching-cubes-terrain.