Hi,
I want to import normal map at runtime but there is issue.
As follow images, left floor is load normal map at runtime and right floor is imported same normal map to Asset.
A light is front of floors, and you can see the specular of right floor is correct, but left one incorrect.
Here is the coed of loading external image:
if (ImageWrapper.IsValid() && ImageWrapper->SetCompressed(RawFileData.GetData(), RawFileData.Num()))
{
TArray<uint8> UncompressedBGRA;
if (ImageWrapper->GetRaw(ERGBFormat::BGRA, 8, UncompressedBGRA))
{
Texture = UTexture2D::CreateTransient(ImageWrapper->GetWidth(), ImageWrapper->GetHeight(), PF_B8G8R8A8);
if (!Texture)
{
return false;
}
Width = ImageWrapper->GetWidth();
Height = ImageWrapper->GetHeight();
void* TextureData = Texture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
FMemory::Memcpy(TextureData, UncompressedBGRA.GetData(), UncompressedBGRA.Num());
Texture->PlatformData->Mips[0].BulkData.Unlock();
Texture->UpdateResource();
}
}
Here is the Material node
I tried to finding older post, but it’s cannot resolved my problem.
Thank very much if someone can help.