Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: mouse hover over color map panel editor turns volume black #757

Open
smlpt opened this issue May 28, 2024 · 3 comments
Open

Bug: mouse hover over color map panel editor turns volume black #757

smlpt opened this issue May 28, 2024 · 3 comments
Labels
bug Issue contains a bug

Comments

@smlpt
Copy link
Contributor

smlpt commented May 28, 2024

328846765-05e42f2b-e950-4a5e-8239-11d2d7d2f91b

The bug is likely caused by repainting the colormap panel and loading the color map from buffer here, introduced in this commit.

The issue was moved here from this sciview issue.

@odinsbane
Copy link

I played around with it a bit, and this line appears to be the culprit. The returned colormap always seems to be black.

@odinsbane
Copy link

I was looking at Colormap.kt, and I am not sure I understand what it does.

When I look at Colormap#sample I expect it should interpolate the color along the center line of the byte buffer. globalOffset seems to make some assumptions that aren't always true.

val globalOffset = width * 4 * height / 2

This assumes the buffer is always 4 bytes per sample and the height is greater than 1.

I know the first assumption can be wrong from based on Image#bufferedImageToRGBABuffer

raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, texWidth, texHeight, 3, null)

That occurs if the provided image doesn't have an alpha component. Which will create a 3 byte version. I think that clause should be removed and make a 4 byte raster either way. Java should draw the image ok and the buffer will always be 4 bytes.

How should a Colormap#fromColor work?

Currently it starts at the target color and ends at black. It also ignores the A component of the provided color. This seems to contradict the ColormapPanel where a "yellow.lut" is drawn from left to right.

If I understand the Colormap a bit better I could make a pull request regarding this issue.

@odinsbane
Copy link

The problem is caused by this line in ColormapPanel The gradient image is only being filled halfway because of the h-10. Then sample is taking the "center" of the buffered image which happens to be a section that is blank.

odinsbane pushed a commit to odinsbane/scenery that referenced this issue May 30, 2024
with odd h values. Issue scenerygraphics#750

Made a hot fix for generating an image form the ColormapEditor the image
was only halfdrawn. Issue scenerygraphics#757
skalarproduktraum pushed a commit that referenced this issue Aug 7, 2024
with odd h values. Issue #750

Made a hot fix for generating an image form the ColormapEditor the image
was only halfdrawn. Issue #757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue contains a bug
Projects
None yet
Development

No branches or pull requests

2 participants