Divine Voxel Engine - Voxel Engine Made With Babylon.js - Alpha 1.0 Out Now

I have been rather busy last month or so. I officially started working at Bitreel as a senior developer. I will say I am open to work involving BJS just it has to be an ethical, viable, and reasonable project.

Anyway so I added a really cool feature to DVE called “custom substances”.
With that I was able to add magma and another transparent substance for things like chains.


Here is the code to register the two new substances:

SubstanceManager.registerData([
 {
  id: "#dve_magma",
  tags: [
   ["#dve_parent_substance", "#dve_liquid"],
   ["#dve_rendered_substance", "#dve_liquid"],
   ["#dve_is_solid", false],
   ["#dve_is_liquid", true],
   ["#dve_flow_rate", 3],
   ["#dve_culled_substances", ["#dve_liquid", "#dve_solid"]],
  ],
 },
 {
  id: "#dve_translucent",
  tags: [
   ["#dve_parent_substance", "#dve_flora"],
   ["#dve_rendered_substance", "#dve_solid"],
   ["#dve_is_solid", true],
   ["#dve_is_liquid", false],
   ["#dve_flow_rate", 0],
   ["#dve_culled_substances", []],
  ],
 },
]);

So as you can see you can specify the substances “parent”. Its parent will define all culling and AO behavior. You can also define the substance that it is rendered as. Meaning you can define the actual mesh/material it belongs to.

With that you can add a custom rendered susbtance like this:

DVER.nodes.substances.add(
[
 {
    "dve_custom_substance",
    material: {
     alphaBlending: false,
     alphaTesting: true,
     backFaceCulling: true,
    },
    texture: DVER.nodes.textures.addTextureType( "dve_custom_substance"),
    shader: DVER.nodes.shaders.createVoxelShader("dve_custom_substance"),
    mesh: {
     materialId: "dve_custom_substance",
     boundingBoxMaxSize: [16, 16, 16],
    },
   }
]
 )

And lastly I got different dimensions working properly for DVE.

ezgif-1-f7bf86b836

So DVE is pretty much ready to go to beta no problem. The API is pretty much finalized. There will be less breaking changes in the future.

I am still working on the pixel entity program as well. I made it so you can change the UV cords for each face for the entity and the program itself is getting kinda complex with UI but it will be worth it in the end.

Hopefully soon I will release the newest version of Dream Space Infinite which has many bug fixies and vastly improved player controls.

There is an epic amount of other stuff that I’ve done with the DVE plug ins and other libraries that it uses that I just don’t have the time or energy to discuss. If I am not posting for a while probably cause I am deep in the trenches working on something big.

Thanks again everyone and feeling rather grateful for all the BJS community has brought to me.

7 Likes

You continue shooting into the stars with this incredible work :heart: And glad to see you bringing these amazing skills to the Bitreel team!

1 Like

The bitreel ream is lucky to have you !!!

1 Like

So, I have been busing working on a game that I hope to have out in the next month or so.

This is just a video of 4 computer players vs each other. They are little dumb right now but I am working on making them smarter.
The game is multi player over WebRTC too.
It has full controller support and I am finally using the babylon GUI for the HUD display.

It takes place in the Dream Space Infinite universe. As Dream Space Infinite grows and evolves so will this game.
I just realized it is going to literally take me years to finish Dream Space Infinite and I still have a lot to learn in terms of actually releasing a game.
So, I am considering this to be my “the hobbit” and dream space infinite is the full “lord of the rings”.

It of course is using DVE. The levels though are pre-generated and only the mesh data is loaded in.

Also I am using thin instances/voxel entities for all the crystals and event tokens.

