Mesh Terrain Material not working

Discussion in 'Content Creation' started by Occam's Razer, Mar 12, 2016.

  1. Occam's Razer

    Occam's Razer
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    1,163
    I was excited to hear about the recent support for terrain materials' friction, particle effects, and depth on static meshes, but I can't seem to get it to work properly.

    Code:
    singleton Material(mesh_grass)
    {
       mapTo = "grass_1";
       diffuseColor[0] = "0.98 0.98 0.98 2";
       detailMap[0] = "levels/garfieldHeights/art/textures/overlay_grass_01B.png";
       diffuseMap[0] = "levels/garfieldHeights/art/terrains/Grass-01-D";
       specular[0] = "0.5 0.5 0.5 1";
       specularPower[0] = "50";
       translucentBlendOp = "None";
       materialTag0 = "Miscellaneous";
       vertColor[0] = "1";
       detailScale[0] = "0.1 0.1";
        groundType = "grass";
        groundDepth = 0;
    };
    In spite of adding a groundmodel type and depth value to the material (all that I thought was necessary), the material still possesses the friction, sound, and particles of asphalt.
     
  2. Scepheo

    Scepheo
    Expand Collapse

    Joined:
    Feb 10, 2015
    Messages:
    601
    You forgot the quotes for groundDepth.
     
  3. Occam's Razer

    Occam's Razer
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    1,163
    East Coast USA's mesh grass material doesn't have quotes around it; this is a direct copy from an official map. At any rate, adding quotes doesn't fix the problem. Naming conventions, perhaps?
     
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,686
    What the console says?
    Tried to allign the text to the rest?
     
  5. crashmaster

    crashmaster
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,812
    I tested it with indianapolis, i cant get it to work either.
    There was nothing in the console either.
    except i did mine like this
    Code:
    singleton Material(indy_inf_gravel_02_01_0)
    {
        mapTo = "indy_inf_gravel_02_01_0";
        groundType = "sand";
        groundDepth = 0.2;
        diffuseMap[0] = "indy_gravel_02_d.dds";
        specularMap[0] = "indy_gravel_02_d.dds";
        useAnisotropic[0] = "1";
        castShadows = "0";
        translucent = "0";
        translucentZWrite = "1";
    };
    
    Like he said tho, is there something wrong here? there is no wiki about it yet so i dont really know where else to ask.
     
  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,686
    I'll make some documentation soon.
    Here's a test object we used to debug the whole thing.

    Extract on your map, and add it to your level.
     

    Attached Files:

    • Like Like x 2
  7. Occam's Razer

    Occam's Razer
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    1,163
    Ah, I've got it. I'd been using a separate collision mesh the entire time, one devoid of any materials. Switching to visible mesh seems to be working. Thanks!
     
  8. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,686
    Ah, totally forgot to tell you to check that :p
    You can assign a material to your collision mesh by the way.
     
  9. crashmaster

    crashmaster
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,812
    Oh, so with the new materials thing, you dont need a collision mesh?
     
  10. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,686
    It's optional, like it was before.
    If you have a very complex mesh, you should use a simplified colmesh to save FPS.

    If you make a colmesh, you can assign a material to it (incase you want to assign a particoular groundmodel to it)
     
    • Like Like x 1
  11. crashmaster

    crashmaster
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,812
    If i just remove the colmesh on indianapolis, and assign the materials, will it have collision? will it work? or is it a bit more complicated then that.
    Because the colmesh is not that different from the actual mesh of the track. so i dont think there should be that much of a difference.
     
  12. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,686
    You can use
    • Collision Mesh (Mainly used when the visual mesh is very complex. A simplified collision mesh can greatly help FPS).
    • Visual Mesh
    For your collisions.
    If you use the first, you will have to assign materials to the collision mesh if you plan to add different groundmodels to it.
    If you use the second, since it will already have materials, you don't have to do anything extra.
     
  13. crashmaster

    crashmaster
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,812
    Ok, It sounds easy, but even the materials where i added a groundmodel does not have collision now. do i need a colmesh or can i just keep the normal imported mesh?
    Basically, what i did was delete the colmesh and just keep the visual mesh, i saved it like that and cleared the cache and restarted the game to make sure that everything reloaded properly. but there arent any collisions. do i need to add something extra like the colmesh has? or should i just be able to import a model and give it groundmodel for it to work?
     
  14. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,400
    You didn't set the visible mesh's collisionType to "Visible Mesh".
    I'd keep the collision mesh if I were you though...
    LODCOL.dae (The collision mesh you're using) has 42,670 tris.
    Highlodmap.dae (The visible mesh) has 202,954 tris.
    Massive difference.
     
    • Like Like x 1
  15. crashmaster

    crashmaster
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,812
    Oh, thanks, i didnt know i had to do that.
    and surprisingly, there isnt much of a difference with the frames, nothing that i noticed as of now.
    Also, is there something that i would do to so that i dont go through the sand?
    Grass seems to slide a bit too much as well.
     
  16. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,400
    I read in another thread that "Depth will heavily affect grip."
    Add this to your material and play around with the value until you feel it's right.
    Code:
    groundDepth = 0.2;
     
  17. crashmaster

    crashmaster
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,812
    Oh thats not the problem, the problem is that when i fall in a sandpit, the vehicle will go in the depth of it and then fall through the map.
     
  18. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,400
    I can drive in them just fine, even if I remove the LODCOL mesh and set Highlodmap's collisionType to "Visible Mesh".

    EDIT: Oh. I see what you mean now. I just set the groundDepth and am now falling through.
     
    #18 mumboking, Mar 14, 2016
    Last edited: Mar 14, 2016
  19. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,686
    groundDepth is limited to 0.20. Values more or equal to that will mean you can go pass through the terrain.
     
    • Like Like x 2
  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