Closed wuzelwazel closed 7 years ago
I've managed to get this working by setting up the spout receiver once on the begin play event without using the mid and then calling the spout receiver on tick events as I had been doing previously.
Occasionally I still run into this error but the conditions that cause it aren't entirely clear to me. I'm going to leave this issue open while I continue to test.
I've been working with this for a few days now and I'm no longer receiving the initial error. However, I sometimes receive a warning about running out of video memory if I let the PIE run for a while. It seems that the only way I'm able to get the texture to update on every tick is to execute the Spout Receiver on every tick. I've tried setting an MID variable from a Spout Receiver that executes on BeginPlay, but the MID doesn't seem to receive updates to its texture.
Is the Spout Receiver executing on every tick creating hundreds of MIDs that are not being disposed of properly?
I will try to reproduce the error. I would like to change the spout info node to expose the texture correctly, I could also put an output on the spoutreceiver node that returns the material and UTexture2D.
I've moved to using the Spout Info From node to retrieve the texture. Unfortunately, this only works if I also execute Spout Receiver before executing Spout Info From. It does simplify things as I no longer need to pull the (potentially non-existent) texture reference out of the MID. This method seems to handle cases where the texture is not present a bit more gracefully.
Hi AleDel - Looks like my comments are overlapping - Thanks for this plugin - I don't know if you've used or seen BLUI but there you have nodes which set up a texture2D which acts as a receive buffer then you just connect a simple 'RunBLUITick' node to your tick event which updates all the buffers as required.
I'm also getting the memory issues after a few minutes of play - the FPS gradually slows down considerably.
Thanks for looking into this AleDel. How fortuitous that someone else is having the exact same issue concurrently.
I'm incredibly appreciative of this plugin, so much so that I'd like to donate some money for the time you've spent on it. So here's my newest issue: how can I donate to you? 😃
the fast solution could be add a "if exist" node blueprint to check the variable mat and to follow with the logic.
if you want, you can donate here https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KQBJ79NSJ4GDA
Thank you
@Dannington yes i have used BLUI and i tried this code to learn more about textures and materials. is a very good plugin
@AleDel I tried using the "Is Valid" node to check my blueprint's MID variable where I'm putting the Mat output from the Spout Receiver node. If there isn't a valid MID in the variable then I get one from the Spout Receiver and place it in the variable. That didn't seem to have any positive impact on performance or behavior of the blueprint.
Are you suggesting another approach? I'm relatively new to UE4 so any additional insight you can provide would be much appreciated 😃
i think that is the correct way because is coherent with the flow of the cooking in blueprint, other aproach, would be, in the code, always return a material, never null.
@Dannington , I think I'll implement mechanism for SpoutReceiver to return Utexture2D as well. As did num3ric in https://github.com/num3ric/Spout-UE4/commit/85aedcfe0dad3022fc9800caf20499cc21c778b3
Now, SpoutReceiver return Utexture2D as well.
I am attempting to access the texture from the material instance dynamic that is output from the Spout Receiver node.
Above is the applicable section of my blueprint. The Keyed Material variable is a Material Instance Dynamic that has a Masked Surface material as its parent. TouchDesigner is sending a texture through the Spout Out TOP with the name _spoutkey. I was able to find that the texture inside of the Spout Receiver material has the parameter name SpoutTexture and values that follow the pattern Texture2D_{N}. I thought I could simply use the GetTextureParameterValue node to pull the texture out of the Spout Receiver and pipe it into my own material instance. However, I always receive this error:
Am I going about this the wrong way or is this functionality simply not present? I was expecting that I would be able to pull a texture directly out of the Spout Receiver node.
Any support is gratefully accepted.