heightmap

Threejs deform mesh from heightmap

假如想象 提交于 2019-12-08 05:45:25
问题 How can I go about deforming an already created mesh with a heightmap in three.js? I did a few searches and couldn't find anything, so I'm asking here. 回答1: You are lucky, three.js-r72 introduced vertex displacement in the MeshPhongMaterial . You set the displacement map like a normalMap : var displacementMap = THREE.ImageUtils.loadTexture( "textures/ninja/displacement.jpg" ); var material = new THREE.MeshPhongMaterial( { color: 0x0a0100, //... displacementMap: displacementMap,

Issue with Terrain Collision using Three.js

一笑奈何 提交于 2019-12-08 03:49:07
问题 I have created a terrain via a heightmap in Three.js and am using mrdoob's misc_controls_pointerlock for collision and movement. However, when I do objects.push(terrainobj); the performance goes down to about 3fps (from around 60) and there is no collision with the terrain. The collision is achieved via rays. How can I get around this? 回答1: If it's just a heightmap you could avoid using ray and do the collision checking right in the bitmap (using canvas and imagedata). You just need to

How to translate Tiff.ReadEncodedTile to elevation terrain matrix from height map in C#?

心不动则不痛 提交于 2019-12-08 03:30:32
问题 I'm new with working with reading tiff images and I'm trying to get the elevation terrain values from a tiff map by using LibTiff. The maps I need to decode are tile organized. Below the fragment of the code I'm using currently to get these values, based on the library documentation and research on the web: private void getBytes() { int numBytes = bitsPerSample / 8; //Number of bytes depending the tiff map int stride = numBytes * height; byte[] bufferTiff = new byte[stride * height]; // this

Normal averaging of heightmap

时光毁灭记忆、已成空白 提交于 2019-12-06 15:16:21
问题 i have the following code for calculating Heightmap normals void CalcMapNormals(HeightMap * map, Vec3f normals[]) { int dst, i, j, right, bottom; Vec3f p0, p1, p2; Vec3f n0; /* Avoid writing map->rows|cols - 1 all the time */ right = map->cols - 1; bottom = map->rows - 1; dst = 0; for (i = 0; i < map->rows; i++) { for (j = 0; j < map->cols; j++) { Vec3Set(normals[dst], 0, 0, 0); /* Vertex can have 2, 3, or 4 neighbours horizontally and vertically */ if (i < bottom && j < right) { /* Right and

Issue with Terrain Collision using Three.js

瘦欲@ 提交于 2019-12-06 15:01:49
I have created a terrain via a heightmap in Three.js and am using mrdoob's misc_controls_pointerlock for collision and movement. However, when I do objects.push(terrainobj); the performance goes down to about 3fps (from around 60) and there is no collision with the terrain. The collision is achieved via rays. How can I get around this? If it's just a heightmap you could avoid using ray and do the collision checking right in the bitmap (using canvas and imagedata). You just need to convert your XZ world position to the XY pixel in the heightmap. Then, if your Y position in the world is lower

Render horizon silhouette using Metal in SceneKit

邮差的信 提交于 2019-12-05 22:19:27
I'm working on simple side project and small part of it is rendering a terrain. I'm rendering the terrain using height map information. But here is my problem: I would like to render just a silhouette/outline of the terrain/horizon. Here is screenshot from my app rendering height map: And here is screenshot similar to desired result from peakfinder.org: I would like to draw just lines representing silhouette of terrain with the rest transparent or solid colour. How can I solve it? Calculate local maximum somehow? I created sample project here , in case you want to help me. Thanks! 来源: https:/

Tweaking Heightmap Generation For Hexagon Grids

拟墨画扇 提交于 2019-12-04 15:03:27
问题 Currently I'm working on a little project just for a bit of fun. It is a C++, WinAPI application using OpenGL. I hope it will turn into a RTS Game played on a hexagon grid and when I get the basic game engine done, I have plans to expand it further. At the moment my application consists of a VBO that holds vertex and heightmap information. The heightmap is generated using a midpoint displacement algorithm (diamond-square). In order to implement a hexagon grid I went with the idea explained

WebGL - Textured terrain with heightmap

◇◆丶佛笑我妖孽 提交于 2019-11-30 08:47:39
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 which is almost what I want. The problem is that they create the colour of the mountains and the height

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

With C++ and Qt how do I display a 16-bit raw file as an image?

独自空忆成欢 提交于 2019-11-29 11:57:21
I am looking to display heightmaps from the video game Battlefield 2 as images in my application. I am new to C++ and Qt and it might be straight forward but what I am having trouble with is displaying a grayscale 16-bit 1025x1025 2101250 bytes image. There is no header to the file. I need access to the displayed pixels (does not have to be pixel perfect precision) so I can point to a pixel and get its value. What I have tried I have loaded the binary data into a QByteArray from a QFile and I have attempted to use the QImage::fromData function to make the image but I am making a lot of