CODE
"The prevention of tyranny and the restoration of order is just" WUTZU THE MASTER,The sayings of WUTZU.
CORE 2D
A multi canvas multi core renderer
The multi canvases stacked on top of each other.
core1. js
core2. js
core3. js
Code Editor by Rhythm Software
HTTP Server by Phlox Development
Output from Code Editor
Output from Edge for Android
Output from Opera fullscreen
Offscreen canvas is working and will give a performance boost
This is the worker file
And this is the output
Will be alot less code as well as faster rendering.
I have been waiting for offscreen canvas for a decade. Writing to the canvas with a context in a web worker feels so weird. But I should get a noticeable increase in rendering speed.
I like how simple it turned out to be. Just edit the canvas in the worker and the main thread canvas gets updated. This is so cool. Coolest API ever!
Navigator getGamepads was originally going to be eventhandler based. Instead they went for time slice of axes and button states. W3C Developers making such simple solutions. Now I ask myself "How would W3C do it?"
Optimized CORE 2D
index.html
core1.js core2.js core3.js
Animated canvas2d running on 4 threads.
The performance increase is definitely noticeable. MAYBE A 300% INCREASE! This is a FAST 2d engine. Have tested each worker individually and everything is working(pun) fine. This is definitely an advanced API that will keep canvas2d enthusiasts very happy. The 3d code should not take long to add.
Really impressed with Android, a nice OS to work with. Running this on my overclocked i7 would give 60-120 fps. May be able to raycast shadows and reflections at 30 fps.
Each worker now has a 3d spritesheet.
3d engine added successfully to main thread, worker threads will be easy to add.
Beacause the CPU's run in parallel I am looking at the final framerate which is smooth. Very happy with this new technology.
DuckDuckGo and Yandex performance is 200% faster than Opera, Edge, Chrome, and Firefox. The latest updates for the other browsers have greatly improved performance. Surprised by Yandex results. Latest DuckDuckGo update pushes it ahead, very smooth.
*Update* First Duckduckgo update of 2024 just dropped, another 10% performance increase.
I am using a five year old 10nm processor running at 2ghz. I am confident that a new Snapdragon / Exynos would give alot more performance. The 12 threads of the Kirin 9000s with DuckDuckGo would dominate OffscreenCanvas2d.
Multi-threaded PLANAR3D engine(unoptimized) . Optimization always doubles the framerate.
Optimizations include:
Next camera 3d rotated sample
3 additions and 3 shifts
Next volume 3d rotated sample
3 additions and 3 shifts
Next shadow sample
3 additions and 3 shifts
Next reflection sample
9 multiplies and 3 shifts per ray
Next rerefraction sample
3 additions and 3 shifts
Space leaping prediction sample
3 additions 3 shifts and 2 ORs
The arcade machine will run on eight threads. That is alot of processing power. The ultimate machine would run thirty-two threads, at 5ghz. The equivalent of 140ghz!
The performance is so high I am giving myself three weeks to turn it into a realtime raytracer. Moving from raytracing to radiosity (ambient lighting), as it is much more impressive and simple to do with volume rendering.
DIMENSITY
Doesn't look like much, but using iso-surface extraction (fully tested and ready to go), I can multiplex these 3d sprites to create an area of 4km x 4km at real world scale. Runs at 30 fps on a $200 dimensity 7020, drawing 2.5W of power. Final system will run on a Dimensity 8200 / Exynos 2100.
First multiplex version, 64 multiplies and 32 subtractions and 16 additions. Final version 8 multiplies and 4 subtractions. I get to keep my 30 fps.
d1 = mx*y1-my*x1
d2 = mx*y1-my*(x1+256)
d3 = mx*(y1+256)-my*(x1+256)
d4 = mx*(y1+256)-my*x1
Remember: my*(x1+256) = my*x1 + my*256
thus
d5 = mx*y1
d6 = my*x1
d7 = (mx<<8)+d5
d8 = (my<<8)+d6
d1 = d5-d6
d2 = d5-d8
d3 = d7-d8
d5 = d7-d6
Only 2 multiplies with this optimisation.
This optimisation got rid of an annoying jank, smooth again.
Four 3D sprites from only three clipped, the scene has a total of nine 3D sprites. The blocky appearance simulates space leaping(to gauge performance), and as below is not present in the 3D sprite.
IT IS DONE!
Total engine size 16kB!
Total landscape A4 pages for code 16!
Now I finally get to put this engine into a hardware design.
Voxel editor completed as well.
Cardboard prototype finished on 30th May 2024.
Actual Machine in final stages.
Feel free to use all the code in all my blogs for private or commercial use.
Comments
Post a Comment