Spout [Syphon on Windows] Unity Plugin

Hi,
i’m glad to announce the upcoming release of the Spout Unity Plugin.

Spout is the successor of Wyphon, and is a plugin that let users share textures across softwares.
More info about spout here : http://spout.zeal.co/

Here are 2 videos showing both receiving textures from Resolume, Processing and a demo app, and sending to Resolume and a demo app.

Enjoy !

Hey,

Nice work on the plugin - any timeframe for the release of this? would you be happy to let me test it?

Regards - James

Hi,
Spout is working on a major update to integrate in the next stable release dx11 support (which is needed for the Unity plugin to work).
One the spout team releases a stable version, i will clean it up and release it.
I can’t give you a date, but we’re working everyday with Lynn to get this version working, and make sure that each decisions are relevant in the long run.

You can find the sources here : https://github.com/benkuper/Unity-Plugins/tree/master/SpoutPlugin
it might work out of the box, although i doubt it, it’s been compiled with a modified version of the SpoutSDK and you won’t be able to share texture from Unity if receivers are DX9.

i’ll keep you updated,
Ben

Great, great news! Really looking forward what cool things will be possible with this plugin.

Hey there,
for those who want Flash content running smoothly in Unity as textures, here it is ! Spout AS3 Plugin that can send content to Unity, Resolume, etc.
Now you can have live AS3 applications providing animations for Unity !

After 24 hours of try, i m searching for help.

The unityspoutdemo/export exemple don’t work. The send and render don’t comunicate.

Fort the spout test when i play scene i have error “dllnotfoudexception …Nativespoutplugin.dll”

Can you help me ?

(sorry for my english)

Hi lesvandales,
i’m sorry you struggled with the plugin. As I said, the plugin was compiled with modified version of the Spout SDK, so it might simply not work on other computers…
Spout is currently being refactored and updated, i will clean the sources and pack everything when Spout is officially updated.
If you really want this to work (and it will only work as receiver, because unity sender will send DX11 textures and no current official plugins are DX11 compatible), you can try to find which DLL NativeSpoutPlugin.dll is depending on with a software called dependencyWalker (download the 32 bit version).
I can already tell you that the plugin has been compiled with VS2012 so it might be dependant of the msvcr110.dll and msvcp110.dll (or msvcr110d.dll and msvcp110d.dll), and is also depending on pthreadVC2.dll (for multithreading)
You can find those dlls online (dll-files.com for example)

  • Are you french ?

Ben

Hi Ben,

Any news on the development?

Hi,
spout has not released its update yet, i hope it won’t be too long.
In the meantime, you can already check the sources and try the existing demos

(I posted this originally on the YouTube video, but found this thread and it seems more appropriate to have it here)

Thank you, so so much, for making this. Seriously, I’m overjoyed I can mess around with this concept without having to switch to a Mac now.

However, I’ve been having trouble getting the Unity Spout plugin to receive or send anything it seems. Resolume finds its Sender, but I only end up getting a black screen. I checked the RenderTexture and it is indeed being updated, and the debug console makes it sound like it should be wokring. I’m sort of stumped how to debug this. Unity doesn’t manage to get anything from the Spout test sender either. Any ideas?

Hi skullthug,
sorry i didn’t answer on the youtube comments, somebody wrote me an email with the exact same problem and i thought it was you who didn’t read my answer by email yet.

I would need more informations about your setup in order to be able to tell you what’s going on.

  • Which OS are you on (i assume Win8)
  • What hardware are you using (laptop, graphic card : Nvidia or ATI, if Nvidia, do you have optimus)
  • Did you get the official spout demos working ?
  • Can you test Unity <> VVVV ?

There are posts in the official spout forum that explain in details those issues, but just so you know :

  • Spout requires Nvidia to be able to transform textures between OpenGL and directX. That means that if you don’t have an Nvidia card, you will only be able to share textures between “DX-only” plugins (for the moment, Unity and VVVV are the only ones that are not using the Nvidia driver’s GLDX interop functionnality).
  • Optimus enabled Nvidia cards are currently not supported, Nvidia has announced a driver update which should fix this problem and allow spout to run on optimus cards.

