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

Channel Selector / Separator Dropdown #30

Closed
cityrobo opened this issue Feb 12, 2023 · 13 comments
Closed

Channel Selector / Separator Dropdown #30

cityrobo opened this issue Feb 12, 2023 · 13 comments

Comments

@cityrobo
Copy link

Is your feature request related to a problem? Please describe.
For game asset research I am often faced with textures that included different types of information in separate channels of an image. For example, in the Unity engine standard shader, the roughness of the material is stored in the alpha channel of the metallic texture, or there are even further packed maps that include Ambient Occlusion, Metallicity, Specularity and Roughness into one picture, stored in the red, green, blue and alpha channel respectively.

Describe the solution you'd like
I would like to have a drop down or other kind of interface that allows me to explicitly only show a single channel as a greyscale picture so one can analyze the contents of such packed maps more efficiently. Oculante (another open source image viewer) has such a button, but it doesn't support all the exotic image formats (primarily DDS and BC5n) that I require for my research.
A simple dropdown or button interface that allows me to select RGBA, RGB, R, G, and B channels would make my life a lot easier, now that I have finally found an image viewer that can actually flawlessly open all the weird textures I am dealing with. Especially normal maps in the DDS format compressed with BC5n, that only have two channels, are finally able to be opened without having to convert them with texconv beforehand.

Describe alternatives you've considered
I have noticed that I can achieve this with the equations and the r(), g(), b(), and a() functions, but that is a lot of work compared to simply clicking a button, albeit it is quite useful for comparing the different channels to each other.

Additional context
here you can see the drop down from Oculante in the top left corner. The image viewer in the Blender 3D modeling software also has such a dropdown, but it's not exactly meant as a stand alone image viewer for quickly opening up images.
image

@kopaka1822
Copy link
Owner

kopaka1822 commented Feb 12, 2023

Hi,
so I thought about this a little bit.
If I implement a dropdown, I would add this to the menu bar via View->Pixel Display: Channels (with your proposed dropdown).
In this case, the image will be displayed with all colors, but the status bar will only show the selected channels.

An alternative I thought of would be to automatically detect if the image is grayscale (I already check for an alpha channel anyways). In the case of a grayscale image I could only display a single number in the status bar (This would be for the r(), g(), b() cases).

*Let me know what you prefer

@cityrobo
Copy link
Author

maybe another example would be good:

image

Top left is the source image that has all kinds of information stored in the RGBA channels.

I'm currently using the equations feature to separate them, but I would like to have a full image display toggle that basically just hides all the other channels and only displays one channel as a greyscale image.

in Oculante you can do this with this drop down menu.
image
image

Something like that on the bottom bar would be really neat to have for me.
image

And as I mentioned, your program is the first one to accurately display the file types I work with without having to convert them first, and I really like the equations and comparison features your program offers.

@kopaka1822
Copy link
Owner

Ah okay,
I think I understand it better now.
I could add such a dropdown menu in the status bar.
A few questions:

  • Should the pixel colors in the status bar only display the selected channels? Or all channels?
  • What happens on export? I would assume this is just a "view" filter, so if I export the texture, I would still export all available channels instead of the channels filtered by the dropdown. (What would be your expected behavior in this case?)
  • Are you able to compile the project by yourself? Or would you like me to attach the new .exe file when I'm done?

@cityrobo
Copy link
Author

  • I believe it would be logical if it displayed the Greyscale value of the selected pixel on the channel that is currently being displayed.
  • for my purposes, being able to export individual channels as a greyscale image is very valuable. if that is a possible feature, that would be great!
  • I'm currently pulling the project but I'm not sure if there are any prerequisites that I might need. In any case, there are probably other people who would appreciate these features! An official release sounds like the best option. Albeit I would be willing to compile it for testing purposes, of cause.

kopaka1822 added a commit that referenced this issue Feb 13, 2023
@kopaka1822
Copy link
Owner

Hi,
I added a dropdown menu to the status bar like suggested. The pixel color format will be automatically detected from now on (if you work with a grayscale image, you will only see a single value). Let me know when you need additional changes.
For build instructions see: https://github.com/kopaka1822/ImageViewer/blob/master/Docs/build.md
If this is too complicated (if you don't work with visual studio) I can compile an executable for you (let me know).

@cityrobo
Copy link
Author

cityrobo commented Feb 13, 2023

I only have Visual Studio 2022 installed, and even after a bit of messing around it still doesn't want to compile the DxImageLoader.dll because it can't find gli/format.hpp, and after setting the path to the file correctly, another 921 errors appear.
there probably went something majorly wrong either when I pulled it or when VS tried to update it to 2022.

A working compiled executable would be much appreciated!

@kopaka1822
Copy link
Owner

ImageViewer3_6_8445.zip

@cityrobo
Copy link
Author

this is amazing! this is exactly what I have been looking for! Such a great texture analysis tool you have created here! The combination of being able to open all these weird DDS texture compression formats without any messing around plus the ability to only display single channels at a time is something I have not found in any other stand alone image viewer, so thank you very much for considering my feature request and implementing it so perfectly.

@cityrobo
Copy link
Author

I have found a bug where when you have only the RGB channels selected through the drop down, it exports the red channel only instead of the RGB channels with alpha removed / set to white.

@kopaka1822
Copy link
Owner

I think I fixed the bug you mentioned.
I belive that the source was an incorrect format suggestion in the export dialog:
image
In the old version, sometimes the format R8_SRGB was set as the default choice instead of RGB8_SRGB (This was probably the error?).
I have fixed the suggestion in the new version.
However, note that if your image is actually grayscale (red=green=blue) it will still recommend R8 as the first choice, because it saves memory. If you want to forcefully export a grayscale image as RGB8 you need to adjust the format in the dropdown.

Replacing the .exe should suffice:
ImageViewer.zip

@kopaka1822
Copy link
Owner

@cityrobo Does everything work now or did you encounter new issues?

@cityrobo
Copy link
Author

Sorry for the long delay.

The last time I tried it, the export settings still didn't update to the selected channel.
When I had RGB selected, the export was still set to R-only and I had to manually select the RGB export from the drop down once I was in the export window.

Not a huge issue, just something that a new user could stumble over.

@kopaka1822
Copy link
Owner

This is now included in the latest official release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants