View Issue Details

IDProjectCategoryView StatusLast Update
0003057NoesisGUIUnrealpublic2024-03-14 14:40
Reportermprey Assigned Tohcpizzi  
PrioritynormalSeverityminor 
Status resolvedResolutionfixed 
Product Version3.2 
Target Version3.2.4Fixed in Version3.2.4 
Summary0003057: Bound Image Texture Source does not update correctly at runtime
Description

Runtime redrawing of a Texture2D is not correctly recognized by Noesis as a change, even with On Notify Changed

(See also https://www.noesisengine.com/forums/viewtopic.php?t=3196)

Steps To Reproduce

1) Bind Image Source of a Image control to a BP Texture2D variable
2) At runtime I overwrite the Texture2D and re-set the BP variable with Notify Changed but Noesis will not recognize the change and update the Image after the first time

Attached Files
heightmapBP (1).png (40,453 bytes)   
heightmapBP (1).png (40,453 bytes)   
PlatformAny

Activities

hcpizzi

hcpizzi

2024-02-01 17:55

developer   ~0009150

When you say you're overwriting the Texture2D object, do you mean that it is the same Texture2D object and you're replacing the internal TextureRHI?

mprey

mprey

2024-02-01 18:42

reporter   ~0009151

That is correct, I am operating on the same object and just calling UpdateResource at the end

hcpizzi

hcpizzi

2024-02-28 23:48

developer   ~0009264

Sorry this took so long. Could you please try the attached patch? This fixes a similar issue we have when new texture mip levels are streamed in or out.

TextureStreaming.patch (2,253 bytes)   
Index: NoesisRenderDevice.cpp
===================================================================
--- NoesisRenderDevice.cpp	(revision 13468)
+++ NoesisRenderDevice.cpp	(working copy)
@@ -102,7 +102,7 @@
 	}
 	// End of Texture interface
 
-	FTexture2DRHIRef ShaderResourceTexture;
+	FTextureRHIRef ShaderResourceTexture;
 	uint32 Width;
 	uint32 Height;
 	uint32 NumMipMaps;
@@ -1640,35 +1640,22 @@
 	{
 		UTexture2D* Texture2D = (UTexture2D*)InTexture;
 		Texture = *new FNoesisTexture(Texture2D);
-		FTexture2DResource* Resource = (FTexture2DResource*)TextureResource;
-		// Usually the RHI resource is ready when we create the texture.
-		// However, when we are hot-reloading a texture, UE4 enqueues the
-		// creation to the render thread, so we must do the same.
-		FTexture2DRHIRef TextureRef = Resource->GetTexture2DRHI();
-		if (TextureRef)
-		{
-			check(Texture->Width >= TextureRef->GetSizeX());
-			check(Texture->Height >= TextureRef->GetSizeY());
-			check(Texture->NumMipMaps >= TextureRef->GetNumMips());
-			Texture->ShaderResourceTexture = TextureRef;
-		}
-		else
-		{
-			ENQUEUE_RENDER_COMMAND(FNoesisInstance_InitRenderer)
-			(
-				[Texture, Resource](FRHICommandListImmediate&)
+
+		auto& TextureReference = InTexture->TextureReference;
+		ENQUEUE_RENDER_COMMAND(FNoesisInstance_InitRenderer)
+		(
+			[Texture, &TextureReference](FRHICommandListImmediate&)
+			{
+				FTextureRHIRef TextureRef = TextureReference.TextureReferenceRHI.GetReference();
+				if (TextureRef.IsValid() && TextureRef->IsValid())
 				{
-					FTexture2DRHIRef TextureRef = Resource->GetTexture2DRHI();
-					if (TextureRef)
-					{
-						check(Texture->Width >= TextureRef->GetSizeX());
-						check(Texture->Height >= TextureRef->GetSizeY());
-						check(Texture->NumMipMaps >= TextureRef->GetNumMips());
-						Texture->ShaderResourceTexture = TextureRef;
-					}
+					check(Texture->Width >= TextureRef->GetSizeX());
+					check(Texture->Height >= TextureRef->GetSizeY());
+					check(Texture->NumMipMaps >= TextureRef->GetNumMips());
+					Texture->ShaderResourceTexture = TextureRef;
 				}
-			);
-		}
+			}
+		);
 	}
 	else if (InTexture->IsA<UTextureRenderTarget2D>())
 	{
 
TextureStreaming.patch (2,253 bytes)   
mprey

mprey

2024-03-14 04:10

reporter   ~0009329

Sorry late for response. Yes this works now, thanks!

hcpizzi

hcpizzi

2024-03-14 14:40

developer   ~0009331

Brilliant! Marking this as resolved.

Issue History

Date Modified Username Field Change
2024-02-01 08:24 mprey New Issue
2024-02-01 08:24 mprey File Added: heightmapBP (1).png
2024-02-01 09:38 jsantos Assigned To => hcpizzi
2024-02-01 09:38 jsantos Status new => assigned
2024-02-01 09:38 jsantos Target Version => 3.2.4
2024-02-01 17:55 hcpizzi Note Added: 0009150
2024-02-01 18:42 mprey Note Added: 0009151
2024-02-28 23:48 hcpizzi Note Added: 0009264
2024-02-28 23:48 hcpizzi File Added: TextureStreaming.patch
2024-02-28 23:48 hcpizzi Status assigned => feedback
2024-03-14 04:10 mprey Note Added: 0009329
2024-03-14 04:10 mprey Status feedback => assigned
2024-03-14 14:40 hcpizzi Status assigned => resolved
2024-03-14 14:40 hcpizzi Resolution open => fixed
2024-03-14 14:40 hcpizzi Fixed in Version => 3.2.4
2024-03-14 14:40 hcpizzi Note Added: 0009331