Symmetrical perlin noise
Hi all! I have problem with a perlin noise. It generates strange symmetrical shapes:
My code:
float landscape = Mathf.PerlinNoise(settings.lanscapeXScale * x * settings.sizeOfBlock + settings.landscapeSeed, settings.landscapeZScale * z * settings.sizeOfBlock + settings.landscapeSeed)*settings.landscapeInfluence;
if (settings.mountainsFrom < landscape / settings.landscapeInfluence)
landscape = 1.0f;
float height = Mathf.PerlinNoise(settings.heightXScale*landscape * x * settings.sizeOfBlock + settings.heightSeed, settings.heightZScale*landscape * z * settings.sizeOfBlock + settings.heightSeed);
Hard to see from your code what the actual numbers are, since they are all stored in variables, but if you start from say (-10, -10) and go to (10, 10) on $$anonymous$$athf.PerlinNoise() then you may face symmetrical shapes. Try starting from (0,0) and going to(20, 20) then taking 10 away from the x and z coordinates of each block.
Also, I'm working on block based terrain at the moment, if you find an efficient way to stop unity lagging from way to many gameobjects let me know.
@OllysCoding You shouldn't use the in game cube-models. I don't think the occlusion culling will work correctly and thus it will render all sides of all cubes although they're not visible to the player (need confimation on this).
You should also use chunks, and only create chunks that are visible to $$anonymous$$imize the number of cubes/blocks in the world at one time. Chunks are grid parts of your overall world terrain. So the world might be 128x128x128 and consist of 64 ((128/32)^3) 32x32x32 chunks and you would only ever have the visible chunks rendered/created at any time.
To make creation and deletion of terrain work anywhere acceptable you should pool (reuse) all your gameobjects (so ins$$anonymous$$d of e.g. instantiating/destroying new/old terrain you move the position of all cubes in one chunk to new positions in another chunk).
Regarding OPs question you are probably right, there is a looping of the values somewhere.
I am looking into chunks and what not. Occlusion culling will not work anyway because there are NPC's wandering off camera doing jobs assigned by the player.
I guess a complex chunk system will be the best option...
Look at the documentation for the $$anonymous$$athf.PerlinNoise function. $$anonymous$$y guess would be you're not working in float space. An example would be: pX = transform.position.x + x / chunkWidth, pY = transform.position.y + y / chunkHeight.
Answer by kubas0707 · Mar 13, 2016 at 09:07 AM
Perlin noise is symmetrical for positive and negative values. Solution was to add huge number to coordinates of perlin noise.
Your answer
Follow this Question
Related Questions
Mathf.PerlinNoise does not work 0 Answers
How to make Perlin Noise Seemless on a sphere? 1 Answer
Following the trail of Perlin Noise random movement? 1 Answer
Calmp gradient between 0 and 1? 0 Answers
Array with pushing values? 0 Answers