Add terrain heights
This commit is contained in:
parent
3e6504d6b0
commit
d2987d07c4
5 changed files with 108 additions and 98 deletions
|
|
@ -84,9 +84,6 @@ export class CustomMapHeightNodeShader extends MapHeightNode {
|
|||
new MeshPhongMaterial({
|
||||
map: MapNode.defaultTexture,
|
||||
color: 0xffffff,
|
||||
transparent: true,
|
||||
opacity: 1.0,
|
||||
depthTest: true,
|
||||
})
|
||||
);
|
||||
|
||||
|
|
@ -109,7 +106,7 @@ export class CustomMapHeightNodeShader extends MapHeightNode {
|
|||
material
|
||||
);
|
||||
|
||||
this.frustumCulled = false;
|
||||
this.frustumCulled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,9 +144,10 @@ export class CustomMapHeightNodeShader extends MapHeightNode {
|
|||
vec4 _theight = texture(heightMap, vMapUv);
|
||||
float _height = ((_theight.r * 255.0 * 65536.0 + _theight.g * 255.0 * 256.0 + _theight.b * 255.0) * 0.1) - 10000.0;
|
||||
|
||||
// Apply height displacement
|
||||
vec3 _transformed = position + _height * normal;
|
||||
|
||||
// Vertex position based on height
|
||||
|
||||
|
||||
gl_Position = projectionMatrix * modelViewMatrix * vec4(_transformed, 1.0);
|
||||
`
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue