Weird behaviour on dynamic texture + curved mesh

Hey guys,

I’ve been getting weird behaviour when trying to update the texture of a dynamic material applied to a curved mesh.

When I import the mesh and apply my base material (the one being used as a base for my dynamic material), the mesh displays correctly:

As you can see, it appears curved and normal.

Now, as I update the texture data on this mesh dynamically, I start seeing deformations in the way that the mesh is rendered:

Ignore the actual image being displayed, as the UVs are off; you can see however that the mesh has been flattened and the texture gets squished along the edges where a curve should exist.

The texture code I’m using is here:

			if (newtex == nullptr || (sizeOfLastTexture != uncompressedBGRA->Num())) {
				if (newtex != nullptr) {
					FlushRenderingCommands();
					newtex = nullptr;
				}

				newtex = UTexture2D::CreateTransient(ImageWrapper->GetWidth(), ImageWrapper->GetHeight());
				
				newtex->CompressionSettings = TextureCompressionSettings::TC_Default;
				//newtex->MipGenSettings = TextureMipGenSettings::TMGS_NoMipmaps;HFYTJ
				newtex->RefreshSamplerStates();
				

				void* TextureData = newtex->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
				FMemory::Memcpy(TextureData, uncompressedBGRA->GetData(), uncompressedBGRA->Num());
				newtex->PlatformData->Mips[0].BulkData.Unlock();

				sizeOfLastTexture = uncompressedBGRA->Num();
				newtex->UpdateResource();
				ChangeTexture(newtex);

I imagine something I’m doing here is wrong, though I can’t seem to figure out what it is.

Any thoughts?

-Paul

I’m dumb. Was a scaling issue with the z axis from when I was doing other things.

Marking as resolved