Solved Number Plate Glowmaps?

Discussion in 'Mod Support' started by bhorton, Jul 27, 2016.

  1. bhorton

    bhorton
    Expand Collapse

    Joined:
    Aug 15, 2013
    Messages:
    628
    I know this sounds silly, but is there any way to have glow maps on the number plates?
    (I have started work on my next project, and wondered if this was possible)
    23398880312_large.jpg

    Thanks in advance!
     
  2. meywue

    meywue
    Expand Collapse
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    346
    Hey @bhorton,

    sorry for the late reply.

    Of course it is possible but it's needs some effort to achieve this effect. The problem is that it's not just a texture, it's generated in html.

    Lets start with the simplest thing, you need to modify the material.cs file.
    Path: \Steam\steamapps\common\BeamNG.drive\content\vehicles\common.zip\vehicles\common\licenseplates\default\materials.cs

    You need to add at least two new layers. For this endeavor you need to split the diffuseMap into background and font and add a glowMap layer.

    Code:
    singleton Material(licenseplate)
    {
        mapTo = "licenseplate";
        diffuseMap[0] = "@licenseplate-default";
        diffuseMap[1] = "@licenseplate-default-font";
        glowMap[1] = "@licenseplate-default-glow";
        normalMap[0] = "@licenseplate-default-normal";
        specularMap[0] = "@licenseplate-default-specular";
    };
    Futhermore you have to add these new links to the main.lua.
    Path: \Steam\steamapps\common\BeamNG.drive\lua\ge\main.lua

    In line 409 and following you have to create new UITexture objects for the font and the glowmap.

    Last but not least you have to modify the generator which is located in the licenseplate-default.html.
    Path: \Steam\steamapps\common\BeamNG.drive\content\vehicles\common.zip\vehicles\common\licenseplates\default\licenseplate-default.html.

    In line 111&112 you'll find a function fillRect() which will fill the texture and doesn't allow transparency which you need for the glow map, so this is counterproductive.


    Hopefully this was a bit helpful and pointed you in the right direction.

    Cheers!
     
  3. bhorton

    bhorton
    Expand Collapse

    Joined:
    Aug 15, 2013
    Messages:
    628
    Thanks for the reply, I will give that a go when I get home. Watch this space!
     
    • Like Like x 1
  4. bhorton

    bhorton
    Expand Collapse

    Joined:
    Aug 15, 2013
    Messages:
    628
    @meywue
    How do I make UITexture objects?
     
  5. meywue

    meywue
    Expand Collapse
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    346
    Hey,

    in the end it should almost like this:

    Code:
    veh:createUITexture("@licenseplate-default", design.data.generator, 1024, 512, UI_TEXTURE_USAGE_MANUAL, 1)
      veh:queueJSUITexture("@licenseplate-default", 'init("diffuse","' .. txt .. '", '.. encodeJson(design) .. ');')
      veh:createUITexture("@licenseplate-default-normal", design.data.generator, 1024, 512, UI_TEXTURE_USAGE_MANUAL, 1)
      veh:queueJSUITexture("@licenseplate-default-normal", 'init("bump","' .. txt .. '", '.. encodeJson(design) .. ');')
      veh:createUITexture("@licenseplate-default-specular", design.data.generator, 1024, 512, UI_TEXTURE_USAGE_MANUAL, 1)
      veh:queueJSUITexture("@licenseplate-default-specular", 'init("specular","' .. txt .. '", '.. encodeJson(design) .. ');')
    Of course adjusted to your conditions. You can find these lines in line 374f in Steam\steamapps\common\BeamNG.drive\lua\ge\main.lua
     
  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