-
Notifications
You must be signed in to change notification settings - Fork 60
Missing texture replace #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The idea of #10 was to have the changes happen only on the client side. The
netimgui client should let the library user know that a new texture is
being used, so they can decide to send it to the netimgui server.
If I understand correctly, you want to update a texture every frame on the
client, send it to your Dedicated Server and have it forwarded to the
NetImgui Server?
So the NetImgui server would need to handle opening a new data pipe to
receive texture from your 3rd party server, and somehow know it belongs to
a specific client?
Any reason you don't try to update the texture directly between the
NetImgui client and server?
Is it because this is a video that is still compressed on the client side, then decompressed on your dedicated server?
…On Thu., May 18, 2023, 00:15 Kostiantyn Chernenok ***@***.***> wrote:
Hi! In our project client app provides the video stream witch I would like
to embed in ui on server side. Previously we implement it very roughly:
1. On client app draws texture with ImGui::Image and send texture and
texture id via third party tool (NDI)
2. On server side receive texture and texture id from third party tool
3. Provides to netimgui on server side texture data by texture id
which was used in ImGui::Image on client side
So, I interested is netimgui project interesting in this feature? I can
make PR with describes the idea.
Seems it very close to #10
<#10> but difference in that
I'm want to provide texture in each frame on server side.
—
Reply to this email directly, view it on GitHub
<#44>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESBPY7QQ6EKWO7XI574W7LXGTTQLANCNFSM6AAAAAAYFH4RVQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Oh, sorry for bad describing our pipeline:) Our case is more common. |
Ok, if I understood correctly (because there a lot of server and client mixed in :) ) You have 'Server A' application with a 'Netimgui Client B' connection. Your Server A is running some logic, then sending the imgui results to the NetImgui Server B. Given that it's a video stream, I agree that sending it uncompressed would be a problem. An easier solution than what you propose, could be to send the compressed image frame as a new texture format, and then have the NetImgui server decompres it, maybe by using a known library, or what you are already using. |
Yes, totally correct.
Actually we made something similar. We send video stream from 'Server A'. After receiving it on 'Client A' we upload it to GPU and obtain 'Video texture id'. After that when NetImguiServer (on 'NetImgui Server B') replaces imgui texture ids by own texture ids (NetImguiServer_RemoteClient.cpp:250) we check if requested texture id is for our video stream and replace it with 'Video texture id'. It's implemented in way which breaks smooth update of NetImgui to next version because we changed NetImguiServer_RemoteClient.cpp file. Maybe it's possible to add some callback to NetImguiServer which will requests missed textures id (which not found in NetImguiServer::Client::mvTextures vector)? |
The Callback idea was limited to the NetImgui Client code.
When the NetImgui Client detects an unkown texture, it would use a user
specified function callback to request some actions on its application side.
Having the callback between the NetImgui Server and NetImgui Client would
be more complex, and I feel that there would be not point to detect this at
the NetImgui Server level.
I also do not want to add too much complexity to the NetImgui codebase, for
a very specific usercase, that I would then have to keep maintaining.
However, I might have an idea of something that could work for you
- Add a new 'Custom' texture format (right now we have A8 and RGBA8).
- Every frame, the NetImgui Client send the 'Custom' texture to the NetImgu
Server as a 'video compressed frame'
- The NetImgui Server receives the 'Custom' Texture update
- When detecting the Custom format, it calls a user defined function to
process it and creates the normal GPU texture
- The custom Processing function could be in a separate file, or a
callback
- This require the user to compile their own NetImgui server (like you
are doing)
This is a rough idea, let me know what you think and please let me know if
you have better suggestion that involves few changes and maintenance to the
codebase to maintain it.
…On Thu, May 18, 2023 at 1:52 AM Kostiantyn Chernenok < ***@***.***> wrote:
You have 'Server A' application with a 'Netimgui Client B' connection.
You have 'Client A' PC that's running 'NetImgui Server B' application.
Yes, totally correct.
Given that it's a video stream, I agree that sending it uncompressed would
be a problem. An easier solution than what you propose, could be to send
the compressed image frame as a new texture format, and then have the
NetImgui server decompres it, maybe by using a known library, or what you
are already using.
Actually we made something similar. We send video stream from 'Server A'.
After receiving it on 'Client A' we upload it to GPU and obtain 'Video
texture id'. After that when NetImguiServer (on 'NetImgui Server B')
replaces imgui
8000
textures ids by own texture ids
(NetImguiServer_RemoteClient.cpp:250) we check if requested texture id is
for our video stream and replace it with 'Video texture id'. It's
implemented in way which breaks smooth update of NetImgui to next version
because we changed NetImguiServer_RemoteClient.cpp file. Maybe it's
possible to add some callback to NetImguiServer which will requesting
missed textures id (which not found in NetImguiServer::Client::mvTextures
vector)?
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESBPY3DVJTWCCCHOD5UEWDXGT65VANCNFSM6AAAAAAYFH4RVQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This solution is good. It actually much better than my callback idea for our future plans about video streaming. |
The idea would be that the NetImgui Client keep sending video frame using the same textureid. Then, the NetImgui Server would recreate a new texture GPU ressource, but at the same TextureID. This would be simple. It might be possible to setup the GPU texture to be updated rather than recreated, but this is something that would need to happen in the custom texture creation function (so handled by you). |
Sounds good. It's possible also to pass some user data to custom texture creation function? Or it will be to specific? User data can helps to determinate is creating or updating needed. |
I was thinking of passing the current GPU texture object of found and then
the texture command data.
…On Sat., May 20, 2023, 01:42 Kostiantyn Chernenok ***@***.***> wrote:
Sounds good. It's possible also to pass some user data to custom texture
creation function? Or it will be to specific? User data can helps to
determinate is creating or updating needed.
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESBPY6CYYIQ7HIDWO3PNSDXG6PHTANCNFSM6AAAAAAYFH4RVQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Maybe it's too specific case, but some times user can wants to change processing texture command data depends on some external parameters. In this case some user data in custom texture callback may helps. |
I was thinking that this would be up to the user to create their own data format inside the texture data. I'm doing a custom texture branch, and once I have something, you can try it out and let me know what works and doesn't |
Submit bc7d34e in the Task_CustomTexture branch give an idea of how I was imagining the feature to work. The Let me know if it looks like something that would work for you. |
Thank you! It's totally works for me. My ProcessTexture_Custom implementation looks like
where In some future I will use hardware h264 encoding for video and send texture data via NetImgui as it designed now. |
I have updated the Sample in the CustomTexture branch. Let me know if this solves your issues. I will then clean it up and integrate it to the DevBranch.
So I guess you send a texture update everyframe, but only update the texture if you detect you have received a new one from the video server that you are using? I guess there's not much choice, if you can't be sure on the netimgui client, when the video server has received a new texture and is ready to display it on the NetImguiServer. So for now, your code won't change much, but you have the option of streaming directly from the Texture command now, and your code changes will be isolated to a separate file (once I move the function). |
Everything good. Thank you! |
I finalized the work on custom texture support and imported it in the 'dev' branch. (see beb5dd4). The custom texture handling is done inside Once you have confirmed that everything works as expected, I will close this issue. |
Note: I never worked with textures updated every frame (like a video frame), but there might be a better way of handling this than Destroy/Create texture gpu resource each time (like the sample is doing). It might be that creating the texture gpu resource as 'updatable' and then updating it instead of recreating it, could be faster. This is something that you can explore, but would need to implement your own Just a thought. |
Yeah. In OpenGL there is glTexSubImage2D for updating whole texture or only a part of it. |
Hi! In our project client app provides the video stream witch I would like to embed in ui on server side. Previously we implement it very roughly:
So, I interested is netimgui project interesting in this feature? I can make PR with describes the idea.
Seems it very close to #10 but difference in that I'm want to provide texture in each frame on server side.
The text was updated successfully, but these errors were encountered: