Giter Club home page Giter Club logo

klakspout's Introduction

KlakSpout

gif gif

KlakSpout is a Unity plugin that allows Unity to send/receive video streams using the Spout system.

System requirements

  • Unity 2020.3 or later
  • Windows system with DirectX 11/12 support

Currently, KlakSpout only supports Direct3D 11 and 12. You can't use other graphics APIs like OpenGL or Vulkan.

How to install

This package uses the scoped registry feature to resolve package dependencies. Please add the following sections to the manifest file (Packages/manifest.json).

To the scopedRegistries section:

{
  "name": "Keijiro",
  "url": "https://registry.npmjs.com",
  "scopes": [ "jp.keijiro" ]
}

To the dependencies section:

"jp.keijiro.klak.spout": "2.0.3"

After changes, the manifest file should look like below:

{
  "scopedRegistries": [
    {
      "name": "Keijiro",
      "url": "https://registry.npmjs.com",
      "scopes": [ "jp.keijiro" ]
    }
  ],
  "dependencies": {
    "jp.keijiro.klak.spout": "2.0.3",
...

Spout Sender component

Sender

You can send a video stream using the Spout Sender component. There are three capture methods available:

  • Game View: Captures the content of the Game View.
  • Camera: Captures a specified camera.
  • Texture: Captures a 2D texture or a Render Texture.

Note that the Camera capture method is only available on URP and HDRP -- You can't use it on the built-in render pipeline.

The KeepAlpha property controls if it keeps or clears the content of the alpha channel. Note that you have to enable alpha output when using HDRP. Also note that you have to use the Texture capture method to enable alpha output on URP.

Spout Receiver component

Receiver

You can receive a video stream using the Spout Receiver component. It stores received frames to the Target Texture. It also overrides a material property specified in the Target Renderer.

You also can refer to the received texture via the SpoutReceiver.receivedTexture property.

Scripting interface

You can enumerate available Spout senders using the SpoutManager class. Please check the SourceSelector example for further usage.

You can dynamically create a Spout sender/receiver, but you must give the SpoutResources asset (which holds references to the package assets) after instantiation. Please see the benchmark examples for detailed steps.

Frequently asked questions

What's the difference between NDI and Spout?

  • NDI: Video-over-IP codec/protocol
  • Spout: Interprocess GPU memory sharing on DirectX

NDI requires CPU/memory/network load, but it's greatly versatile.

Spout doesn't produce any CPU load, but its range of application is limited.

If you're trying to share videos between applications running on a single Windows PC, Spout would be a better solution.

klakspout's People

Contributors

comoc avatar kant avatar keijiro avatar ohmnivore avatar rself avatar thriftysnail avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

klakspout's Issues

klakspout breaks vive trackers in unity

I'm developing vive-tracked live digital avatar performance capture and multi-cam LED wall - I got Klakspout to work - but then discover my vive trackers stopped working - so i delete your lines in manifest and trackers spring back to life! now Klak's dead

using 2019.4.14f and also tried 2019.2.20f1

help? can i have both klakspout and vive trackers?

Check last frame time for feed?

(Fantastic little plugin by the way, saved me loads of time)

Is there a way to grab the timestamp of the last successful frame from a feed? I'd like to check it and if one hasn't been provided in a while, and handle it as though the submitting application is lagging behind for whatever reason and tell the user, rather than leaving them with a static image.

Improvement : Add NDI support

That's not an issue, but an improvement - having solid support for NewTek's NDI would be awesome as well. It allows sending images over network with a lot less latency than Spout2NDI currently allows.

Build error when KlakSpout folder is moved

Hello,
I'm trying to build my project with the latest KlakSpout release on Unity 2018.2.8f1. If I let the Klak folder directly under Assets the build succeed. But if I moved it under a sub-folder I get this error : error CS0009: Metadata file `C:\Projets\Test\KlakSpout\MyProject\Assets/Plugins/Klak/Spout/Plugin/x64/KlakSpout.dll' does not contain valid metadata. The error stays if I move the folder back to its original location, I have to delete and re-import it again to get a successful build.
Thank you for your help!
Nolwenn

Float texture receiver not working with negative values

I'm sending a texture in RG_32F format.

It appears to be coming in correctly in both the Spout Receiver example and Touch Designer, but not in Unity. The Unity receiver looks like it's flipping the negative values to always be positive. I am setting up my render texture with format R32G32B32A32_SFLOAT.

Spout-Receiver
Spout-TouchDesigner
Spout-Unity

I think it's a bug, but please advise if you have any suggestions for fixing it. Thanks!

Build issue

Hi there,
I created two projects (sender/receiver) and I hit play in both (with background on in the player settings) and it works fine. When I built the projects and tried to do run the builds, they didn't work. Any idea why?

DX12 support

Hi,

i had a conversation with leadage from spout2.
leadedge/Spout2#55 (comment)

he pointed me to the D3D1211On12 feature which is enableing Spout compatibility for ray tracing
leadedge/Spout2#55 (comment)

Do you see a chance to get DX12 support for KlakSpout?

Your NDI DX12 solution works great but it s to slow for our use case.

Project build with Unity 2019.3.0f1 and windowed option enabled can cause the game to become (not responding)

Steps to reproduce:

  • Build project for Windows (architecture x86_64) with Unity 2019.3.0f1 with Fullscreen mode: Windowed;
  • Open executable/game;
  • Activate Spout DX11 Sender (or any other might do as well);
  • Play around with sender (for instance moving the background etc) for half a minute or so;
  • When trying to activate the built game, window goes into "not responding" state.

When closing Spout DX11 Sender, game becomes responsive.
This issue doesn't happen with fullscreen mode.

Source Name property for Spout Sender camera component?

Hey, is it possible to add a source name property to the Camera capture mode sender component?

I have 4 cameras in a unity scene for a projection mapped room and I'm getting instructions to "send Textures to the mapping system via Spout. The textures Spout names to share are "x", "y", "z", and "a"."

Thanks

Auto select first available receiver

Hey,
awesome plugin, as always with Keijiro :)
When I created Unity Spout Plugin before Klak was out (and better), the default behavior when texture name is empty in a Spout Receiver was to take the first in list.
It's very useful to be able to quickly see something / switching between senders, or not having to set it up when exporting for a system that will only have one shared texture, but we don't know from which software (I'm exporting an app for another artist and I don't know which software he will use for generating the texture).
Is it something that you would implement, either as a default behavior or a checkbox (or option in the dropdown "auto select / first available") ?

Build and Run not working despite normal editor working

I am using the Spout Sender script and it seems to be working normally when I use the in-editor play button, but when I try to use build and run, the program still seems to run normally but any Spout Receiver I try to connect gets "Cannot create directx/opengl interop" or other errors along those lines. If I build with the development build setting on, the receiver picks up what I think is the first frame, but doesn't update. After testing many different types of receivers and also a clean Unity project, I believe the bug has something to do with the package and not anything external. Any advice on fixing or other details you might lead to look into it?

CPU mode support

I can see all of my spout senders in resolume arena and in any demo app for receiving spout input.
When I play any of the streams I always get only blank black screen.
Has anybody had this issue before? Can specific graphics card be problem?
When I play demo app I can receive any other spout application even the demo itself.

One sender always remains in receiver source list even after all senders are closed

Hello,
Thank you for this amazing plug-in !

I am trying to implement an automatic selection of the first source available in the receiver (as mentionned in #34) and I run into a problem where once at least one sender as been seen, the receiver name list never goes back to empty even when I close all senders. One sender always remains even though it is not sending anymore. This remaining sender is not always the same and additional senders are added and removed fine.

Example :

  1. No senders -> source list = []
  2. Start sender A -> source list = [A]
  3. Close sender A -> source list = [A] (problematic, the list should be empty)
  4. Start sender B -> source list = [B] (Adding another sender removed the remaining A)
  5. Start sender A -> source list = [B, A]
  6. Close sender A -> source list = [B]
  7. Close sender B -> source list = [B] (problematic, the list should be empty)

I need to close all my Spout sending programs and restart Unity to get back to an empty sender list.

Do you have any idea of what may be causing this issue ?

SpoutSender not sending render texture when using LWRP

I was able to get everything working on a fresh Unity project. But I have two older projects which I have tried to link to Spout, by using the render texture feature. Render texture is updating, and SpoutSender contains a reference to the correct Render Texture, also the SpoutSender is in an active gameobject.

Only commonality that I could think between these two older projects is that they both use LWRP. The other one is on Unity version 2019.3.11f1 and the other is on version 2019.4.2f1
image
image

Flicker in spout receiver

I am using Resolume 6 to send video onto geometry using spout receiver and it is strobing inside unity. I thought was an issue with HDRP but also getting in standard. Any ideas how to fix this?
Also it used to work, I am currently using unity 2018.3.of2

Thanks so much (:

Feature Request - RenderTexture sending mode

Hi,

It would be useful to have the same RenderTexture sending mode as you have implemented in the NDI plugin, where you can RenderTexture directly via spout without using a camera.

Thanks,

Harvey

Creating/Destroying Spout Senders programmatically works in the Editor but not in build

Hi,

I've have an issue where creating or destroying a Spout sender in code results in a crash in a build, but works in the Editor

I've tested with Unity 5.6 and 2017.

Test case - Using the following to destroy and create the SpoutSender component. (Maybe I'm missing something obvious)

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.D))
    {
        if (GetComponent<Klak.Spout.SpoutSender>()) Destroy(GetComponent<Klak.Spout.SpoutSender>());
    }

    if (Input.GetKeyDown(KeyCode.C))
    {
        if (!GetComponent<Klak.Spout.SpoutSender>()) gameObject.AddComponent<Klak.Spout.SpoutSender>();
    }
}

}

