Replies: 3 comments 7 replies
-
I understand the appeal but there are lots of issues, especially if trying to use 32 bit numbers. Here’s a list of some of the issues encountered when modeling was based on 32 bit typed arrays. |
Beta Was this translation helpful? Give feedback.
-
There are two major issues to overcome.
NOTE: planes are basically a normal, plus a distance from 0,0,0. planes are used heavily in big operations |
Beta Was this translation helpful? Give feedback.
-
Update 1 (more practical direction with less drastic changes)I took a sphere with 2014 segments to check the numbers for creating it, and converting to array for webGL.
The concrete run-time numbers are not a important, as is relative performance weight of each step.
I was able to change converter to calculate size of vertices array and size of index array for webgl data so I could create TypedArray for each in advance and fill them. This allowed me to
The gain is obviously from the fact that we create array in advance. If we start with empty array and push stuff in it, it will be resized many times during the conversion (new mem alloc, and data copy) The conclusion is that I should be able to reduce regl-render conversion time from 600ms to 80ms (somwhere in that range) for this particular case. Bonus exploration: colorCube from examples takes on regl-renderer 1300 ms to upload to gpu as cube data is not reused.I think I will be able to reduce that t some point below 20ms... but for that I need to finish those multiple PR's regarding geometry immutability and regl renderer shader and also webworker reuse on param change (that one I already hace proof of concept working in that new param syntax demo) @z3dev hope you are well on ur vacation, lots of fun stuff for when you come back from sabatical 😄 . I am spamming u as I am proud of my new improved skills regarding webgl. |
Beta Was this translation helpful? Give feedback.
-
initial idea (likely not viable)
While exploring the web workers, I have stumbled upon one concept that is supported for long time now (since 2011) https://developer.mozilla.org/en-US/docs/Web/API/Transferable
https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast
Typed arrays are one of the objects that are like that, and if modelling would be based on them, I am sure it would open-up some more avenues for performance improvements.
This is just speculation for now, and a vague idea but I want to put it out there for consideration.
Update 1 (more practical direction with less drastic changes)
I took a sphere with 2014 segments to check the numbers for creating it, and converting to array for webGL.
The concrete run-time numbers are not a important, as is relative performance weight of each step.
code for regl renderer is 2x slower in step2
Float32Array.from(nativeArrayWithWebGlData)
I was able to change converter to calculate size of vertices array and size of index array for webgl data so I could create TypedArray for each in advance and fill them. This allowed me to
The gain is obviously from the fact that we create array in advance. If we start with empty array and push stuff in it, it will be resized many times during the conversion (new mem alloc, and data copy)
The conclusion is that I should be able to reduce regl-render conversion time from 600ms to 80ms (somwhere in that range) for this particular case.
Bonus exploration: colorCube from examples takes on regl-renderer 1300 ms to upload to gpu as cube data is not reused.I think I will be able to reduce that t some point below 20ms... but for that I need to finish those multiple PR's regarding geometry immutability and regl renderer shader and also webworker reuse on param change (that one I already hace proof of concept working in that new param syntax demo)
Beta Was this translation helpful? Give feedback.
All reactions