terrain

WebGL - Textured terrain with heightmap

左心房为你撑大大i 提交于 2019-11-29 12:14:24
问题 I'm trying to create a 3D terrain using WebGL. I have a jpg with the texture for the terrain, and another jpg with the height values (-1 to 1). I've looked at various wrapper libraries (like SpiderGL and Three.js), but I can't find a sutable example, and if I do (like in Three.js) the code is not documented and I can't figure out how to do it. Can anyone give me a good tutorial or example? There is an example at Three.js http://mrdoob.github.com/three.js/examples/webgl_geometry_terrain.html

Three.js - multiple material plane

被刻印的时光 ゝ 提交于 2019-11-28 22:05:28
I'm trying to have mutiple materials on a single plane to make a simple terrain editor. So I create a couple of materials, and try to assign a matetrial index to each vertex in my plane: var materials = []; materials.push(new THREE.MeshFaceMaterial( { color: 0xff0000 })); materials.push(new THREE.MeshFaceMaterial( { color: 0x00ff00 })); materials.push(new THREE.MeshFaceMaterial( { color: 0x0000ff })); // Plane var planegeo = new THREE.PlaneGeometry( 500, 500, 10, 10 ); planegeo.materials = materials; for(var i = 0; i < planegeo.faces.length; i++) { planegeo.faces[i].materialIndex = (i%3); }

Perlin Noise generation for terrain

萝らか妹 提交于 2019-11-28 15:13:46
I'm trying to implement some source code I found online to generate a height map using Perlin Noise. I've successfully managed to get the height map using the noise3 function, with the third coordinate being a random "seed", to allow for random height maps. My problem is that the terrain generated is rather dull - I want mountains and I'm getting rolling grassland. I've done some reading up on Perlin Noise (mostly here ). Due to the source code I've found obviously not written with readability in mind and my weak grasp on the concept of Perlin Noise in general, I can't figure out what I need

Random 2D Tile-Map Generating Algorithm

半城伤御伤魂 提交于 2019-11-28 13:54:53
问题 Can anyone tell me a way to generate island structures or hill structures like in minecraft? I'm just searching for a proper THEORY for that random-shape generating, but it should keep a defined base pattern.. like: islands schould be rounded but variate in shape and scale ( min/max width & height ). or: rivers schould not be straight lines, they should have curves and a random width. or even: generating some sort of forest, where trees are placed in a way that the user can still walk through

How to project a rectangle onto a Mesh/Terrain object, for use as a select marquee? (in three.js)

此生再无相见时 提交于 2019-11-28 09:46:08
问题 I have a terrain which was generated using the THREE.Terrain library. I'd like to be able to click and drag out a marquee and select objects that are on the surface of the Terrain Mesh. Currently I am detecting the start and end of the drag, and drawing out a rectangle in the global XZ plane, but I'd prefer it to be flush with the surface. Currently it looks like this; However what I am aiming for is something more like this; I am wondering if I have missed some obvious way of doing that with

OpenGL - How to calculate normals in a terrain height grid?

吃可爱长大的小学妹 提交于 2019-11-28 03:43:05
My approach is to calculate two tangent vectors parallel to axis X and Y respectively. Then calculate the cross product to find the normal vector. The tangent vector is given by the line that crosses the middle point on the two nearest segments as is shown in the following picture. I was wondering whether there is a more direct calculation, or less expensive in terms of CPU cycles. You can actually calculate it without a cross product, by using the "finite difference method" (or at least I think it is called in this way). Actually it is fast enough that I use it to calculate the normals on the

Basic Dual Contouring Theory

断了今生、忘了曾经 提交于 2019-11-28 03:36:42
I've been searching on google, but cannot find anything basic. In it's most basic form, how is dual contouring (for a voxel terrain) implememted? I know what it does, and why, but cannot understand how to do it. JS or C# (preferably) is good.Has anyone used Dual contouring before and can explain it briefly? Mikola Ok. So I got bored tonight and decided to give implementing dual contouring myself a shot. Like I said in the comments, all the relevant material is in section 2 of the following paper: Original Version: http://www.frankpetterson.com/publications/dualcontour/dualcontour.pdf Archived

Hide contour linestroke on pyplot.contourf to get only fills

北城余情 提交于 2019-11-27 19:26:06
I have a pet project to create images of maps, where I draw the roads and other stuff over a contour plot of the terrain elevation. It is intended to plan mountain bike routes (I have made some vectorial drawings by hand, in the past, and they work great for visualization). Currently, I download Digital Elevation Model, in GeoTIFF, from here: http://www.ecologia.ufrgs.br/labgeo/arquivos/downloads/dados/SRTM/geotiff/rs.rar and then create the plot with GDAL and Matplotlib contourf function: from osgeo import gdal import matplotlib import matplotlib.pyplot as plt from pylab import cm import

Three.js - multiple material plane

橙三吉。 提交于 2019-11-27 14:25:30
问题 I'm trying to have mutiple materials on a single plane to make a simple terrain editor. So I create a couple of materials, and try to assign a matetrial index to each vertex in my plane: var materials = []; materials.push(new THREE.MeshFaceMaterial( { color: 0xff0000 })); materials.push(new THREE.MeshFaceMaterial( { color: 0x00ff00 })); materials.push(new THREE.MeshFaceMaterial( { color: 0x0000ff })); // Plane var planegeo = new THREE.PlaneGeometry( 500, 500, 10, 10 ); planegeo.materials =

Perlin Noise generation for terrain

寵の児 提交于 2019-11-27 09:05:49
问题 I'm trying to implement some source code I found online to generate a height map using Perlin Noise. I've successfully managed to get the height map using the noise3 function, with the third coordinate being a random "seed", to allow for random height maps. My problem is that the terrain generated is rather dull - I want mountains and I'm getting rolling grassland. I've done some reading up on Perlin Noise (mostly here). Due to the source code I've found obviously not written with readability