Thanks,

Harvey

Spout error CS0234

Hi Keijiro!

I want to use Spout into Phantom, so I replaced Klak with the newer version, and added Spout. However, I got this error:

Assets/Klak/Spout/Internal/PluginEntry.cs: error CS0234: The type or namespace name 'IntPtr' doesnt exist in the namespace 'Klak.System'. Are you missing an assembly reference?

I don't know how to fix this :-/

Stops working when switch platform to UWP

Hi!
Thanks for making this plugin.
I found when you make a blank project & add klakSpout to the camera & make sure it works, then switch the build platform to UWP (Universal Windows Platform) in build settings then hit play klak no longer sends to spout.
Unity 2019.3.3f1
Im using spout DX11 Receiver to test it
Best,
Char

Question: Spout for 360 Output

Hi Keijiro,

First off thank you for all your awesome work.

I was wondering if you could recommend software to output 360 video content to other software (ie. touch designer) instead of only the Game view width?

KlakSpout Fails to Display Spout texture created from separate display adapter.

KlakSpout will fail to display the Spout shared texture if it was not created on the same graphics display adapter. Testing this requires use of a machine with multiple display adapters (in my particular case, an IGPU - Intel UHD graphics, and a GPU - NVIDIA 2080 Super ). The attached project is simply a new Unity Project (2019.4.10f1) with klakspout included following the directions on the github page. Additionally, the splash screen is toggled off and a text component was added to the scene to display the current SystemInfo.graphicsDeviceName to verify that the correct device was in use.

