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.

Did you ever reach a solution with this. I think I’m in a similar situation as you and would love to find a solution.

Hey, we did not. The consensus in the Blender community is that it’s not worth putting too much time into these things right now, as the Vulkan upgrade will require a re-do of it anyway.

1 Like

That’s too bad, as it is the spout integration is almost unusable. Another problem of having right now is the image I’m getting out is way too dark… Have you had that problem?
unknown

There were some quirks with the Blender API and color management. I opened an issue on the plugin, and I believe the Blender folks did fix the API, but I don’t know if the plugin is using the fixes.

2 Likes

Ah thanks for letting me know… so are you using blender with spout yourself, or do you have some otherSolution working? I have a hybrid studio setup where I’m trying to integrate blender graphics and a green screen setup, and this is proved pretty frustrating. I don’t know how much farther to chase blender or spout before trying something else.

Thanks again for replying so promptly :+1:

I have just taken the required help from this documentation. Thanks, @andyfilms for posting it here.