V P U

Just thinking about a hypothetical "VPU", or Voxel Processing Unit.


It would only require 16 instructions:

NOT - bitwise NOT of register. 

OR - bitwise OR of register. 

AND - bitwise AND of register. 

ADD - register addition with register. 

SUB - register subtraction with register. 

MUL - register multiplied with register.

RS11 - right shift register 11 bits. 

RS13 - right shift register 13 bits. 

RS8 - right shift register 8 bits. 

ZSUB - zero subtracted from register. 

AND255 - register AND 255.

256SUB - 256 subtracted from register. 

ADD256 - 256 added to register. 

SUB256 - register subtracted 256.

JELZ - jump if equal or less than zero. 

JEGZ - jump if equal or greater than zero. 

A total of 23 variables are used in calculations so they could be loaded into a 32 general register system at the start with a final pixel colour returned. 


Alternatively a RISC-V approach can be taken. First registers are constants:

register0 = 0

register1 = 256

register2 = 255

register3 = 8

register4 = 11

register5 = 13

register6 - 31 = variables. 

This way every instruction involves two registers, thus making next instruction logistics easier. 

Now there are only 9 instructions. 

NOT, AND, OR, ADD, SUB, MUL, RS, JELZ, JEGZ. 

Adding a POPCOUNT instruction will allow me to decompress terrain data at a ratio of 32:1 in realtime! Big thanks to high school friend Daniel Dennett for that breakthrough. 


This only works for integer based systems:


Heightmap of elevation data.


Move the heightmap right one pixel. Subtract this heightmap from the original to give this:

This is the relative displacement of the terrain. 



Emboss the original heightmap:



Select the dark area and fill with red, invert the selection and fill with blue:


Black pixel = add 0

Red pixel = add +1

Blue pixel = add -1

If travelling in the opposite direction:

Black pixel = add 0

Red pixel = add -1

Blue pixel = add +1

Over 90% of this heightmap is one bit data. The relative data allows for run length encoding if more compression is needed. 

Now I can run 32 threads and not worry about going over the browsers 1.5 GB memory limit. I can also run 8 Orange Pi Zero 3 microcontrollers for a $160, 32 thread machine. 

The best thing about voxels is I can do a "3d" BitBLT. This allows me to perform some really cool effects, that are simple to implement and are on a massive scale. I can also simulate a 3d page flipping system by superimposing two worlds on top of each other. By changing a single bit I can perform a pseudo 3d flip instantaneously. 



In 2004 when I was exploring uses for "world flipping" I envisioned a time travel effect similar to the Doom "melt" effect. Replacing the current 3d world with a future 3d world. Just finished watching Silent Hill on DVD and realised I could easily replicate the school morphing into the coal mine with a simple Cellular Automaton. Only just scratching the surface of voxel power.


Because this has been a 30 year hobby,the cost of running 8 machines per year is $100.

 Just finished one hour testing batches on a dimensity 7020. Running 5 threads at 100% used 8% battery charge with no drop in performance. The phone remained at room temperature for the whole hour. Extremely good results, no more testing required. The space leaper is a rough approximation and the actual space leaping system could yield another 50% performance boost. 

Moving the iso-surface extractor out of the renderer for a non-multiply 3D rendering engine. This will reduce the number of variables in the renderer and reduce garbage collection. Javascripts window.location.replace function has given me a theoretically infinite number of 3D engines, all I have to do is copy the file and rename it. Change the name of the image file and I have just created a new 3D world and all the 3D models. This is the best thing about javascript, I love it! Just finishing "mo-cap" library with $200 phone!

Comments

Popular posts from this blog

MATH

HARDWARE

C64 IN 3D