Hot answers tagged

45

There are couple of things you can do to increase drawing performance. You said they were pretty far away. You could use LOD to decrease the vertex count of those trees, and thus decreasing time required to go through all the vertices being drawn. Even though this is most likely not the issue at hand (GTX1080 with just 10k trees with 200 tris each, puny ...


39

In the real world, those provincial borders will often be following geological features like rivers. So maybe a good approach would be to model the geology of the island and have the borders fall out of this? Red Blob Games has some good articles on this subject, with nice looking results. His approach seems to involve using Voronoi tessellation, and ...


27

I would solve this problem with two passes of Voronoi diagrams: First Pass: Region Partitioning The first pass would use a somewhat sparse distribution of points (i.e. the distance between the points should be relatively large) in order to roughly divide the island into regions (see the note below regarding point generation). Next generate a Voronoi diagram ...


15

You want to mix different wave lengths with different levels of intensity. E.G. Have one long wave, that has a high intensity, and a short wave with low intensity. Now add the two(or more) waves together. Black line being long waves and high intensity. Red line being short waves with low intensity. Green being the final result. float getHeight(float x) ...


13

You are ONLY generating Perlin noise. This is actually the same as using only one octave, at any frequency. You can base yourself to implent FBM (Fractional Brownian Motion), It is actually what all engines use to make Perlin noise more fractal looking. Bringing it down to code, you can use it like this: //pseudo code function fBm(float x, float y, float z,...


13

Ok, so the problem was simply that I wasn't using pre-computed realtime GI. I check that on a little while ago but it didn't have an immediate effect so I left it and forgot about it, and the lighting processing time was so long too. However, it just finished processing it, and my word, my fps has jumped up by 3x. So for now, I'll leave it at that and in the ...


12

1 : I can't understand at which point down the Chunked LOD pipeline that the mesh gets split into chunks. Is this during the initial mesh generation, or is there a separate algorithm which does this. It does not matter. For example, you can integrate the chunking into your mesh generation algorithm. You can even do this dynamically, so that lower levels are ...


12

Basic chunking is a good way to start. You can move to more sophisticated data structures like octrees later, if you need. For now, simply divide your terrain into chunks of given dimensions when loading the model from disk. Depending on your data, you might either want to split your terrain into pillars on a plane spanning the full height, or in cubes in ...


11

Castle Story looks like this due to technical constraints: Were there to be a heightmap per each voxel in the entire volume, rather than only a heightmap per each surface voxel, storage cost would be vastly greater, on the order of O(n^3) which can be prohibitive, as opposed to a more favourable O(n^2), where n is the side length of a cubic voxel space ...


11

One simple way is to use something like the midpoint displacement algorithm. It can be used to generate terrain, lightning, clouds, and other things as well. (It's a bit old, but easy to understand.) It would also be possible using a Fourier Transform to add in various frequencies at various amplitudes to generate terrain. Some systems, such as liquid flow,...


9

If I understand right, your map stores whether something is dirt or air, and the simplest thing would be to have dirt and air tiles. However, to make things look better, you have separate images for air above dirt, dirt above air, dirt left of air, and so on. So you're trying to figure out which image to use, given a tile and its neighbors. Is that right? ...


9

Check out Amit Patel's excellent article that I feel is kind of a quintessential resource for procedural generation of terrain... http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ The key thing he does is use graph structure to model his terrain, not straight up noise maps (Perlin et al). I won't embed his illustrations, ...


6

Just a quick note about voxel landscapes. It is a wide field and there are a variety of representations and algorithms for display. Heightfield voxel terrain: stored as a heightmap, but rendered with vertical strips rather than polygons. Check out "Outcast" Cuboid terrain: I believe stored in terrain chunks as run-length encoded strips. Displayed as a ...


6

When rendering terrain, for efficiency you usually want to reduce the level of detail of geometry in areas far from the camera. As the camera moves around, you would adjust the level of detail to keep the area near the camera at high detail. Geomipmapping, geometry clipmaps and suchlike are ways of managing this on the CPU. Although the GPU always does ...


6

You need Terrain as it allows you to add vegetation (Trees & Details), make adjustments to the relief like rise land to form mountains and also it gives you ability to paint textures on it. A plane is a simple game object that can only be scaled on two axes and none of the above can be done with it. They are both rendered only on one side of the object. ...


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 ...


6

I have little experience using Unity directly, but I've been a level designer for years and a much easier approach rather than worrying about cutting holes into your terrain is to simply build up a C shaped ridge in your terrain for the size of your cave and then cover it with rock meshes to give it the illusion of a cave. Another approach is that you ...


6

In addition to what Pikalek said, it's also known as the Midpoint Displacement algorithm (because you perturb the midpoints of each edge) or Diamond-Square algorithm when working with a square instead of a triangle.


6

Storage of destructible terrain For the terrain I would recommend looking at the quadtree data structure. It provides an efficient way to store destructible terrain. For an excellent, in-depth explanation, see Coding Challenge #98.1: Quadtree - Part 1 by The Coding Train. The core idea of a quadtree is that you don't need to store every individual pixel. ...


5

You can generate your surface as height map (2D table of heights, regular grid). It might look like this http://mrdoob.github.com/three.js/examples/webgl_geometry_terrain.html You probably don't need physical simulation, so you just find the height at certain coordinate and check, if your model is above it /under it. That is only the basic idea and I am ...


5

One good option is to use something larger than pixels and use marching squares to create smooth terrain. The server and client only talk to each other in grid terms, thus reducing bandwidth. The client is responsible for running marching squares and interpolating the grid into a smooth terrain. However, all the collisions and terrain interactions use that ...


5

Create class to encapsulate your chunks that will behave like virtual 2D array. Each time you need X:Y tile, that class would find correct chunk and correct local position inside it. For example, if your pathfinding wants 101:206 tile, that class would find 1:2 chunk and return 1:6 tile from it. For entities, you may need spatial partitioning structure. ...


5

There's a good source for that here Currently the free ones (with source) are: Infi-Chunk Stacker CubeField MetaBalls ChunkRenderer Voxel Terrain Marching Squares 2D Free Terrain 3 Terrain Generator Cubic World


5

Most perlin noise algorithms will allow you to retrieve the noise value at any given location, with something like noise(x,y,z). This makes it fairly trivial to generate noise on a chunk by chunk basis. All you need to do is pass the global position, instead of the chunk position. for(int i = 0; i < CHUNKMAX_X; i++) for(int j = 0; j < CHUNKMAX_Y; ...


5

Marching cubes is an algorithm for polygonizing an implicit surface - i.e. one defined by an equation of the form f(x, y, z) = 0. You can evaluate any function f(x, y, z) you like, and the algorithm tries to make a polygonal model of the surface formed by the points where the function is zero. I haven't looked at the source code, but from the screenshot, ...


5

I create random map scripts for Age of Empires 2. My most recent one is for the HD version. If you're looking to understand how to create maps for Age of Empires 2, there is this excellent guide to RMS (Random Map Scripting). Age of Empires uses an expert system, allowing scripts to write routines for the generation rules, which you can learn a lot from. ...


5

I think the obj file format is what you need. OBJ is pretty commonly used in 3D graphics, and it's a text file. You will need to walk through your mesh properties and write your own file. Then you'll be able to load and display it.


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

Non sequitur, your question does not entirely make sense. You cannot store infinite chunks. You can only ever store the subset that is currently of interest, i.e. those around the player(s). So how does the infinite part work? You generate chunks according to some global function. For example, Minecraft's use of Perlin noise (a global function) means that ...


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