Author Topic: Voxelarium.js  (Read 18372 times)

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Voxelarium.js
« on: May 24, 2016, 05:09:12 am »
I got tired of the C# port already :)  (never did finish actually implementing the game portion of it... just water)

Started a new javascript/three.js version...

https://d3x0r.org:444/javascript/Voxelarium.2

click and drag; 's' enables moving scaling, it's not very good... faster than scroll wheel though

it's actually broken into separate files on the source side; fed through 'browserify' to make it simple to load on the web page.... but you can save the page and have all the sources; soon to make a github branch for it

(the mode buttons don't do anything any more; I also did a test ... https://d3x0r.org:444/javascript/test3d )

(although it's more inspired by, and plajurizing a couple algorithms like sectorSphere :)

Enigma

  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
Re: Voxelarium.js
« Reply #1 on: May 26, 2016, 06:00:52 am »
Hi D3x0r, glad to have news from you...

Quote
I got tired of the C# port already :)  (never did finish actually implementing the game portion of it... just water)

We understand that.

Unfortunately, video games are kind of program that requires a tremendous work.

Quote
Started a new javascript/three.js version...

https://d3x0r.org:444/javascript/Voxelarium.2

click and drag; 's' enables moving scaling, it's not very good... faster than scroll wheel though

it's actually broken into separate files on the source side; fed through 'browserify' to make it simple to load on the web page.... but you can save the page and have all the sources; soon to make a github branch for it

(the mode buttons don't do anything any more; I also did a test ... https://d3x0r.org:444/javascript/test3d )

(although it's more inspired by, and plajurizing a couple algorithms like sectorSphere :)

That's a pretty interesting example. I guess it's using WebGL capability of the browser.

There's a lot of things to do with modern browser capabilities.  :)

The Blackvoxel Team

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Voxelarium.js
« Reply #2 on: May 27, 2016, 10:43:11 am »
Updated....

Dug a little and found TI-99/4a Font; nice 8x8 bitmap font from my first computer :)

Have meshing working; no culling; and can output strings in voxel clusters :)

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Voxelarium.js
« Reply #3 on: May 28, 2016, 12:17:00 pm »
https://github.com/d3x0r/Voxelarium.js

requires https://github.com/d3x0r/three.js/tree/matrix_relative_rotation_addition

for development Electron is used(required?), so require() works.  (http://electron.atom.io/)
for building node is required, for browserify...  Browserify does have a -d option to make the output more debug friendly (and chome detects debug information)... (https://nodejs.org/en/)

and Atom for a javascript editor (works OK it's a little ... flaky) http://atom.io
« Last Edit: May 28, 2016, 12:23:33 pm by d3x0r »

Enigma

  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
Re: Voxelarium.js
« Reply #4 on: June 01, 2016, 05:27:00 am »
That's Nice.

The 8 bit fonts are well in the Blackvoxel style. (Don't forget Blackvoxel is in one word  ;))

And that's remember good old days of early personal computing when we where young...

As we are programming rarely with Javascript, we can't help you about what are the best tools and libraries to use with it.

We'll go to look at your github as soon as we'll have some little time.

The Blackvoxel Team

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Voxelarium.js
« Reply #5 on: June 01, 2016, 06:39:37 am »
Just posted for reference; going to start some smaller projects, next one's the editor.  I created like 50 lines with "some server name here"  "player 0/3"  "Ping 333"  and that meshed and rendered quickly.

I want to move away from flat GUI tech; because it's VR/3D unfriendly... and tinkering with that I guess I coudl just voxelize the words and move the camera up/down to get a list...

Need to work on inventory/hotbar stuff for editor... and then browsers don't really have localStorage either so some sort of server to save changed sectors....

I'll fix the demo name before all of that. Kinda soon...

three.js is a good inbetween; it handles meshes, computed min/max volume automatically and keeps objects in a scene so it can do full-sector sort of clipping; each object is one mesh; which is basically a few call lists (solid, transparent and custom) so that fits pretty good...  was even able to leverage some normal map effects etc on the texture in addition to glow... I render the face flat without glow, and render the edges to a glow buffer to apply a blur/extend of the bright edges.  I was trying to get very clever and render to a offscreen render target (like the glow is done), with a depth buffer, so I can clip the depth of the glow (without rendering the faces, the are transparent, so glow lines show up from the back... need to maybe just turn on one sided rendering too (kinda defaults to lazy mode)

Was thinking it might be a neat demo to do an old computer's boot (timex sinclair maybe?) that becomes like the intro level with the text as voxels on a background layer... maybe make it curved the the monitor :)  (probably wouldn't work out well)

Beyond that there's issues to tackle like WebAudio, and physics... Ammo.js is a port of bullet physics for instance (kinda overkill) there's another engine Cannon.js that's really popular, but its default objects are too.. squishy; they behave more like sponges than solid things... there's anther small engine (some 300k) called Oimo which has more rigidity; but also causes shapes to pop more on even small penetrations...   

Not expecting anything from anyone, just posting information; and I know noone does javascript;  Who would do Javascript?  that's a web script kiddy language!  Ya... well, it has evolved over 20 years and is actually more usable than java.   There's Node.JS which is a console-based runner for javascript; it's fairily easy to write hooks to create c++ objects from javascript using Node.JS modules you can just hook native code, which could include opening an SDL window and everything else that is Blackvoxel *shrug*  I wrote some modules that node.js could use to create frames using my library (SACK - sack.sf.net)

I also write a script language processor called dekware ( dekware.sf.net )  which was utterly simple; but conceptually can be refit to be native javascript and use javascript as the language with some extensions and instead of being some class of object itself.. I dunno I think I can get the object persistance to work in a distributed platform between multiple clusters of server nodes even but that's a entirely different project :)

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Voxelarium.js
« Reply #6 on: June 05, 2016, 09:05:11 pm »
Need to dig out the how-to-find-face logic... I'm actually finding the cube reference so it replaces instead of adding...

updated demo page; first page takes a few seconds to load now.... could maybe have some optimizations.

the glow effect is bleeding through though... still need to figure out frame buffer targets with depth buffer.  I erased some cubes internally; a consequence of selecting a cube not a face :)   (going to fix that before updating the edit demo page (click 'editor' on first page)   
« Last Edit: June 05, 2016, 09:07:16 pm by d3x0r »

Enigma

  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
Re: Voxelarium.js
« Reply #7 on: June 08, 2016, 02:37:18 am »
We like very much the nice glowing effect caused by transparency  :)

About Javascript, if this environment is what meet at best the goals you want to reach, that's what matter.

Writing program always means doing choices. Whatever you choose these will always end up to be criticized ;)

Of course, languages aren't same. Each have their particular pro and cons. But we know you are aware of that. :)

The Blackvoxel team.

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Voxelarium.js
« Reply #8 on: October 12, 2016, 10:46:19 am »
I have some updates and news :)

I've been working on WebVR; and 3d controller support.  I have a single sector loaded that I can walk around, and that's kinda satisfying.

I don't really have pictures... and it's somewhat unstable.   I can't use my glow shaader in AltSpace VR (Free Social platform which supports all devices including 2d displays; err your desktop. )

I have it loading there which is almost like WebVR... but entirely not.

still actually working out controls; and I noticed in AltSpace that the controls are still hooked to their game engine, and I need to see if there's a can't default behavior;

and I had to fallback to conventional textures; but 90fps in javascript with lots of room to spare :) 


Enigma

  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
Re: Voxelarium.js
« Reply #9 on: October 12, 2016, 09:32:00 pm »
I have some updates and news :)

I've been working on WebVR; and 3d controller support.  I have a single sector loaded that I can walk around, and that's kinda satisfying.

I don't really have pictures... and it's somewhat unstable.   I can't use my glow shaader in AltSpace VR (Free Social platform which supports all devices including 2d displays; err your desktop. )

I have it loading there which is almost like WebVR... but entirely not.

still actually working out controls; and I noticed in AltSpace that the controls are still hooked to their game engine, and I need to see if there's a can't default behavior;

and I had to fallback to conventional textures; but 90fps in javascript with lots of room to spare :)

