I’m trying to get the hardware pointer/handle to a texture.
This is possible in Unity using (Texture.GetNativeTexturePtr)
How is this done with Unreal?
I’m trying to get the hardware pointer/handle to a texture.
This is possible in Unity using (Texture.GetNativeTexturePtr)
How is this done with Unreal?
Hi Hmb3141, Unreal Engine wraps the hardware differences under the RHI; if you provide some info on what you want to accomplish, it’d be easier to give you a workaround.
Roughly, UTexture holds an FRHITexture, which can be cast to an FD3D11Texture2D for example, which holds the D3D handle.
I’m trying to implement Spout under windows and Syphon under OSX. Both of which are frameworks which allow realtime video sharing between applications.
In the short term I would just like to just get this working, at the minute I’m focusing on Spout for windows. I’ve built the Spout SDK into a lib and linked it to Unreal. In Spout I’m creating a D3D11 Texture, which I need to do a blit to from an Unreal Texture. To do this I need to pass the Texture Handle to Spout.
Currently I’m using a ScreenCapture2D with a Render Texture to access a Utexture2D, although perhaps there’s a more efficient method for this.
In the long term I’d like to create an Unreal Plugin. If a workaround would require a change in engine code, do you think it’s the sort of change that is likely to be added if a pull request was made?
Thanks,
Harvey
Hi,
Could you expand on how you can get access the D3D handle.
I’ve been attempting to get access to the ID3DTexture like so, where cameraTarget is a UTextureRenderTarget2D. This compiles fine, but crashes when it’s run.
if (cameraTarget != NULL) {
if (cameraTarget->TextureReference.IsInitialized()) {
UE_LOG(LogTemp, Warning, TEXT("cameraTarget - TextureReference.IsInitialized()"));
FTextureReference fTexRef = cameraTarget->TextureReference;
FTextureReferenceRHIRef fTextRefRHIref = fTexRef.TextureReferenceRHI;
FRHITextureReference *frhiTexRef = fTextRefRHIref.GetReference();
FRHITexture *frhiTex = frhiTexRef->GetReferencedTexture();
ID3D11Texture2D *d3d11Tex = (ID3D11Texture2D*) frhiTex->GetNativeResource();
}
}
I also get a crash with just fTextRef = cameraTarget->Texture.
Thanks
Did you ever get a chance to look at this?
Hello,
I have tested the spout plugin for Ue4 and it inputs correctly the video fee. However for the project I am working on, I need to send a video (from touch designer) , through spout and import that as a texture and material in UE4. Any developments on that front. Or can you guide me to someone who potentially is interested in a gig to resolve this issue.
This sounds like something I need as well. I have an application that is rendering video to a FD3D11Texture2D. I would like to use this memory buffer as a texture source, so the video can be mapped to an unreal material and displayed in my unreal application. I have been successful in implementing a shared memory interface, permitting data to be shared between several applications (including unreal) simultaneously. Have you made any