cpichard / usdtweak

Universal Scene Description standalone editor
Apache License 2.0
233 stars 23 forks source link

Black Viewport on Linux #20

Open ScatteredRay opened 1 week ago

ScatteredRay commented 1 week ago

I'm getting a black viewport running on Linux. Initially, I found that pxr/garch doesn't support EGL, and can't capture the context on wayland. But forcing to run under XWayland, I get a black viewport.

SS-2024+07+09-12-44-841746933

Here is my console output:

Settings: /home/indy/.usdtweak_gui.ini
AMD
AMD Radeon RX 6800 XT (radeonsi, navi21, LLVM 18.1.8, DRM 3.54, 6.6.45)
OpenGL 4.6 (Compatibility Profile) Mesa 24.1.5
GLSL 4.60
USD 2405
glxContext: 0x21f2f40
PXR_PLUGINPATH_NAME:
rawContext1
Reading blueprints
Blueprints ready
Warning: In image "/home/indy/dev/RenderWitch/assets/venice_sunrise_4k.exr" mip level 1 does not exist [usdtweak]

I tried a capture from RenderDoc, and don't seem to see any element from the scene in the capture. SS-2024+07+09-12-41-382066823

Any thoughts on things I could do to start to diagnose this issue?

cpichard commented 1 week ago

Hi @ScatteredRay , thanks for the bug report. I have seen similar issues previously, the one I had been able to repro was fixed by updating the drivers, it was on an intel integrated graphic card. I am not sure about amd cards, but I would say the first thing I would do is make sure the drivers are the latest one. On the amd web site I see the drivers are 24.x.x and here the log reports 6.x.x, may be updating them could fix the issue ?

Then I would start checking if usdview works or has the same issue. usdview is pretty similar to usdtweak in terms of viewport rendering, so if usdview works and usdtweak doesn't then it has likely to do with opengl code. In that case I would look for opengl errors at each calling site with a debugger or whatever works to instrument the calls.

Hope that helps, unfortunately I don't have a similar setup around to debug, I'll ask around see if I can find that. Thanks

ScatteredRay commented 1 week ago

I think 6.x.x is the Radeonsi version, because I don't think my drivers are that out of date. I could try the proprietary drivers, but usdview, and all other instances of hdStorm seem to run fine on my local machine. So it seems like it should be possible to get usdtweak to do the same.

Do you have some likely cullprits to start with as far as calling sites go?

Thanks, Indy

cpichard commented 1 week ago

Are storm and usdview coming from the same usd libs usdtweak is compiled with ? If so, you are right, usdtweak should be working as well. I would first try to recompile usd with embree and check if embree is working or not as this would highlight if this is a problem with storm of the thin layer used in ut to pass the hydra render to imgui. There are few sites that are interesting to check: To start Hydra rendering is launched here https://github.com/cpichard/usdtweak/blob/8b72b4f978f1a638053b985ff997eae67fe6efc2/src/main.cpp#L190

and the UI drawing is done here: https://github.com/cpichard/usdtweak/blob/8b72b4f978f1a638053b985ff997eae67fe6efc2/src/main.cpp#L201

When a viewport is created, it creates an OpenGL buffer here (a DrawTarget): https://github.com/cpichard/usdtweak/blob/8b72b4f978f1a638053b985ff997eae67fe6efc2/src/viewport/Viewport.cpp#L66 I have seen that the bit depth of the attachement might not be compatible on old cards, but that's unlikely in your case as you have a recent card, might worth checking though

The Render function is where hydra renders in the DrawTarget: https://github.com/cpichard/usdtweak/blob/8b72b4f978f1a638053b985ff997eae67fe6efc2/src/viewport/Viewport.cpp#L435 It follows what usdview is doing almost line by line. I would probably start by commenting as much code as possible and leave the glClearColor with a different color, to check if the opengl buffer is correctly displayed. Then look for errors ...

Then utimaltely the UI draws the drawtarget on the display here: https://github.com/cpichard/usdtweak/blob/8b72b4f978f1a638053b985ff997eae67fe6efc2/src/viewport/Viewport.cpp#L119

Hope that helps, let me know if I can help further

C

ScatteredRay commented 1 week ago

Yeah, same usd libs for both usdtweak, and usdview.

Additionally, already tried embree, it works in usdview, but not in usdtweak.

Thanks for the recommendations.