UnrealImageCapture icon indicating copy to clipboard operation
UnrealImageCapture copied to clipboard

Rendering PNG not working

Open csongorkeller opened this issue 3 years ago • 13 comments

Hi there, I've tried rendering PNGs in the sample project and it doesn't generate anything. It first the image taking flow but then the folder remains empty... Do you have any idea where to start looking to fix it?

csongorkeller avatar Oct 19 '21 15:10 csongorkeller

Hey, does this issue remain for you? I just tested color image generation for .jpeg and .png settings, also in sequence. and I could not reproduce. I also checked the git to make sure I did not forget to push anything lately, because I remembered that I indeed had this issue a while back.

TimmHess avatar Nov 03 '21 15:11 TimmHess

I have a similar problem. If i generate a float it doesnt create any file. If i generate a PNG it creates a file but its all transparent

MrDasix avatar Jan 24 '22 12:01 MrDasix

Ok, I will certainly take another good look at this, however, it might take some days as I am currently away from my workstation. I will come back to you though

TimmHess avatar Jan 24 '22 14:01 TimmHess

Thanks! I have seen that if i use the plugins happens what i said, but if i use the project from the repo it creates exr files. Dunno how to open them in a correct format tho

MrDasix avatar Jan 24 '22 14:01 MrDasix

Oh thank you for that hint! That will be useful. You need a format like exr because you cannot save float values in uint8 encoded png by default. You can take a look at the openexr library for python. Thats what I use

TimmHess avatar Jan 24 '22 15:01 TimmHess

Okay, sorry. Now i created another empty project. Imported the UE5 plugin. Added a Blueprint of type CameraCaptureManager and attached a scenecapture. Now it works, but the JPG and EXR photos are all black.

`pt = Imath.PixelType(Imath.PixelType.FLOAT) img = OpenEXR.InputFile("img_000000.exr") dw = img.header()["dataWindow"] size = (dw.max.x - dw.min.x +1, dw.max.y - dw.min.y +1)

R,G,B = [np.asarray(Image.frombytes("F", size, img.channel(Chan,pt)), dtype=np.uint8) for Chan in ("R", "G", "B") ]

img_rgb = cv2.merge([B, G, R])

print(img_rgb)

cv2.imshow("Hey",img_rgb) cv2.waitKey(0) cv2.destroyAllWindows()`

This is what im using to read the exr file

MrDasix avatar Jan 24 '22 15:01 MrDasix

Yea for some reason I had the same issue with numpy.. You can try openexr lib, but if the jpeg is likewise black something will be off most likely.

TimmHess avatar Jan 24 '22 15:01 TimmHess

Okay, maybe i'm dumb and everything was right on the begining. I was capturing the image on BeginPLay event, and that was the problem. Now the plugin works flawless. Thanks you very much!

MrDasix avatar Jan 25 '22 15:01 MrDasix

Ahh yes.. that will explain the issue. Thank you for sharing this. Great to hear everything is working :) 👍

TimmHess avatar Jan 25 '22 16:01 TimmHess

In UE5, I was also getting black textures, but I found out that it was only occurring on models using Nanite.

Lap1n avatar Feb 06 '22 04:02 Lap1n

Thank you for letting me know! Just to clarify - black textures on Nanite objects in the capture color image? That is definitely odd... I did not yet test with Nanite objects, merely with MetaHuman :/

TimmHess avatar Feb 06 '22 20:02 TimmHess

Forgot to clarify, it was with segmentation capture images that the color was black.

Lap1n avatar Feb 08 '22 01:02 Lap1n

Alright, yes this will be because of Nanite seemingly not supporting a number of features (yet), amongst them - custom depth stencils: https://forums.unrealengine.com/t/solved-vertex-painting-mesh-not-working-for-imported-meshes/267082/2

Sadly those are this project's source of annotation buffer... So I think this is currently not fixable, sorry :/

TimmHess avatar Feb 08 '22 07:02 TimmHess