Hi d3x0r, glad to hear some news.

We have also worked on the idea of making a VR version at the Rift availability some time ago. Unfortunately, the VR universe was rather immature about different hardware support and standard API interfaces. But things will come in it's time.

About fps, what we can say as we have done a lot of tests with different machines, with voxel there could be huge difference between graphic cards,  operating systems and drivers. Some systems can get well over 1000fps on the blue flat area(with nVidia hardware). Some aren't really fast despite some powerfull hardware. Some hardware will struggle with unsorted textures. Some have limited capacity with shaders. Some drivers/platforms don't support some OpenGL features.

Ps : A new Blackvoxel version will get out soon...  ;)
« Last Edit: October 12, 2016, 09:43:00 pm by Enigma »

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Voxelarium.js
« Reply #10 on: October 28, 2016, 04:46:48 am »
I did some experimenting with building presorted voxels.... which seem to apply pretty fast.

This was part of the C# work; but basically I made a linear list of the closest points of sectors that are to the [upper/0/lower][left/0/right][forward/0/backward]

I just went through each point(voxel) and figured it's distance from the respective point, and then sorted the resulting indexes; so I could have an ordered list of voxel indexes for transparent things that are outside of 'here' which is the 0/0/0 center point...

And really to be more accurate any sector that is on a 0 needs to be sorted based on the slice of other coordinates... blah I'm over-complicating this.

