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

Material editor 2099 #323

Closed
wants to merge 9 commits into from

Conversation

Exter-N
Copy link
Contributor

@Exter-N Exter-N commented Aug 24, 2023

See also Ottermandias/OtterGui#3 and Ottermandias/Penumbra.GameData#1.

Shaders tab

  • Add fail-safe mode if running on a platform that doesn't support disassembling shaders (some versions of Wine seem to support it, others not): still allow inspecting and editing the parts that don't require disassemblies, only disable the parts that do ;
  • Rearrange some of the data from "Further Content" into new sections "Shader Resources" and "Shader Selection".

Materials tab

Color Sets

  • Add a header, that is unfolded by default, but allows folding the entire section ;
  • Improve color accuracy (see also chirpxiv/PalettePlus@04e2536, Improve color accuracy in extended appearance imchillin/Anamnesis#1322 – Different data structure, but still the same color encoding quirk) ;
  • Add a "Dyeable" check box that turns a non-dyeable color set into a dyeable one and conversely ;
  • Add a crosshair "button" that, on hover, attempts to make the corresponding row blink on your character, weapons, fashion accessory, minion and/or mount ;
  • Make the Gloss Strength slider non-linear (by hand instead of using ImGui's logarithmic slider flag because it behaves badly when min and max are too far away) ;
  • Make the Paste All Rows button disabled when the file is read-only ;
  • Improve small things on most fields (bound checks, formatting, …) ;
  • Remove the dye columns entirely when the color set is not dyeable ;
  • Assume, for some purposes, that there is at most one color set with rows, as the client's structures do not allow for more ;
  • See also "Live Preview" and "Shaders".

Live Preview

  • Add a live preview system on materials:
    • When opening a material file, it attempts to bind to instances of this file on the local player, including weapons, fashion accessory, minion and/or mount ;
    • Shader Flags (and the checkboxes for parts of this field) will be reflected in real time ;
    • Sampler Flags (and the new sub-fields for parts of this field) will be reflected in real time ;
    • Color Set will be reflected in real time – Selecting a preview dye will apply it on the live preview ;
    • Material Constants will be reflected in real time ;
    • Ending the editing session (by choosing another material, or closing the editor window) will revert the material to its state before the editing began ;
    • Making the changes permanent still requires a save and redraw/rezone/… ;
  • Known issue: it seems that, in some cases, ending the editing session after saving and redrawing can turn the material into some combination of the before and the after, stable but looking wrong – Redrawing/rezoning/… again fixes it for good. (should be fixed by 5346aba)

Samplers and Textures

  • Add a header, that is unfolded by default, but allows folding the entire section ;
  • Make the texture rows unfoldable: unfolding them will show the Texture and Sampler Flags ;
  • Add a checkbox for the only useful bit of the Texture Flags (namely, the -- prefix on DX11) ;
  • Add clearer fields for the known useful bits of the Sampler Flags (UV Address Mode, LoD Bias, Min LoD) ;
  • Give a default path to all added textures, that points to an actual vanilla texture, to avoid crashes due to path-less textures ;
  • See also "Live Preview", "Shaders" and "Dev-Kit Files".

Shaders

  • Rearrange the fields into their own section ;
  • Replace the Shader Package free text field by a list box:
    • The box gives choices that are pulled from the EXE ;
    • Some shader packages are hidden from this list because they cause issues, and they don't seem to be intended for use in materials ;
    • More choices will be dynamically pulled from the current collection and mod by looking at file redirections that start with shader/sm5/shpk/ ;
  • Rework the algorithm that determines which shaders are actually gonna be used depending on shader keys: the new algorithm gives an authoritative result ;
  • Treat the material as invalid if the shaders cannot be determined for sure (which indicate a combination of shader keys that can result in game crashes) ;
  • Automatically add and remove color set, sampler/texture pairs, shader keys and material constants depending on the needs of the selected shaders – Consequently, the buttons to add and remove them by hand have been removed, thereby preventing crashes due to missing samplers for the selected shader ;
  • See also "Dev-Kit Files".

Material Constants

  • Rearrange the fields into their own section ;
  • Add various editor components that can display and edit constants in several ways (floats, integers, colors, enums) ;
  • See also "Live Preview", "Shaders" and "Dev-Kit Files".

Dev-Kit Files

  • Add a system where JSON files can be installed to provide editing context:
    • Example: MDK.zip – This is a PMP, GitHub doesn't allow non-well-known extensions ;
    • Two paths will be looked up: penumbra/shpk_devkit/{ShPk name}.json (for example, for character.shpk, …/character.json) and penumbra/shpk_devkit/_base.json ;
    • These files can provide user-friendly labels and ℹ️ tooltips for shader keys (and their values), textures/samplers, constants (and their values, in the case of enums) ;
    • They can provide a shader comment that will be displayed below the list of selected shaders, for example to explain what the shader set is usually for, or its vertex paint semantics ;
    • They can provide more sensible default texture paths for specific samplers ;
    • They can provide configuration for constants (slices, show/hide, type, editor component settings, enum values) ;
    • They can group related constants together ;
    • If both files exist and contain data about the same element, the ShPk-specific one takes precedence ;
    • All the data elements (except the shader keys themselves) have access to the shader key values, to be able to provide better shader-specific context (for example, in skin.shpk, lip-specific constants are only relevant for the face shaders).

@Exter-N Exter-N marked this pull request as draft August 24, 2023 23:33
@Exter-N Exter-N marked this pull request as ready for review August 25, 2023 18:12
@Exter-N
Copy link
Contributor Author

Exter-N commented Aug 31, 2023

82cecda

@Exter-N Exter-N closed this Aug 31, 2023
@Exter-N Exter-N deleted the feature/material-editor-2099 branch August 31, 2023 17:13
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

Successfully merging this pull request may close these issues.

1 participant