Spout

Native integration with Blender

Hello Spouters (that sounded weird)

We’re working on a particular application utilizing Blender for in-camera VFX purposes (think Mandalorian.) Getting a realtime image out of Blender in a latency free way is critical for this, and unfortunately I’m bumping up against my own knowledge limitations.

The current Spout for Blender addon has to rely on a separate framebuffer, which causes performance to plummet. This isn’t Martin’s fault; Blender doesn’t expose the native framebuffer to Python. A native integration would need to be done in the source code for a truly usable experience.

I’m looking to pay someone with OpenGL experience to either do this integration, or review the Blender source code and point me to the best way to integrate Spout. Any work from this would be made open source and free for all to use.

https://github.com/blender/blender

Thanks!!

Hi @andyfilms

I see that Blender is mainly C/C++ so the Spout SDK files or library should be compatible. To find out whether it’s possible, you would have to find in the Blender code where there was a texture or fbo that you could use for sending. I had a quick look and could not locate it.

Do you know precisely why the Python performance is affected. If not, could you insert some timing tests to find out? Perhaps Martin or Ryan could offer some advice.

Hello! I think this is the file I’d need to hook into: blender/gpu_viewport.c at master · blender/blender · GitHub

The issue is that the Spout SDK/library uses C++, and utilizes enough C++ syntax/features that it doesn’t seem to be compatible with the pure C that Blender is mostly written in. I’m happy to be wrong though.

The performance issue with the Blender plugin is documented, but it’s because Blender doesn’t allow access to the default framebuffer. Instead, plugins are forced to create a new framebuffer which means everything is rendered twice. The Blender folks see exposing the default framebuffer as a security issue, which is fair enough–just annoying in this case :slight_smile:

I can see that this could be the file to look at. I can’t immediately pinpoint the place to use a particular texture or fbo without some familiarity with the Blender code. I will study a little further.

Yes it could be that the C+++ Spout SDK files are not compatible. In that case SpoutLibrary might be the solution. Have a look at the library sender example to get an idea.

hey @andyfilms - happy to have a chat to see if we can give you some tips. We built the Unreal Engine Spout plugin so might be able to help.

Hey! I’d love to have a chat–send me a PM and I can give you my email.