15

Requirements You want multiple paths from A to B. You want to work in grid space, presumably this is tile space for your side-scroller. You don't want paths to cross, or it will spoil game progression. You want the paths to look reasonably organic. Voronoi Diagrams Voronoi Diagrams are space-filling, planar graphs: One nice thing about them is how you ...


15

I have been able to do this using the 3d modeling software Blender. I used UV mapping to map the texture and the displacement modifier to apply the height map. If you need some form of XNA code for this, I cannot supply it. Here it is as a 3d terrain. Surprisingly, it worked best on a uniformly square mesh. The steps required to create the terrain like i ...


13

You may be confusing some details. A height map is simply a 2D array of data. Each point represents 3 pieces of information: an x and y location and a number to represent the height at that point. For a simpler example, lets look at a 1D array of data that creates some 2D terrain. Each data point here will contain an x location and a number to represent the ...


12

Displacement mapping can mean (but doesn't always mean) a vector displacement at each point on the surface. Height mapping implies only a scalar displacement value, i.e. each point gets pushed along its normal. The term "displacement mapping" can also be used for scalar displacements, though, so when vector displacements are discussed, people often ...


11

Displacement mapping and height mapping are two names for "almost" the same technique, they aim to do the same effect but are used in different contexts. To explain more: Displacement Mapping: Is a technique that aims to render bumps as true geometry, in a very fine mesh. Unlike bump mapping, parallax, and relief mapping which tries to "fake" bumps using ...


6

Before Diamond-Square begins, you'll have to make sure the outermost boundaries (and the maximum number of potential midpoints generated therein) are set equal on either side of the map (in x and y). Only then can you begin full generation of the centre with something approaching a seamless wrap. What they meant by "consistent" is "all outermost corners and ...


5

so, to rework from comments: this is Z-fighting. The math is very well explained here: http://chaosinmotion.com/blog/?p=555, and the ways to solve it here: https://www.opengl.org/wiki/Depth_Buffer_Precision, but the gist is that Z-buffer is discrete, non-linear, and depends on the ratio of farplane/nearplane. discrete: the distance between near and far ...


5

You almost have the right idea, but actually it is much simpler than you might think. The simplest way of measuring steepness is by finite differencing: float GetSteepness(float[,] heightmap, int x, int y) { float height = heightmap[x, y]; // Compute the differentials by stepping over 1 in both directions. // TODO: Ensure these are inside the ...


5

You'll probably want to do a 2nd pass and carve caves after doing the regular quick height-map generation pass. Find a steep slope in the low-frequency height map layer (if you use multiple resolution height map layers) and dig a cave started by using the slope's negated normal. Same goes with crevices, canyons, and other terrain faults. Once you build a ...


4

In a nutshell, what makes a shallow water equation a shallow water equation is that the water height is not zero and it assumes no variation in the seafloor. Note: No fluid dynamics equation will allow for a water depth of 0, as that would mean you have no fluid. You should read the Wikipedia article on the shallow water equation. Basically, in shallow ...


4

Assuming you have translated this from the original Java code it looks like you have been a bit careless in adding brackets in a few places. For example the original code has: double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0; while you have: Dim t0 As Double = (0.6 - ((x0 * x0) - ((y0 * y0) - (z0 * z0)))) which if you remove the brackets is actually: Dim ...


4

I think your problem is mostly a matter of scale. Your height maps are way too undetailed to do anything but shoot straight out to sea. They are more like small islands than entire vast continents. You would have to make them many times more detailed, then use some noise to distort them a bit more, to get some interesting rivers. Then I would take the ...


3

The error is in the slide, the correct implementation is: for (size_t i = 0; i < N; i++) { for (size_t j = 0; j < M; j++) { size_t n = i * N + j; size_t a = i == 0 ? i * N + j : (i-1) * N + j; size_t b = i == N-1 ? i * N + j : (i+1) * N + j; size_t c = j == 0 ? i * N + j : i * N + (j - 1); size_t d = ...


3

Note: I'm gonna use the term "pixel" here to refer to a unit of land in your height map. I'll assume your definition of noise are groups of land pixel are that smaller than certain size and you want these removed (turned into water). In that case, a simple method may be just counting the total number of connected pixels (size) for each group of land pixels(...


3

Here are four options that you can try: A) Scale & threshold existing output You can ensure that the gradient saturates at some maximum value before reaching any of the cell borders. This will tend to make small holes of uniform size, but you can introduce size variation by assigning a random scale factor to each seed point and scaling distances to ...


3

A hill like this could be created with the following algorithm: Start with a small circle in form of a regular n-gone (the mountain top). Create a larger "blob" on height 0 by taking the corner-vertices of the previous circle and move each one further away from the center by a random distance. every few iterations, interpolate new vertices on straight ...


3

It looks an introduction to linear algebra is in order, or more precisely the dot product: dot(a, b) = |a| |b| cos(Theta) Why is it helpful? Because of its relation to the scalar/vector projection, the length of projection of vector a onto vector b is lenPA = |a| cos(theta) or more practically, derived from dot product definition: lenPA = (a . b) / |b| ...


3

You told it to set the scale to zero when you wrote textureRender.transform.localScale = new Vector3(); That's because a new Vector3 is initialized to (0,0,0). Scale is multiplied, so "no change in scale" is represented by the value of 1 (not zero), so you probably meant to set the scale to (1,1,1), so you'll need to write new Vector3(1,1,1). ...


3

Here are two different ways I might approach this problem, showing how they change as the effect intensity is cranked up & down. The outermost column on each side is just my gradient, computed as a function of the vertical position y, from 0 to 1: gradient(y) = 1 - 2 * abs(y - 0.5); The next column inward is my noise sample, varying with intensity ...


3

So it looks like my problem was in the float32 height(const std::vector<char>& data, const int width, const int height, uint32 x, uint32 z) function. Casting the char to an unsigned char before casting it to a float32 fixes the issue. Thanks to @DMGregory for pointing me in the right direction.


2

We did implement huge terrains in Unity5 by processing SRTM data for the whole earth into height-maps for TerrainData objects with different Levels of Details[1]. There are a couple of things to consider: The very edges of the height maps need to overlap by at least one sample and you need to position your terrains accordingly. Terrain.SetNeighbors will not ...


2

You can use the slopes between vertices instead of the triangle normals to average the vertex normal. This could be easily ported to the GPU if you have vertex shader texture fetch support. Gottfried Chen sums it up here with code: http://www.flipcode.com/archives/Calculating_Vertex_Normals_for_Height_Maps.shtml


2

3D carving can be done with Surface extraction of a 3D density field. Then you can reduce the values in the dinsity field and so dou can carve your hole. Examples for this is marching cubes, or dual conturing. The problem is, that heightmap polygons and polygons generated with surface extraction are not that easy to mix together. Either you only use surface ...


2

Basicly it's all the same method. You have a texture at the same size of your grid. lets go with your 1024x1024. that would be ideal to have a grid that is 1024 x 1024 then. The first thing you do is to get a pointer or some access to the texture, so you can iterate over it. The second thing you do is to have access to the vertex buffer. from there you ...


2

They are the same concept. EDIT: Displacement can be composed of heights in more than one dimension! Don't start any semantic wars over this, but realistically, height mapping usually refers to large scale / tessellation based techniques, where displacement mapping usually refers to small scale / raytracing techniques.


2

It looks like when you apply the displacement map, you're pushing vertices out along the face normal of the underlying mesh? Instead of using the face normal, you should use the smooth vertex normal - which means you will need to interpolate across the face from its vertex normals. Smooth normals will match across edges automatically, so displacements ...


2

I believe you can use bilinear interpolation on the heightmap data. (I suppose, you have your heightmap as 2D raster of heights) Get floating point position fX, fY in your height map. This is something like: float fX, fY; float fHeightMapWorldSizeX, fHeightMapWorldSizeY; float fHeightMapWorldOffsetX, fHeightMapWorldOffsetY; int iDimHeightMapX, ...


2

I suggest you change the way you render your vertices instead of trying to merge them. You are using immediate rendering. While good for debugging and proof of concept, it is "deprecated", and not a preferrable way to render when it comes to performance. You have several alternatives, but the most versatile and robust way I would recommend is using Vertex ...


Only top voted, non community-wiki answers of a minimum length are eligible