My New Hugo Site

Web Blender Rabbit Hole

The night before yesterday I had a new ambitious idea to port blender to browser. I know it’s a rabbit hole. Multiple reddit comment said this is not a good idea. Something’s wrong deep in my mind, that I want to take a shot at this challenge.

I’ve done naively compiling blender on macOS. Soon after that I’ve setup breakpoints to step into this compiled program. Took an hour or two to walk through the initialization process, and found out some potentially interesting files: WM_init(). WM means windows manager. At this stage I was thinking the first thing to conquer is the message queue system, because a message queue could reverse the calling dependency and separate two systems. Somewhere in this process I got lost in code and my focus shifted to the graphics init and draw frunctions.

I found out it is using the latest apple Metal API for graphics. In total blender is supporting OpenGL, Vulcan, and Metal. Judging by the code it must pick one of the above and then initialize the GPU context. My thinking is then Metal API is too different from WebGL. I should try compiling and using the OpenGL. I then try compiling Blender on my 2014 MacBook Pro. I named this macbook alanine. Disabling Metal in CMake failed the build. I’m now trying to enable OpenGL backend, but seem doesn’t work.

Next step is look into the unit test and find some week point to compile it to webassembly, I think. Wish me luck.