Search Unity

Feature Request Add Dropdown menu to Parallax Occlusion Mapping node for channel selection.

Discussion in 'Shader Graph' started by JJRivers, Aug 11, 2021.

  1. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    The title says what, as to why you would want that, to allow texture channel packing to reduce the number of textures loaded to the GPU,

    As someone already explained to me there is a good reason why the node requires a texture to function, but the user should have the option of choosing the channel, if say the users project already uses mask or detail maps and they have an empty channel there or if they already have a suitable map in their textures but not on the red channel, they should be able to feed that to the node and pick from a dropdown menu which channel from RGBA is used by the POM.
     
    PutridEx and Invertex like this.
  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,546
    It's a bit unfortunate they haven't implemented that yet. All they need to do is add a 0-3 range integer property on the node and use it as the channel index for the sampled texture. Performance should still remain optimal in existing use cases of the node as the value wouldn't have been driven by per-fragment calculated sources and thusly the shader compiler would be able to see the value isn't changing per-fragment.

    I created an example Custom Function node that does just this:
    https://github.com/Invertex/ShaderGraph-Parallax-Mapping-Node-with-Channel-Select/blob/main/POM.hlsl
    I've also included a basic ShaderGraph file with it setup with adequate values.
     
    Last edited: Jan 13, 2022
    JJRivers likes this.
  3. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    And the hero comes to the rescue again!
    Thank you
     
    Invertex likes this.