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

Add Channel Remap settings to ResourceImporterTexture #99676

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BlueCube3310
Copy link
Contributor

@BlueCube3310 BlueCube3310 commented Nov 25, 2024

Fixes godotengine/godot-proposals#11243

Depends on #98071
Alternative to #81803

Adds color channel remap options to ResourceImporterTexture. These settings are part of the processing pass of the import operation, and allow discarding/replacing/overwriting the color channels of an imported image.

The following options are provided for each channel:

  • Red,
  • Green,
  • Blue,
  • Alpha,
  • Inverted Red,
  • Inverted Green,
  • Inverted Blue,
  • Inverted Alpha,
  • Unused (1 for alpha, 0 for others),
  • Zero,
  • One

The other processes (such as format optimization) happen after this one, which makes it possible to remove unneeded color channels (like alpha), and the following steps (like compression) will take that into account (for instance by compressing as DXT1 instead of DXT5).

@fire
Copy link
Member

fire commented Nov 25, 2024

cicd wants documentation.

@Calinou Calinou added this to the 4.x milestone Nov 25, 2024
Comment on lines +68 to +81
<member name="process/channel_remap/alpha" type="int" setter="" getter="" default="3">
Specifies the data source of the image's alpha channel.
[b]Red:[/b] Use the values from the red channel.
[b]Green:[/b] Use the values from the green channel.
[b]Blue:[/b] Use the values from the blue channel.
[b]Alpha:[/b] Use the values from the alpha channel.
[b]Red Inverted:[/b] Use inverted values from the red channel ([code]1.0 - R[/code]).
[b]Green Inverted:[/b] Use inverted values from the green channel ([code]1.0 - G[/code]).
[b]Blue Inverted:[/b] Use inverted values from the blue channel ([code]1.0 - B[/code]).
[b]Alpha Inverted:[/b] Use inverted values from the alpha channel ([code]1.0 - A[/code]).
[b]Unused:[/b] Set the color channel's value to the default ([code]1.0[/code] for alpha, [code]0.0[/code] for red, green or blue).
[b]Zero:[/b] Set the color channel's value to [code]0.0[/code].
[b]One:[/b] Set the color channel's value to [code]1.0[/code].
</member>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those repeated descriptions hurt, feels like these really should be an enum...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they're unavoidable though, since the main purpose of these property descriptions is to show up in an inspector tooltip:
godot windows editor x86_64_miJUimUAnV

Changing the values to an enum and moving the full descriptions to the enum would mean that you have to open the docs and navigate away from the importer to see the descriptions of what each item does. Oh well.

Copy link
Member

@Calinou Calinou Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the values to an enum and moving the full descriptions to the enum would mean that you have to open the docs and navigate away from the importer to see the descriptions of what each item does. Oh well.

We have something that handles this in the inspector, but not in the import options, export options, project settings or editor settings yet.

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

Successfully merging this pull request may close these issues.

Allow remapping the color channels of a texture on import
4 participants