ComputationalBiomechanicsLab / opensim-creator

A UI for building OpenSim models
https://opensimcreator.com
Apache License 2.0
137 stars 16 forks source link

Fix window appears to be very dark in >0.5.0 on Intel HD 530 #764

Closed adamkewley closed 10 months ago

adamkewley commented 10 months ago

Reported by @AdrianHendrik

The renderer is creating very dark renders on this specific hardware:

MicrosoftTeams-image

The GPU is a little old (roughly 2015 release date - reported as 2955 days old or so), so it may be suggested that new drivers are installed - although, Intel dropped this range before they got around to implementing OpenGL 4.4, so it's probably an older driver range.

However, I'll use this opportunity to add any necessary detection code to OpenGL to try and report the problem to the user (and maybe have runtime fallbacks, but supporting older GPUs might not be worth it because Intel has really improved in the last 3 or 4 years).

adamkewley commented 10 months ago

Hi @AdrianHendrik, would it be possible for you to install this newer version of OSC:

https://github.com/ComputationalBiomechanicsLab/opensim-creator/actions/runs/6099949191

And copy+paste the log (there's a copy to clipboard button) to here? I've added some basic runtime checks to the OpenGL part of OSC to try and figure out exactly what the limitation is.


Additionally, if your laptop permits, could you try to install newer graphics drivers? The driver list for older graphics products is here:

This is unlikely to fix anything--your driver is from late-2020, so it's not as old as the hardware (https://www.graphics-drivers.eu/drivers-for-intel-build-8853.html)--but it might fix it for you before I get a chance to figure out what changes I may need to make to OSC.

AdrianHendrik commented 10 months ago

Hi @adamkewley, I've downloaded the newer version. Here is the log:

[info] enabling backtrace handler [info] initializing main application window [info] initializing OpenGL context [info] OpenGL: the following OpenGL extensions may be missing from the graphics backend: [warning] OpenGL: - GL_EXT_framebuffer_sRGB [warning] OpenGL: - GL_EXT_texture_object [warning] OpenGL: - GL_EXT_vertex_array [warning] OpenGL: because extensions may be missing, rendering may behave abnormally [warning] OpenGL: note: some graphics engines can mis-report an extension as missing [info] OpenGL initialized: info: Intel, Intel(R) HD Graphics 530, (3.3.0 - Build 27.20.100.9416), GLSL 3.30 - Build 27.20.100.9416 [info] setting locale to US (so that numbers are always in the format '0.x' [info] removing OpenSim's default log (opensim.log) [info] attaching OpenSim to this log [info] registering OpenSim types [info] registering OpenSim geometry search path to use osc resources [info] added geometry search path entry: C:\Program Files\OpenSimCreatorTest\resources\geometry [info] showing screen class osc::MainUIScreen

adamkewley commented 10 months ago

Thanks for that @AdrianHendrik

Your GPU is reporting that it may not support sRGB framebuffers (GL_EXT_framebuffer_sRGB), which may be what is causing the darkness, but a separate check I added in 2079d4b is reporting that GL_FRAMEBUFFER_SRGB was successfully set, which might be a contradiction from the driver.

I have also previously seen that Intel GPUs can be a little bit spotty about reporting extension support (e.g. they'll report a GPU extension as missing but it's actually available), so I have made 2 new changes:

Once those have built via GitHub Actions (1-2 hours), I'd like you to give it a spin:

adamkewley commented 10 months ago

The latest round of changes are semi-related to this, but might actually make your life a little more annoying @AdrianHendrik

I had to downgrade the OpenGL log messages from warn to debug in preparation for the 0.5.2 release. This is because I anticipate that users will start reporting bugs to me if they start seeing warnings in the logs (and many of these OpenGL warnings are spurious because some GPUs mis-report extensions).


So, starting at 6da0257 and beyond, OSC now supports a log_level parameter in its configuration file:

However, if you are installing OSC over an existing configuration then the configuration file may not be updated. This is because I don't want to overwrite any potentially-user-edited configuration files.


Practically, what this means is that, for OSC builds after 6da0257, to see OpenGL debugging messages then you'll have to:

Unfortunately, changing the log level via the UI (e.g. in the log panel) won't work in this particular case because the thing we want to debug (initializing OpenGL) happens before the log UI etc. is booted.

AdrianHendrik commented 10 months ago

After installing build f9ed1e9 and following your instructions it looks like the the gui has returned to its intended brightness. Here is a screenshot to compare: image (left: build f9ed1e9, right: older build)

Attached is the output log of the new build. OSC output build f9ed1e9.txt

adamkewley commented 10 months ago

Oh lovely @AdrianHendrik ! - what a weird bug!

I think that specific GPU requires saying sRGB specifically before the window is initialized, but it's great that it now works!

adamkewley commented 10 months ago

Thanks again @AdrianHendrik !