To replicate the issue, open the scene "Quad". Disable all components of type "Spout Sender" and create a build with this scene called SpoutReceiver. Then re-enable them and create another build call SpoutSender. This way, only one build is creating shared textures so there will be no naming collisions.

Using a terminal, launch each of these builds with the argument -force-device-index #. Specify a different # for the sender versus the receiver and verify that each is using a different adapter by looking at the text element near the center of the screen. Spout textures will fail to display and will appear black. This is a contrived example, but is important in situations where this plugin is used to read textures from other applications creating shared textures, and there is no guarantee what adapter the texture is created on.

SpoutTest.zip

he type or namespace name 'Spout' does not exist in the namespace 'Klak' (are you missing an assembly reference

Hi!

I have this error in Unity 3d version: 2019.4.8f1:

Assets\Script\SourceSelector.cs(7,12): error CS0234: The type or namespace name 'Spout' does not exist in the namespace 'Klak' (are you missing an assembly reference?)


Assets\Script\SourceSelector.cs(13,5): error CS0246: The type or namespace name 'SpoutReceiver' could not be found (are you missing a using directive or an assembly reference?)

In Unity 3d version 2020.2.0b1.2959 all work normal.

32-bit version?

This is fantastic and is working great on 64-bit builds. I don't see anything in docs about it being 64-bit only but I can't get it to work for 32-bit builds. Is it possible to make this work for 32-bit or is the plugin 64-bit only? If so, this should be noted in docs.

Crash after adding Spout Receiver

Unity 2018.2.8f1
or
Unity 2018.2.6f1
Dx 11
KlakSpout Version 0.2
Windows 10 Enterprise

Crash_2018-09-18_113945015.zip

Create empty project in 2018.2.8f1 or Unity 2018.2.6f1
import KlakSpout.unitypackage v0.2
Create Empty
Add Component Spout Receiver
Crash

Spout version update and x86 support is working fine.

Crashing while taking a build

Unity is crashing constantly while trying to build my application with spout sender on the camera. When I turn off the component I am able to build the application.

problem with ATI Radeon HD 6420

Hi,
I've tried to run a Unity project included Spout sender on a pc with AMD Radeon HD 6450 but game crashes and displays "ATI Radeon Driver Stop Working" message. I've run this project on another computer before (with Geforce Graphic).
I just want to know is there any special compatibility for running a Spout Sender in unity?
Thank you

IL2CPP build issue

Unity 2019.1.14
Windows 10
Scripting Backend IL2CPP
Spout 0.2.4

I get following build error

KlakSpoutGlobal.h(6): fatal error C1083
cannot open “Spout/SpoutDirectX.h
No such file or directory

Scripting Backend Mono works fine.

Unity Fatal Crash after adding Spout Receiver

This is related to #19 that I cannot reopen then I create a new issue.

Unity version : 2018.2.17f1

import KlakSpout.unitypackage v0.2
Create Empty
Add Component Spout Receiver
Crash

Sender works perfectly.

Does Spout work in Unity when using HDRP ?

Hello,
I am using Unity's Visual Effect Graph function,
To use this function, it must be under HDRP.

So I would like to ask if Spout can be executed in this situation?
Because I add the spout sender component on Camera (like the way we are familiar with),
However, the image cannot be transmitted.

So I would like to ask if Spout(Not even NDI) can run under HDRP? is there any other reason?

Thanks!

DLLNotFoundException

I can't seem to get it working. The console fills with DLLNotFoundException: KlakSpout errors, using your test scene or my own tests - although the dll is definitely imported. My Spout version is 2.006 using DX11 mode on Win64.

SpoutSender not working on High Definition RP Project

SpoutSender is not working properly on a High Definition RP.

Ways to reproduce this issue:
-Create a New Project and select Hight Definitio Rp.
-Import KlakSpout package
-Attach SpoutSender Script to Main Camera

Unity Version: 2018.3.12f1

Would you help me with this issue?

Thank you for your work, it has been really useful

Any plan to add SharedMemory mode support?

The 2.007 SDK has improved the memory shared mode.
it's not based on CPU now.
Memory share mode improved
Performance of shared memory functions has been improved by using
multiple pixel buffers to load from and upload to OpenGL textures and
remains a backup where hardware is not texture share compatible.

Support changing sender dimensions

Hi,

It would be useful to have the UpdateSender function (SpoutSender.h, line 44) from the SpoutSDK available in Unity. This would you mean you don't have to recreate the spout sender when changing sender dimensions.

Thanks, Harvey

Send more than 10 Spouts

Hi.. I'm trying to send 15 cameras from Unity to Resolume Arena 6.

For some reason in Resolume I can only see 10 cameras (the first 5 and the last 5).

Is this a limitation in the Resolume side? or is it a limitation in the Unity Side?

Run on HDRP?

KlakSpout don't send graphic on Unity2018.2 with HDRP.
I can send Image without HDRP.

How to use KlakSpout on HDRP mode?
Best regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.