vanruesc / rabbit-hole

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

Linear Sparse Voxel Octrees #25

Open vanruesc opened 6 years ago

vanruesc commented 6 years ago

The VoxelOctree is currently a pointer-based construct that doesn't allow non-power-of-two octree sizes. This restriction should be removed.

To accomplish that goal, most of the linear octree code from the world octree submodule should be moved to the external sparse-octree module. Afterwards, the VoxelOctree can be refactored into a linear octree more easily.

Benefits:

proton2 commented 5 years ago

Sorry, but I can'not run Demo in Contouring mode. It write:

Error Log

```sh three.min.js:490 THREE.MeshPhysicalMaterial: 'clearCoat' is not a property of this material. setValues @ three.min.js:490 three.min.js:490 THREE.MeshPhysicalMaterial: 'clearCoatRoughness' is not a property of this material. setValues @ three.min.js:490 index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/skies/interstellar/px.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. px.jpg:1 Failed to load resource: net::ERR_FAILED index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/skies/interstellar/nx.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. nx.jpg:1 Failed to load resource: net::ERR_FAILED index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/skies/interstellar/py.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. py.jpg:1 Failed to load resource: net::ERR_FAILED index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/skies/interstellar/ny.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. ny.jpg:1 Failed to load resource: net::ERR_FAILED index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/skies/interstellar/pz.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. pz.jpg:1 Failed to load resource: net::ERR_FAILED index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/skies/interstellar/nz.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. nz.jpg:1 Failed to load resource: net::ERR_FAILED index.debug.html#contouring:1 Access to image at 'file:///C:/Programming/voxels/rabbit-hole/public/demo/textures/height/03.png' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. 03.png:1 Failed to load resource: net::ERR_FAILED textures/skies/interstellar/px.jpg /C:/Programming/voxels/rabbit-hole/public/favicon.ico:1 Failed to load resource: net::ERR_FILE_NOT_FOUND ```

vanruesc commented 5 years ago

@proton2 Thanks for letting me know!

Looks like this was caused by a breaking change in the latest version of three. I've just updated the demo so it should be good to go in a minute.

proton2 commented 5 years ago

And volume editor need to check...

vanruesc commented 5 years ago

The volume editor is just a skeleton and is not functional at the moment. I'd like to complete that at some point but I'd need to work on other parts of the library first to make that happen.

Unfortunately, I currently don't have enough time to work on this project because work takes priority.

proton2 commented 5 years ago

In contouring heightfield mode not worked next options: resolution, level mask, scale. I changed values in menu, but nothing happend in landscape. May be it my mistakes. Please, check this behavior.

vanruesc commented 5 years ago

Try clicking on the contour button again after changing the settings.

proton2 commented 5 years ago

How can I see LOD working? Changing errorThreshold value in menu and click on contour button again?

vanruesc commented 5 years ago

How can I see LOD working?

The demo currently doesn't include a demonstration of LOD because the library is not yet ready to produce continuous meshes across adjacent volume cells. The main problem with that is seam patching.

The errorThreshold controls the global accuracy of the generated geometry. It basically tells the contouring algorithm when it's ok to merge mesh vertices. LOD is an additional system that defines the layout and sizes of volume cells around the observer. Volume cells that are farther away are bigger but use the same resolution as closer cells. This naturally results in coarser geometry in the background. LOD is also directly related to the problem of generating continuous meshes.

proton2 commented 5 years ago

The only successful implementation of LOD that I met is https://github.com/nickgildea/leven it is indicated in your Bibliography. But these sources are difficult to understand. I did not see the real implementation of LOD on Dual Contouring anymore. Nickgildea also had difficulty with stitches.

vanruesc commented 5 years ago

I did not see the real implementation of LOD on Dual Contouring anymore.

This library currently doesn't include a clipmap/LOD implementation. I scrapped my early LOD system because of various issues that prevented the project from moving forward.

The old implementation also relied on the rendering framework three for the representation of geometry data. My plan is to implement the geometry management in seperate projects via clipmap interfaces. That way, the library won't be tied to a single rendering framework.

The only successful implementation of LOD that I met isleven. But these sources are difficult to understand.

I'm also having a hard time understanding the clipmap code from leven. But it's more about understanding the concept, I'd say.

proton2 commented 5 years ago

Do you know this project? https://github.com/Lin20/BinaryMeshFitting I compiled and launched it with great difficulty. LOD and transitions between levels of detail look very beautiful. Generally without seams! Some more sophisticated technology is being used. Unfortunately, the site https://voxelspace.net/ does not open in my country to read more details. The way LOD looks on the screen amazed me. Much prettier than https://github.com/nickgildea/leven Unfortunately I can’t find your email anywhere to show you what beautiful LODs are in this demo.

vanruesc commented 5 years ago

No, I haven't come across this project yet, but I think I've seen its predecessor PushingVoxelsForward before. Thanks for the tip!

The idea of storing volume data in binary form sounds really interesting. I've actually been planning on replacing the current contouring implementation with Manifold Dual Contouring. Lin20 has another interesting project that also deals with that technique in more detail.

You can use vanruesc@outlook.de to send screenshots if you'd like. GitHub also supports image attachments in issue tracker comments.