vanruesc / rabbit-hole

An experimental voxel engine.
zlib License
46 stars 10 forks source link

LOD Terrain example. #24

Closed gigablox closed 6 years ago

gigablox commented 6 years ago

Really love the work you've done here. I'm trying to get going with this in a current project, having difficulty understanding how to do basic things like generate/update LOD for something like a game landscape.

Any examples you might have laying around for doing things like this: https://github.com/felixpalmer/lod-terrain

Would be massively helpful in the integration process.

vanruesc commented 6 years ago

Hi,

I'm glad you like it!

Originally, this project was a pure research project that focused on the feasibility of using a voxel system in the browser and on mobile devices. Unfortunately, it's still incomplete and not fit for production. That's also why there's no release yet. However, I want this project to eventually reach a state where it can be used in games.

The development process thus far has actually been rather painful, to be honest. With lots of trial and error, many components of the system had to be reinvented multiple times. On the plus side, the foundation of the library has become very solid. In fact, I'd say it's pretty close to completion, but there are still a few tough problems to solve, namely geometry clipmapping, seam patching and texture mapping.

This library is an independent system that is not tied to any rendering framework. As such, it provides the facilities to organize volume data but doesn't keep the generated geometry around. It's necessary to create framework-specific clipmap implementations that communicate with rabbit-hole to organize and prepare the generated geometry for rendering.

With such a framework connector, one would render a terrain as follows:

import { VolumeManager } from "rabbit-hole"; // Currently called Terrain.
import { GeometryClipmap } from "rabbit-hole-three"; // Doesn't exist yet.

const volumeManager = new VolumeManager(options);
const terrain = new GeometryClipmap(volumeManager);

scene.add(terrain.object);

(function render() {

    requestAnimationFrame(render);
    terrain.update(camera);
    renderer.render(scene, camera);

}());

Apart from that it would be ideal to also implement a volume data persistence mechanism using the IndexedDB API to improve memory management before the v1.0.0 release.

Regarding the issue of texturing procedurally generated geometry, I'd like to explore ways to implement voxel-based UV-mapping, but until then one would have to resort to tri-planar texture mapping.

I'm currently busy with other projects and can't spend time on this library. Once things have settled down, I'd like to revisit it, but I have no idea when that will be. I might work on it in my spare time every now and then, though.

gigablox commented 6 years ago

Thank you for putting time into your explanation. I think the work you're doing here is really cutting edge and has the potential to help the WebGL game market space grow.

vanruesc commented 6 years ago

Closing due to inactivity.

A LOD terrain example is already planned and will definitely be added as soon as the underlying facilities are fully implemented.