Tag Info

Hot answers tagged

15

Split the terrain into square "chunks", load those you care about (mostly: Those near the currently active camera) in Update() and - if you are strapped for space (you likely will be), unload the not needed ones far away. Use pre-calculated low-poly models for far-away terrain LoD, unless you don't mind having a low view distance. Also, if you need the ...


14

What is great with images is that they usually embed up to 4 channels (red, green, blue and alpha). As an height map needs only one dimension, you could just use the red channel to store the height informations (you still have 256 levels for the height), and then use other channels for other purposes (like using the green channel to map the roads, blue ...


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


10

I don't think you should try converting the entire map into a single height map, exactly because of the problem you described. Maps can have arbitrary complexity which you wouldn't be able to represent in a height map. But you don't need to have a fixed slope for each type of tile either. You could store collision information on a per pixel basis for each ...


6

The problem is that you can't use a simple Sample() call in the vertex shader as it doesn't know what mipmap level to sample from, so the data coming back can't really be a float 4 and the call just doesn't really make sense. In the pixel shader, you need to use: float4 offset = HeightMap.SampleLevel(HeightSampler, input.Texcoord, 0); Changing to that ...


6

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


5

This will really depend on your requirements. How many levels of height are there. Just a few? Hundreds?. Top down? First person? Limit of 1 character per tile or can you use several. What is the terminal size 80x23? or is it going to be resizable. On devices with limited CPU power like a graphic calculator or more beefy modern computers. Text in console ...


5

At the GGJ '11 in Berlin one team developed a game using a globus that was freely rotateable. They made the game and the entire source available. It was made in C# and even XNA if I am not mistaken, so this might be a good reference for you. Check it out here. The download link is beneath the group's picture.


5

You should end your spriteBatch before doing any 3d drawing. Always keep 2d and 3d drawing separate. By the way, why are you even beginning & ending the spritebatch if you're not drawing any 2d? Within a spritbatch begin/end, XNA sets various renderstates for 2d drawing. Often these aren't best for 3d drawing... especially if you're using XNA 3.1. In ...


4

Sprite batches tend to overwrite some render states. Try to set device.RenderState.DepthBufferWriteEnable = true; and device.RenderState.DepthBufferEnable; manually. Hope that helps.


4

ASCII games are really nothing more than just tile-based games that use character glyphs instead of pictures of what they really represent. In general, height fields do not work well in tile-based games. Not unless it's in some kind of perspective view. Height fields generally are used for 3D terrain. When your palette of tiles is limited to whatever ...


3

Maybe I'm not seeing the whole picture, but can't you just the apply the border (by setting those values to 0 / water) after normalizing? And I suppose you're normalizing correctly e.g: [0,1] = ([-1,1] + 1) * 0.5 Some aditional ideas... last time I generated something like this, I used probabilities and a random number generator. I simply choose the ...


3

What you have seems like a lot of work to put your avatar on the terrain at a given point. Here's the method I use to calculate terrain height. Simple pass in your X and Z coordinates and it will return the terrain height. In this case, the scaleFactor you pass in should be 150. Given something like this you just pick two pairs of X,Z coordinates, get the ...


3

Although it seems others also gave some answer (i don't know why in comments), here's my experience: there is a physics simulation problem known as heat flow/heat equation. That link gives you the whole idea about what you are going to simulate in that problem. and there are many ways to create an optimized version of that simulation (just need a little ...


3

You'll need to break up the terrains in chunks, ie. several smaller terrains. Yo'll need to 'seam' those agains eachother (with a script) so there won't be 'holes' between them but otherwise you can just start doing them right away. You might want to know too that since Unity3D ~3.0 you can't move items (read terrains and items) too far away (like +/-100000 ...


3

Look closely at your own illustration. What you've drawn here is a single two-dimensional array. Make an array of size [MapWidth*2+1, MapHeight*2+1] and store everything there. Elements where both coordinates are even will hold corners, where both coordinates are odd will hold tiles, and the rest will hold borders. You'd have to have a common base class for ...


3

Performance-wise, both options should be equivalent since everything will be converted to a model sooner or later. Heightmaps: +Easy to store and edit +Easy to calculate texture coordinates if they're not precalculated -Poor texturing on steep surfaces -Needs companion models for better detail -Does not allow overlapping terrain (no overhangs). Models: ...


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


3

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


2

From your question I infer that you're trying to seed the border/shore of the island. You might want to do that if it's important that the island's shape is fairly circular, otherwise there's no need. But what you do have to do is seed a point (the highest) inside the island and few points (the lowest) outside the island. The rest will arrange itself. To ...


2

Yes, it's very possible. I found though that making a true orbital camera was rather confusing. It was better to leave the Y (Up) axis locked and stop the camera at the poles. Otherwise it was easy to get disoriented. Google around for orbit cameras. Back when I was working on something like this, dhpoware's sample was useful. This old one might be ...


2

The borders will store a game object and accessing corners from only border info would be also required. Keep a pointer/a reference to the corners in the border object? Do the same for tiles and borders? Maintaining such a linear array of borders is definitely doable - you just need to separate vertical and horizontal borders. Then you can take ...


2

Whether you go with the torus option or not, you will need to do some wrap around, which will be the root of all the problems you will need to solve. However, they’ll be easier to address on a torus. The idea is that your world is a grid that repeats itself along both the X and Y axes. Position wrap around When an object’s X or Y position goes over 1.0f ...


2

You seems to render without depth test on. This might make triangles further away render on top of closer triangles since they might be rendered afterwards. The solution is to turn on depth testing in your render setup and set the depth compare function to Less or LessEqual. Remember to turn on depth write too if you happen to have that turned off.


2

Rolling your own is nice, since then you can just create maps, without needing to supply an image, or at least make the image optional. I use Perlin noise in my voxel game for terrain generation. It works pretty well, but is fairly plain compared to the maps that Minecraft produces. I imagine Notch does a lot more than just Perlin noise. In my game I use ...


2

It sounds like you might want bicubic splines. In particular, since you have two endpoints and a tangent vector at each endpoint, Hermite splines would be appropriate. To expand, if you have the heights of two adjacent points, h0 and h1, and the normal vectors of the heightfield at those points, n0 and n1, here is how you'd do the interpolation. This ...


2

It's easy to improve on the height computation. For simplicity I will consider that the size of a square is 1; you can always get back to this case by switching coordinates: x A ^ z ,'| | ,' | | ,' | M' | ,' M x | ,' x | | ,' | x'------------x-----> x B C Let ...


2

It might help if you told us what genre the game is, what the camera sees, etc. I assume you're talking about an FPS but I'm not sure. Anyway, here's a link to a talk about the terrain in Halo Wars that I found interesting and may give you ideas: http://www.gdcvault.com/play/1277/HALO-WARS-The-Terrain-of . It deals with some of the issues and possible ...


2

What's the resolution of your terrain mesh? You're sampling the texture directly with the worldPos x & z vals: if you have a vertex every 1 unit, you'd get the same texture value each time as it's only the fractional part that's used. See if dividing the vals has any difference, e.g.: float elevation = tex2Dlod(HeightmapSampler, ...


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



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