How to increase the performance of this minecraft style terrain?

The code is here:

game v3.html (28.6 KB)
three.js (1.2 MB)
perlin.js (10.2 KB)
PointerLockControls.js (3.1 KB)
stats.js (3.7 KB)

And the textures is here, locates in ‘textures’ folder:

bottom
side
top
trunk

Why this script is gone laggy? Any solution? Thanks anyway…

1 Like

And a capture:

I decided to abandone shadows because are more laggy having it than without having it. So I preffer to focus on the performance settings.

And its it which more trees:

If shadows creates every frame, then you can turn off autoupdate shadow, and update shadows every section pass for example 50 meters

Im working on performance, not in shadows actually…

With basic materials… its any solution for the performance?

Maybe if use custom shader instead basicMaterial, then it save 1-5 fps

One for example?

EDIT: I tried this:

const material = new THREE.ShaderMaterial( {

uniforms: {
	time: { value: 1.0 },
	resolution: { value: new THREE.Vector2() }
},

vertexShader: document.getElementById( 'vertexShader' ).textContent,
fragmentShader: document.getElementById( 'fragmentShader' ).textContent

} );

But textContent is undefined by both of two.

  • Textures can be 4-bit and no aliasing.
  • One stratification is to merge geometry and weld vertices. Seam reduction may also benefit occlusion culling. But if destructible terrain is a caveat, perhaps an inner barrier layer occludes draw distance.
  • Render can be 1/8 resolution with minimal quality loss. And letterboxed with engaging plot narrative.
  • Does FPS improve without collisions? Block noise size seems steep.

Any progress,
Path tr8sktr

1 Like

If not instanced mesh.

let vs=`
varying vec2 vUv;
void main(){
gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);
vUv=uv;
}`;
let fs=`
uniform sampler2D map;
varying vec2 vUv;
void main(){
gl_FragColor=vec4(texture2D(map,vUv).rgb,1.0);
}`;

-Render at 1/8 is same laggy than 1 pixel radius rendering.
-Textures at 4-bit is same.
-Noise must be high because i want mountains and valleys.
-Aliasing isnt applicable for textures with my actual knowledge of threejs.

But at least the game looks better now, without clashes:

Here are your credits:

Y tried to replace vs to verticalShader, etc. and it didnt worked.

  • Hollow terrain removes many blocks. Set internal block (1y > top y, 4xz ≥ sides ) material transparent, from texture or raycast.
  • texture map nearest-neighbor does not filter

How? I tried to remove blocks, and i only gained this:

IDK how to place blocks, so… i cant do more…

Anyway, i decided to make my own 3d version of starve.io and dont take anymore on impossible proyect for me.

There are my proyect folder zip.
v41.zip (274.4 KB)

After removing blocks is FPS faster or more stable? Every screenshot shows 60FPS. If you identify the bottleneck is internal blocks, then removing (or setting transparent) 80% unused internal volume helps, and you can refine it. But otherwise collisions are the culprit of resource hogging.

The game mechanic of Minecraft is volumetric digging, but that’s assuming you have a pickaxe.

Nah, my project now is a 3d singleplayer game like starve.io, but with minecraft square system. You have an screenshot here:

Nice more block variety.