If you are curious this how I was able to rotate the thin instances only using the world matrix:

  this._matrix.position.x = -this.piviotPoint.x;
  this._matrix.position.y = -this.piviotPoint.y;
  this._matrix.position.z = -this.piviotPoint.z;

  
  if (this.rotation.x) {
   xRotationMatrix.rows[1].y = Math.cos(this._rotation.x);
   xRotationMatrix.rows[1].z = -Math.sin(this._rotation.x);
   xRotationMatrix.rows[2].y = Math.sin(this._rotation.x);
   xRotationMatrix.rows[2].z = Math.cos(this._rotation.x);
   this._matrix.multiply(xRotationMatrix);
  }
  if (this.rotation.y) {
   yRotationMatrix.rows[0].x = Math.cos(this._rotation.y);
   yRotationMatrix.rows[0].z = Math.sin(this._rotation.y);
   yRotationMatrix.rows[2].x = -1 * Math.sin(this._rotation.y);
   yRotationMatrix.rows[2].z = Math.cos(this._rotation.y);
   this._matrix.multiply(yRotationMatrix);
  }
  if (this.rotation.z) {
   zRotationMatrix.rows[0].x = Math.cos(this._rotation.z);
   zRotationMatrix.rows[0].y = -Math.sin(this._rotation.z);

   zRotationMatrix.rows[1].x = Math.sin(this._rotation.z);
   zRotationMatrix.rows[1].y = Math.cos(this._rotation.z);
   this._matrix.multiply(zRotationMatrix);
  }

  this._matrix.position.x += this.position.x + this.piviotPoint.x;
  this._matrix.position.y += this.position.y + this.piviotPoint.y;
  this._matrix.position.z += this.position.z + this.piviotPoint.z;

But anyway I will be making two threads soon. One asking if anyone wants to beta test the game and the next will be for the official release of it.

Thanks again everyone!

5 Likes

Loooooks great !!!

I have to say it loud: @lucas-divinestar is the best !!!

1 Like

I’m back. I have been on a crazy journey the last 6 months or so. But I have gown immensely as a developer and I am using my new perspective to upgrade Divine Voxel Engine.

Web GPU Gen

The coolest thing I am working on now is WebGPU based voxel world generation and light propagation.

This also did the sun light I just turned it down to make it look cooler.
The entire scene only takes 10 seconds to create and read back into memory. While normally a scene like that would take 3 minutes or more to generate.

The only lack of speed now is the CPU based chunk building.

I have never wrote a compute shader so this is my first try. But I was able to do what I wanted.

I still have a bit to go in terms of bringing in all the nuances of the world gen and light updates of the engine into the shader but it should not be that hard. I thought it was impossible at first now I feel like anything is possible lol.

If anyone does know a seed based Perlin noise 3d function for WGSL that would be awesome though.

New Repo & Packages

I have updated the main repo to be a full mono repo for the engine and associated packages. I am trying to work towards having a babylon level of quality for the repo and code base in general.

Newest Expose

Video I made showing off the newest version of the “dream space”.

Game I am developing using the engine.
https://crystallinebliss.dev/beta/

Plans For 2024

  • Implement fully into engine web gpu voxel world generation and lighting
  • Add react three fiber style library to use DVE with React.
  • Add support for web XR
  • Fully implement an Entity Component System
  • Add scene imports and exports
10 Likes

Holly c…, that is a hell of an update !!!

The Webgpu generation is so cool :slight_smile:

1 Like

I just wanted to share it going a lot faster now:

This is all the time it takes to generate, run sun light, run rgb light, load back into memory on the cpu, and then create a mesh. Only about 20 seconds for an entire 256x128x256 area. While it would normally take something like 3+ minutes all cpu side.

The shader now is pretty big:

So, a few important things I did:

  1. Ported a seeable perlin noise generation to the GPU so I do not have to change world gen at all.
  2. Create system to process all voxels at once for a given region to create a template that can be quickly meshed.

So tnow the engine can take full advantage of cpu meshing and the same perlin noise that I think most devs are used to.

I have not seen anywhere online anyone using compute shaders in this way so this all experimental but so far I am happy with the results.

I know there has been papers on other techniques though using shaders: A Ray-Box Intersection Algorithm and Efficient Dynamic Voxel Rendering | NVIDIA Real-Time Graphics Research

Just its way more difficult when you want to use textures, vertex shader effects, and more. If I just wanted pure color voxels this would be much simpler but having the ability to add any shape to the chunk mesh adds many layers of complexity. Cause then its not just cubes anymore lol.

I am holding off on adding any GI or ray tracing until I see a good example with no visual errors working. I think that may be a year or more still I have no idea.

3 Likes

Absolutely crazy stuff as always :slight_smile:

