QUESTION SHADER REPLACEMENT Keep transparency of the material

Discussion in 'General' started by Ternal, Apr 24, 2022.

  1. Ternal

    Ternal Member

    Joined:
    Feb 25, 2018
    Messages:
    86
    Likes Received:
    9
    As in the question:

    i've changed a the shader of a material from ksGrass to ksMultilayer, added everything and everything works fine except the transparency of the material, which now became solid. Tried to add transparency but nothing changes

    [SHADER_REPLACEMENT_...]
    SHADER = ksMultilayer
    BLEND_MODE = ALPHA_BLEND
    IS_TRANSPARENT = 1
    MATERIALS = edge_sand,
    RESOURCE_0 = txDiffuse
    RESOURCE_TEXTURE_0 = EDGE_SAND.dds ; TEXTURE refers to texture in original model
    RESOURCE_1 = txDiffuse
    RESOURCE_FILE_1 = EDGE_SAND.dds
    ; RESOURCE_2 = txMask
    ; RESOURCE_COLOR_2 = 255,255,255
    RESOURCE_2 = txMask
    RESOURCE_FILE_2 = EDGE_SAND_MASK.dds
    RESOURCE_3 = txDetailR
    RESOURCE_FILE_3 = EDGE_GRAVEL_MULT.dds
    RESOURCE_4 = txDetailG
    RESOURCE_FILE_4 = EDGE_GRAVEL_MULT.dds
    RESOURCE_5 = txDetailB
    RESOURCE_FILE_5 = EDGE_GRAVEL_MULT.dds
    RESOURCE_6 = txDetailA
    RESOURCE_FILE_6 = EDGE_GRAVEL_MULT.dds
    FILL_MISSING_TEXTURES = 0

    [SHADER_REPLACEMENT_...]
    MATERIALS = edge_sand,
    PROP_...=magicMult,0.5
    PROP_...=multA,0.2,0.2
    PROP_...=multB,0.5
    PROP_...=multG,0.5
    PROP_...=multR,0.5
    PROP_...=ksAlphaRef,1
    PROP_...=ksAmbient,0.40
    PROP_...=ksDiffuse,0.25
    PROP_...=ksSpecular,0.1

    Any idea on how to keep the transparency? Thanks
     
  2. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    does the texture EDGE_SAND.dds have an alpha channel?
     
  3. Ternal

    Ternal Member

    Joined:
    Feb 25, 2018
    Messages:
    86
    Likes Received:
    9
  4. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    Tried with Alpha - Test?

    Alpha blend also requires you to use the alpha key - 0 to 1
     
    Ternal likes this.
  5. Ternal

    Ternal Member

    Joined:
    Feb 25, 2018
    Messages:
    86
    Likes Received:
    9
    With ALPHA_TEST it works fine, but now i have a stretched textures, which is not happening with the other one i replaced (without Alpha)

    [SHADER_REPLACEMENT_...]
    SHADER = ksPerPixelAT
    BLEND_MODE = ALPHA_TEST
    IS_TRANSPARENT = 1
    MATERIALS = edge_sand,
    RESOURCE_0 = txDiffuse
    RESOURCE_TEXTURE_0 = EDGE_SAND.dds ; TEXTURE refers to texture in original model
    RESOURCE_1 = txDiffuse
    RESOURCE_FILE_1 = EDGE_GRAVEL_MULT.dds
     
  6. Ternal

    Ternal Member

    Joined:
    Feb 25, 2018
    Messages:
    86
    Likes Received:
    9
    Any idea @Johnr777? Thanks man :)
     
  7. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    Yes...

    Code:
    RESOURCE_0 = txDiffuse
    RESOURCE_TEXTURE_0 = EDGE_SAND.dds ; TEXTURE refers to texture in original model
    RESOURCE_1 = txDiffuse
    RESOURCE_FILE_1 = EDGE_GRAVEL_MULT.dds
    This code is asking to load 2 diffuse textures. ksPerPixelAT only uses one texture - diffuse
     
    Ternal likes this.
  8. Ternal

    Ternal Member

    Joined:
    Feb 25, 2018
    Messages:
    86
    Likes Received:
    9
    I will try to understand how to make it work properly, thanks for now man :)

    Tried everything but i still have problems, i'm about to give up really.

    The original material, set to ksGrass have

    txDiffuse with the materials of the sand (the one with alpha)
    txVariation with the materials of the graveltrap

    ksPerPixelAT have only txDiffuse to fill but if i use the sand materials, i have the wrong result, if i use the graveltrap materials is the same result.

    I'm missing something.... how can i replace the ksGrass, keep the transparency and have the txVariation texture in it?

    I tried everything i know, but something is not working in any case :-/
     
    Last edited: May 8, 2022
  9. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,113
    Likes Received:
    378
    Shader ksMultilayer is not meant to be used with transparency - I might be wrong with this!

    Why not use ksGrass shader? Its the only shader with a variation texture, If you have problems with
    [GRASS_FX]
    then use this empty line, so it doesnt get hidden:
    ORIGINAL_GRASS_MATERIALS =

    You could also use ksPerPixelAT_NM, it has a slot for NM-map at least.
     
    Last edited: May 8, 2022
  10. Ternal

    Ternal Member

    Joined:
    Feb 25, 2018
    Messages:
    86
    Likes Received:
    9
    because with ksGrass the RainFX won't work properly. Graveltrap while rainig should take a darker look which can be replicated with soaking materials, but ksGrass don't let affect it, and it remain to bright

    problem (1).jpg problem (2).jpg
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice