XNA 4.0 voxel map rendering, using noise techniques

Started by
45 comments, last by winsrp 12 years, 2 months ago
hmm... but whats the difference between Perlin Noise and Fractal Brownian Motion? I currently have my perlin function that creates noise based on frecuency lacunarity persistance, octaves and such, I have read the article, but it seems to be talking of the same thing I have,

If i grab my function and change any of the parameters on the fly it will normally show weird results on screen like cutted sections and such, and I wanted to make some parts with high mountains, and others like long beaches and maybe some with large deep oceans and stuff
Advertisement

hmm... but whats the difference between Perlin Noise and Fractal Brownian Motion? I currently have my perlin function that creates noise based on frecuency lacunarity persistance, octaves and such, I have read the article, but it seems to be talking of the same thing I have

In that case, you have have already implemented fractal brownian motion.

<rant> Some idiot once misnamed value noise + fBm as 'Perlin noise', and ever since we are stuck with people using the wrong terminology </rant>

If i grab my function and change any of the parameters on the fly it will normally show weird results on screen like cutted sections and such[/quote]
That sounds like a bug in your implementation. Changing the parameters (within reason) should always result in a continuous terrain.

and I wanted to make some parts with high mountains, and others like long beaches and maybe some with large deep oceans and stuff[/quote]
That's a slightly different problem - fBm produces fairly uniform terrain across it's entire range. I would recommend you try out Ridged Multi-fractal - I don't have a reference implementation to hand, but I'm sure you can find one.


You generally have to combine several different types of fractal to achieve the kind of variety you are looking for, though. Consider using fBm to drive some of the parameters on a ridged multi-fractal...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Thanks for the info, I do know that Perlin noise is what should be called as 1 octave, with fixed frequency and persistance, and fBm is the combination of different octals of a single funtions (being Perlin, or other), I do have the implementation of all the functions as I have the libnoise for xna on my project and includes several of this fractal functions.

Now if I change the coordinates on my fBm for perlin noise, the values are really nice and smooth, but if i change the octaves, frecuency, etc on the fly, this will produce the cutted out sections that i have described. So I managed to combine a 2D perlin fBn that i use for initial height map, with another 2d perlin fBn with different values, and do some manual addition (i still need to use the add function from the libnoise to see if i get the same result as my manual implementation) in order to get a flat ground from the first and some more rough looking hills with the second, and im using a third 3d perlin fBn to create some caves and such on the ground.

All this combined seems to look rather nice, but now I have 2 more questions

1. how do i make the sections be split in biomes, so i have have a more desert looking area, and then a more rocky area. the problem in hand is not the generation itself, as I can do it by combining severs fBm functions, but more looking at the transition between areas? move from desert to grass, to mountains, to jungle, etc, without looking like im cutting sections again, if i stop a single fBm at a given time i don´t know if the mountain for example has reach its joing point between the next biome lets say desert, and so the mountain just gets cut flat from where i stop.

2. trying a single 3d perlin fBm, to make terrain i take every value > 0 as air, and any value < 0 as land, which produces an image such as the first i posted on this post, is there a way to apply a gradient on this function, so that i get more land on the botom and more air on top, ensuring that the lower layers are full ground and the upper layers full air, and the result in the middle seems smootly round instead of a flat area?

thanks.

http://www.blueplanetbiomes.org/world_biomes.htm
I've been fiddling around with different methods of implementing biomes in my own block engine and I think the best way to do that would be to create a different noise map (or generation layer, I do like buzz words) all together for them.

Currently I have a few noise generator modules linked together like an assembly line. Each module is responsible for generating a segment of the terrain (one module does underground cave systems, another does above ground features, etc). Doing it this way allows me to easily move/toggle the generation stages and edit them in isolation. My plan for biomes is to insert another module that generates a large scale noise and then interpolate between different biome terrain modules from this.

As for collision detection, I assume that you are using a 3D array to store your terrain. A method would be to use the camera position to index into the array and check to see if the blocks they're walking into are solid or air.

To make the terrain infinite like in Minecraft, I went with a circular array that goes pretty much like this:

wrapar10.jpg

Hope this helps.
interesting bit of information, i currently can do collisions, but they seem to take quite a while, so I'm optimizing those, i had to shrink the chunks otherwise i couldn't do multiple high velocity projectiles with explosions.. after 10 concurrent projectiles the game kind of stalls at 7 fps, until most of explosions are done (and I don't even have an explosion effect yet!!, I only remove the blocks), I also make quite some memory optimization as i couldn't load too many cubes at once, only around 250K, (I'm now around 3.4M in less than 5 secs, and I can also do 7.5M blocks on screen in less than 10 secs) but my frame rate starts to slow a bit to 30 fps... so planning on optimizing this as well.

Currently I'm not advancing much as I know that if I start doing lots of stuff optimizing its going to be a pain latter, and by doing so now, I will carry all those optimization's to further stages.

I still have to make it so the maps loads as I move, but that is a really near next step now.

Thanks for all the info.

Now with that out of the way... the next question.

i don't have a model in my screen and I don't want to start learning another program such as blender, to start doing one, so I thought... why don't I make a model in game... and so the question is..

how do I make a model in code?, for example I know how to make 4 blocks on top of each other with different dimensions, but how do i make the feet move in a walk position given the following model.

[attachment=6963:model.png]

so its a head on top with a block, a body in the middle block and the 2 lower blocks are feet.

please don't mock my incredible paint skills. tx.
another quick question,

I was doing frustum culling, with the following code

boundingFrustum.Matrix = viewMatrix * projectionMatrix

So i then checked against my sections

If boundingFrustum.Contains(Section.BoundingBox) <> ContainmentType.Disjoint Then

but then it occurred to me... what if I start moving the world instead of the camera, it will make it easier for some validations that seem to be a pain in the... you know.

Instead of updating a camera position vector, I update a worldposition vector, and then do a worlmatrix.translation based on worldposition -1 (as it has to move against the camera). But now my frustum culling its all messed up.

Any ideas how can I apply frustum with world translation in place?
wow... never mind, I found out what I was doing bad!!... idiot me I had to update the section bounding box based on the new world position otherwise the world looks like moving but the bounding box of it is not... also need to update any other bounding box in the world... hmm...
no good then... ill move the camera, as moving the world will imply updating the bounding boxes of all my cubes.. and so no good. Performance hit was too big.
I seem to be having some trouble after 11 millon cubes, only around 400k faces loaded on mem (takes 22secs to load).., and i have applied as much culling as I have managed to find (actually didn't even knew what culling was till like 2 days ago)

memory collapses, even when frame rate is rather good at 60fps, it loads arrays with 700mb in memory, for all the cubes (only positions in x,y,z, color and height, and bounding box), and then it fills another 500mb with the vertex and index buffers... so I can load as much as near 13 million cubes, and it it goes over 1.6GB of ram and runs out of memory.

It seems like 1.6GB of mem is rather extensive for just some cubes... yes, lots of cubes I know, but still seems like it should be able to hold a larger amount, I was trying to get to near 20/30 million, but seems impossible.

So I was reading about instancing, but I don't know if this can be applied here. Here is a little screen.

[attachment=6976:nice world.png]
I think you would do it like, for each chunk, generate a single mesh thing and draw that instead of every cube separately. Then when you change that chunk you regenerate the mesh. And only draw faces which touch air.

o3o

This topic is closed to new replies.

Advertisement