1 Like

Mind-blown GIFs - Get the best GIF on GIPHY

1 Like

Congrats everyone on releasing BabylonJS 7!
I upgraded the other day and everything is working great.

I should be making a new thread in a few months as DVE is finally coming out of alpha into beta!

I just wanted to share some screen shots of the new stuff I am working on.

PBR Rendering

I am developing a new renderering system for DVE using Babylon’s PBR material system and so far it is going great! I got real time reflections working with SRR to and got some decent looking water. I was also able to move all glowing voxels to their own meshes and use the glow layer.


Magic Voxel & New Packages

So first let me explain that I have broke apart DVE into several packages:

  • @divinevoxel/core | Abstract interfaces and utilities.
  • @divinevoxel/foundation | The original set up for DVE. MC like with AO and lighting.
  • @divinevoxel/magic | Magic voxel parser and integration.
  • @divinevoxel/babylon-renderer | Renderer for DVE using babylonjs.
  • @divinevoxel/three-renderer | Renderer for DVE using threejs.
  • @divinevoxel/react-three | DVE integration for React Three Fiber.
  • @divinevoxel/quantum-renderer | Custom experimental renderer using Web GPU.

I decided I am going to take DVE in a some what of a new direction. I would like to develop different types of voxel engines as well. I think the idea of being more or a less a set of general purpose voxel engines/voxel tools that could be used in a wide variety of projects would be amazing.

This is my first magic voxel scene that I got parsed and rendered using my new experimental web gpu renderer. The scene is rendered in a compute shader. There are only two triangles.

Ray marching is something I’ve been exploring for a while. I just would like to credit Inigo Quilzs work for making it possible.

Though the ray casting algorithm for the voxel data is different then sdfs it uses them for the lighting and effects. There is still some work that needs to be done to. I would love to add textures, materials, and maybe different shapes.

Plexus Editor



I am building a program from scratch with Babylon and React to make it easy to develop games for DVE. Mostly it will be used for creating hand made and procedurally generated scenes.
I am developing a plugin system for it so it more expandable as well. But that will have its own set of libraries. The reason I am developing this is I’ve found getting content into voxel games to be the hardest thing. It is hard to manage all that data in a coherent way and making changes can break many things.

Crystalline Bliss

Also for my game Crystalline Bliss I recently released multi player and I am working on a new game mode and levels. This is a rough draft of a new level. I am getting more into Blender too and made the being in the chair. I can’t say much more cause don’t want to spoil anything.

Thanks again everyone and keep up the amazing work! I am excited for the future of web 3d!

10 Likes

This keeps delivering !!! it is insane

1 Like

Beautiful landscape work!

How well-suited would this architecture be, for multiple discrete voxel-based models? Say, an asteroid belt - on a scale of hundreds or even thousands - instead of a landscape?

Each model instance would be free-floating driven by a physics imposter based on some sort of computed collision geometry, so it would need to be responsive to a dynamic root transform node on the CPU.

1 Like

Hello thank you for the question.

So, what I think you would have to do in this case is mesh each asteroid as its own discrete mesh and then handle it yourself.

There is a system in @divinevoxel/foundation for the default builder/mesher to create custom processors. You could write a custom asteroid masher to create a mesh for the asteroid and then do with it whatever you want.

Now handling the voxel data for the asteroid itself is a whole separate thing. If you want to update the asteroids you would need a way to translate pick points to the voxel space of the asteroid.

Also the handling the voxel data for the asteroids may be difficult as well. If you did not want to write your own system maybe each asteroid is just a dimension in the world data or a specific section of the world.

If you see maybe that there is some other features that could help make that happen I do have an issue for people to submit things they want:

I will say though I will be posting updates hopefully soon but I just re-wrote the mesher and redid a lot of the libraries the engine is built with and moved them to a new github org.

I recently parented up with someone and we are going to be building a site with a few multi player voxel games using the engine so I am trying to make it as polished and reliable as possible.
I thought for a while about re-writing the core of it into WASM but after really digging in and doing a lot of fined grained optimizations its really fast. WASM has a lot of quirks too that just would make development a lot harder. Still need shared array buffers for multi threading so not much benefit there either.

1 Like