Hope that helped,
Ben

Thanks kindly for replying Ben.

I’m running Win7
I am running a ATI/AMD video card (Radeon HD 7700)
The official spout demos work fine with Resolume via memoryshare. I didn’t realize a Nvidia card was a possible factor, so I guess my question now is can the Unity Spout plugin work via memoryshare? I’m new to this level of graphic technicality, so I’m afraid I don’t quite understand your statement about Unity & VVVV not using GLDX interop functionality.
I’m not at all familiar with VVVV, so I don’t really know how to test it communicating with Unity easily either, yet.

UPDATE:
Apparently AMD Radeon cards can now support that certain functionality with the newest drivers (I haven’t updated in ages for reasons I won’t go into).
After updating the Unity Spout scenes worked instantly. So, cool :slight_smile: Thanks for your reply, I probably would not have figured that out otherwise.

I have one last question, is there any way to get the Spout Plugin to utilize MemoryShare mode? The hardware I’d like to be running this setup on unfortunately does not have a video card with the right DX support.

Hi Ben
If I run the demo unity application you compiled, then it is possible to send from this application and receive it in the standard Spout2 demo receiver (both 64bit and DirectX 11). So everything works fine there.
However, if I compile your Unity project myself in Unity and run this, it does not work. The sender can not be initialized.

With some debugging I found out that getNativeTexturePtr() always returns 0 for a RenderTexture. In your script you use this to pass the native pointer to the plugin. And thus of course the initialization with a null pointer fails.

I have an NVIDIA graphics card with the newest driver … but I assume this is not the problem, since your compiled version runs fine. Also it does not make a difference if I compile the dll myself or take your compiled dll. The problem occurs in both, Unity 4.5 and Unity 5beta

Do I have to set anything special in the Unity project to make this run?

Thanks in advance for any help!

Same problem here with the TexturePointer Error. Have an idea of how to fix this?

Thanx !

Hey there. I found some kind of fix for the TexturePointer Error.
in Spout2Sender.cs, replace this :

void Start()
    {
        if(texture != null) senderIsCreated = Spout2.CreateSender(sharingName,texture);
    }

by this:

void Start()
    {
        Invoke ("CreateSender", 0.5f);
    }

and add this method:

void CreateSender()
    {
        if(texture != null) senderIsCreated = Spout2.CreateSender(sharingName,texture);
    }

Worked for me :slight_smile:

Found a similar solution. It looks like the texture is just not ready at the call in start(). Also, I think the sending should be moved into OnPostRender() to make sure the rendering has finished. In there we also know that the texture is ready. So my solution is this:

    void Start()
    {
    }
 
    void Update()
    {
    }
 
    void OnPostRender()
    {
        if (texture != null) {
            if (!senderIsCreated) {
                senderIsCreated = Spout2.CreateSender(sharingName, texture);
            } else {
                Spout2.UpdateSender(sharingName, texture);
            }
        }
    }

Hello,
I’m just started to use spout and try somes test with it, i could manage to run it and build a really simple app with it.
I have a question about it, i actuallty saw that it support resolume, i wan’t to build a frame of my app in Arkaos Media master Pro 4. Is it support by it yet. and how to manage it.

Thanks

Hi,
i played with the latest version and realized that the texture from Unity comes flipped on the y-axis into the Spout receiver. Don’t know exactly if this is a common problem with Unity RenderTextures.(It confuses me that nodody complained about that till now) . There is a quick workaround for that:
Just use this script from Unity to change the Camera.projectionMatrix and add it to the Spout sender camera:

Hello sloopidoopi,
indeed the texture is flipped, that’s a common conversion problem between directx and opengl. I also have the problem with the AfterFX plugin, but as most of the time it ends in Resolume, this not really a problem since i just have to