For 'here' the sort list has to be dynamically computed; there's too many combinations to keep them all pre-set; well maybe sub-sectors could be made that could be pieced back together as 'close enough' ...

so anyway then it's just foreach( index in list ) { mesh voxel[index] based on drawinfo }   instead of just voxel based on offset... this will then add the faces to the draw list in the right order... (and maybe that's kinda what your sorter does; I just kinda wanted to implement it, because when I tried it with a bunch of semi transparent blocks it broke down because of how it serially stepped - without regard to which side the player was from the sector being meshed.

Why don't I get notifications? I end up having to just come back and read? I'm pretty sure I put in my email right?

Enigma

  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
Re: Voxelarium.js
« Reply #11 on: October 31, 2016, 04:34:46 pm »
I did some experimenting with building presorted voxels.... which seem to apply pretty fast.

This was part of the C# work; but basically I made a linear list of the closest points of sectors that are to the [upper/0/lower][left/0/right][forward/0/backward]

I just went through each point(voxel) and figured it's distance from the respective point, and then sorted the resulting indexes; so I could have an ordered list of voxel indexes for transparent things that are outside of 'here' which is the 0/0/0 center point...

And really to be more accurate any sector that is on a 0 needs to be sorted based on the slice of other coordinates... blah I'm over-complicating this.

For 'here' the sort list has to be dynamically computed; there's too many combinations to keep them all pre-set; well maybe sub-sectors could be made that could be pieced back together as 'close enough' ...

so anyway then it's just foreach( index in list ) { mesh voxel[index] based on drawinfo }   instead of just voxel based on offset... this will then add the faces to the draw list in the right order... (and maybe that's kinda what your sorter does; I just kinda wanted to implement it, because when I tried it with a bunch of semi transparent blocks it broke down because of how it serially stepped - without regard to which side the player was from the sector being meshed.

Why don't I get notifications? I end up having to just come back and read? I'm pretty sure I put in my email right?

The purpose of actual "rendering sorter" in Blackvoxel is mainly to avoid too many texture changes. Some GPU shows important performance improvements with this.

Sorting "by distance" is only made on sector rendering level... but not for each voxel in the sector.

Sorting by distance for each face in the sector would be dependant of the player's point of view. But this would implies that the work could have to be redone (at least on some sectors) each time the player's point of view will change.

In Blackvoxel, "semi transparent" rendering like "tinted glass" is made on an extra separate rendering pass. As faces aren't sorted in a sector, this could end up to rendering transparent textures in the wrong order.
It's could be surprising... but that's not a problem. As long as the textures are sufficiently transparent... it's blending correctly in any order. Of course, there is a drawback : this won't work correctly with texures with too much (or very different levels of) opacity. Sorting faces would make it better for this case. It's a matter of choice between pro and cons.

I've checked for notifications, it's active on the forum and it's working ok : we get it ourself. Yes, you have filled an email address. Check your email in your profile and also the "spam folder" at your mailbox.

The Blackvoxel Team
« Last Edit: October 31, 2016, 04:37:13 pm by Enigma »