1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.35 Bug Reporting thread
    Solutions and more information may already be available.

Decals on tire (materials.cs)

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by mic2006, Nov 6, 2019.

  1. mic2006

    mic2006
    Expand Collapse

    Joined:
    Oct 30, 2018
    Messages:
    15
    Hello Nadeox1 and all !

    I have try to add the decal png transparent on the tire, but i have a problem with the transparent.

    1 - with this Singleton material :

    Code:
    singleton Material(text_tire)
    {
        mapTo = "texture_tire";
        diffuseMap[0] = "vehicles/rouge/tex/tire.png";
        specularMap[0] = "vehicles/common/null.dds";
        useAnisotropic[0] = "50";
        specularPower[0] = "1";
        castShadows = "0";
        translucent = "1";
        translucentZWrite = "1";
        doubleSided = "1";
    };
    i have the transparent tire result :



    2 - with this Singleton material :

    Code:
    singleton Material(text_tire)
    {
        mapTo = "texture_tire";
        diffuseMap[0] = "vehicles/rouge/tex/tire.png";
        specularMap[0] = "vehicles/common/null.dds";
        useAnisotropic[0] = "50";
        specularPower[0] = "1";
        castShadows = "0";
        translucent = "1";
        translucentZWrite = "0";
        doubleSided = "1";
        translucentBlendOp = "None";
    };
    The result is black :



    I try to add just the aventador decal on the texture tire ..

    So i have play with this different property and différent value (0 , 1)


    translucent = "1";

    translucentZWrite = "1";
    …………………….………….
    translucent = "1";


    translucentZWrite = "1";

    translucentBlendOp = "None";
    …………………….………….
    translucent = "1";

    translucentZWrite = "0";

    translucentBlendOp = "None";

    …………………….…………

    Thanks your for help me ;)
     

    Attached Files:

    • 2019-11-06_143000.png
    • 2019-11-06_142746.png
  2. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,696
    You probably want to use alpha clip instead of translucency/transparency.
    With alpha clip all the transparent parts are simply cut out. (ie. you set a threshold, and anything below that threshold is invisible, and anybody above is shown. No middle)
    With translucency the transparent parts are blended with what's below (ie. you can have an object being 50% or whatever transparent) according to the mode ( traslucentBlenderOp ) you set.


    So, turn of translucent (set to 0).
    Then add this:

    Code:
    "alphaRef" : 127,
    "alphaTest" : true,
    alphaRef is the threshold, IIRC it uses a 0-255 range. Any pixel with transparency below the set value is discarded / completely invisible.
    alphaTest is simply to enable the alpha clip mode.

    Say that in your texture the text has no transparency (alpha 255) and the background is fully transparent (alpha 0).
    Setting the threshold to anything between 1 and 254 will work for your scope.


    You can also use the Material Editor to check this, it would be easier to grasp how it works since you can see the changes in real-time.
     
  3. mic2006

    mic2006
    Expand Collapse

    Joined:
    Oct 30, 2018
    Messages:
    15
    Transparency not resolved with that Nadeox :(

    I have try in the editor a lot of thing with differents values.. I have exactly the same problem, transparency and black.

    Maybe the problem is my image color ?


    --- Post updated ---
    I share blender too ;)

    tire_01a is the original texture tire to beamng
    and texture_tire is my decal

    and viewport alpha (opaque) ??:

     

    Attached Files:

    • 2019-11-06_142311.png
    • 2019-11-07_130527.png
    • 2019-11-07_131252.png
    #3 mic2006, Nov 7, 2019
    Last edited: Nov 7, 2019
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,696
    It's not clear what you are doing exactly.
    Are you replacing the original tire mesh with your own?
    Are you adding your custom mesh on top of the original tire mesh?


    If you are adding your custom mesh on top of the original tire:
    You want your custom mesh to only have the text texture, and nothing else.
    And then doing the alpha clip thing I mentioned above, you get only the text visible, while the rest of the texture visible.

    If you are replacing the original mesh (not the best choice), your material is wrong then.
    You only have the text texture in there, and no texture for the original tire.
    That means that as soon you try to make that transparent, you get a transparent tire (since there's nothing else to show). I advice against this method, as you will also have problems since your mesh won't have the correct UV for the original texture tires, as well more headache for you.
     
    #4 Nadeox1, Nov 7, 2019
    Last edited: Nov 7, 2019
  5. mic2006

    mic2006
    Expand Collapse

    Joined:
    Oct 30, 2018
    Messages:
    15

    I have dont created or touch the mesh, i have just selected the mesh and created a new material over.
     
  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,696
    I see, so you are modifying the original mesh.
    You made the side wall a separate material, right?

    Pretty much same issue as the last paragraph I wrote above.
    Your sidewall has a different material, which only has the text on it.
    If you make it transparent, the whole sidewall goes transparent because you don't have anything else below it.

    A better solution is duplicating the sidewall, move it slightly in front of the old one, and apply your new material to that.
    So, when you make it transparent, your duplicated sidewall will only show the text, and then the transparent parts will reveal the original tire below it.

    Quick example:
    Video - Click to Play - Direct Link
     
    • Like Like x 1
  7. mic2006

    mic2006
    Expand Collapse

    Joined:
    Oct 30, 2018
    Messages:
    15
    You have totaly understand my error Nadeox ;) i have remplaced the original texure by the new..

    So i duplicate the sidewall ! Thanks you very much, you are the best !!
     
  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