Comments (4)
generateBlendedMaterial
was written as a demo in 2014, basically a copy of the Lambert material in Three.js r67. 5 years later, at Three.js r107, generateBlendedMaterial
has not kept up. But as much as I'd like it to work well for everyone, it's not the focus of this library, and I'm not actively developing THREE.Terrain anyway, so I don't expect to be the person who changes that.
The good news is that there's actually not that much that generateBlendedMaterial
does. It's basically just a copy of Lambert material with a small edit to interpolate colors. So if you want to explore doing something similar with a different base material, hopefully it wouldn't be too much work. I would certainly accept a PR 🙂
from three.terrain.
MeshStandardMaterial supports displacements maps:
.displacementMap : Texture
The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh.
and displacementScale.
Additionally it supports normal maps, enabling nicer looking textures with directional lights.
I believe the functionality of terrain generation could be implementation by creating a set of 2d noise and using that as the displacementMap of a Standard material on a plane.
I have yet to play with it, but I plan on doing so.
from three.terrain.
THREE.Terrain
supports exporting the generated terrain to an image. This image can be passed to the THREE.Texture
constructor to create a texture that can be used for a MeshStandardMaterial.displacementMap
. That won't help with blending materials but it's a roundabout way to get a terrain shape. The caveat is that you lose some precision, because displacement maps have only 256 possible values for each pixel, whereas terrains generated the normal way can place vertices at any height. This can be noticeable if your camera is closer to the ground than about 4% of the terrain's height range.
from three.terrain.
Thanks to #29 for making it possible, I just pushed a change to allow passing a material instance as a second parameter to generateBlendedMaterial
. You can now do something like generateBlendedMaterial(textures, new MeshStandardMaterial())
and it will use a standard material as the base. No guarantees that everything will work as expected, but it doesn't seem to break anything!
from three.terrain.
Related Issues (20)
- Object shadows (in ver 100) HOT 7
- Texture Repeating HOT 1
- Typescript bindings? HOT 18
- Feature request: button to download geometry HOT 1
- Possible mismatch in randomness HOT 1
- Meaning of parameters of generateBlendedMaterial? HOT 2
- BlendedTerrain problem HOT 1
- Island with a hill, how? HOT 2
- Large memory consumption, why? HOT 2
- Support disabling rescaling in Clamp to avoid seams with repeating Perlin/Simplex terrains HOT 17
- physics support ? HOT 1
- I m facing error using your library HOT 2
- Edges Documentation HOT 1
- Calculating heights between segments (Interpolation) HOT 3
- Wrong variable name in scatter.js HOT 1
- Implement Optimizations HOT 1
- could it load real terrain? HOT 1
- Get heights from generated terrain HOT 1
- Noise Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three.terrain.