Solved Tunnels cheap trick issue : mesh road side texture

Discussion in 'Mod Support' started by DePains, Nov 7, 2018.

  1. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Hi,

    I finally decided to take care of the 5 tunnels I made on my map. I made them following davidinark and HighDef's tutorial :
    (),

    here is one :
    Capturedcran100.png

    So I looked if I could fill those gaps with rocks, trees or other objects from official maps. And then, I got the idea of flipping the sides and the top to use the depth of the road to fill those gaps. I tried that on another one :

    Capturedcran98.png

    This will allow me to use lighter (more realistic) decoration as no gap has to be hidden.
    But as you can see above, the side texture is stretched. And there is this lighting thing going on on the sides texture of the side walls and on the bottom texture (appearing at top as it's flipped) of the top wall which I also have to decipher.

    N.B : All textures (top, side and bottom) of all 4 mesh roads composing that tunnel are the same : "eca_bld_stone_clean" from the East Coast USA map.

    Does someone can tell me how to make the side texture get un-stretched ?
    If not, I guess I can add 4 more mesh roads to mask those...

    Thanks !
     
  2. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Use side projection, make new layer and you can choose that:
    upload_2018-11-7_21-1-16.png

    Meshroads will kill performance of your map, because those cause million tiny drawcalls especially with shadows and no CPU on planet can handle that, use very tiny amount of those. Another bit is that you have only 4000 objects that you can place that is the limit and after 2000 placed object your map will start to lag badly.

    It is kinda easy to make needed object in Blender, you need to export your terrain as .dae file and import that to Blender, in Blender you might want to splice terrain to several pieces to avoid lag. Then make your tunnel with Blender with pieces to hide the edges of hole.

    Way to go around of object limits and help with lag issues is to use forest items, but it requires that you make object in blender and add collision mesh to it, LODs etc.

    It is nasty performance trap, everything appears to be fine, but after you have gone too far to go back performance issues start hitting hard.
     
  3. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Hi fufsgfen,

    Thanks, I'll look into side projection tomorrow, or make the tunnels in blender.

    I read your thread : https://www.beamng.com/threads/opti...fferences-has-lots-of-info.57689/#post-955144
    And that made me, as the map is big (8*8 km), go on a mainly nature map (I love crashing in trees). So beside the forest objects (trees, signs, some structures : houses, seatings, etc.), statics would just be the tunnels and bridges (that's 24 statics). Roads are decal roads.
     
  4. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Well, I can't use side projection for object texture, apparently it's available only for terrain.
    I tried quickly adding a mesh road to hide that ugly mesh road side :
    Capturedcran104.png
    Dirty but efficient visually. Though this makes the tunnels being 8 mesh roads each, it's beginning to be a lot.

    BeamNG export is too big for my rig/blender skills. I'll see if I can make something in blender with the heightmap I used for carving the roads/bridges making in blender. Or export the terrain as a heightmap.

    Too bad for that quick dirty tunnel trick.
     
  5. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Bushes work too, well in some cases, not always :p

    Technically if you know measurements, it is not needed to import stuff to Blender, just craft tunnel of roughly correct dimensions, you can also scale it in world editor if needed.

    Just remember to set material name in Blender, it does not matter which material settings are as Materials.cs overrides them when you set MapTo name to be exactly same as what material name in Blender is.

    Making exactly same size / style object in Blender that you have there is quite simple to do, export to dae with apply modifiers and selection only checkboxes checked.

    Also before exporting hit ctrl-a and apply rotation / scale, then again ctrl - a and select apply location.

    It is really fast to make mesh itself, but UV mapping is where one might spend quite bit of time, I did not check which was right and which was left side on that sample, so UV map might be completely unusable, but if you have not much experience from Blender, maybe it can help. Visual mesh final collision mesh could work with that or then one can make copy of that to be a collision mesh and add details for actual mesh etc.
    Sharp edges are bad for tires so some kind of bevel is good, but that bevel can be under the ground.

    Also I'm really poor in modeling, does not help to know theory when I suck in actual modeling work :p

    Anyway one can then stretch that in world editor and if you place it to new tunnel folder with nothing else but dae file in it, game makes materials.cs for your, then you just need to write texture mapping and add texture file, but if it is in folder where there already is materials.cs then game does not make materials.cs for you.

    It is actually possible to add textures in Blender and have game set them up, include material textures does that, include uv textures checkbox sets up textures that one had opened for UV mapping, all automatically, but only if materials.cs is not present. Quite clever game.

    But 5 minutes to model, 1 hour to UV map, ratio is something like that, unless one settles with smart UV map, which is not welding faces, but creates ton of islands that is performance hog.
     

    Attached Files:

    • Like Like x 1
  6. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Ah man, you put to much work into your answers ;)

    My blender skills are limited but I can make simple things and roughly map UV. I made 4 bridges (one is to be remade, bad limited dissolve) and I made the 5 bridges. Well dafts of them and I'll compare in-game to see what adjustments are needed. The main thing I found important to set properly in blender for BeamNG is UV map and rotation, secondary would be X and Y positions. As for Z position that's no issue.

    And my bridges have 45 faces, some being inside it. UV mapping isn't long. Just hard to keep the texture homogenous through the model.

    Thanks man, you're a great help anyway !
     
  7. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Part that takes time, as I don't probably know best way, is to join UV islands and weld UV vertices:
    upload_2018-11-8_13-51-41.png

    Best would be if whole thing would be just one UV island with UV vertices welded together, then same kind of faces like other end of tunnel would need to be at exact same positions as other end, there snapping comes handy, so it quickly starts taking time as I have not figured out how to get Blender do that, it always wants to keep most of faces completely separate instead of neatly joining each side to one UV island.

    Each separate bit in UV map is ending up being separate drawcalls, shadow drawcalls are really nasty as they hog CPU a lot. With just few tunnels it luckily does not matter too much, compared to meshroad tunnels it is big save anyway, but the pain of UV maps, that is incredible much :D
     
  8. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Well that's interesting, and you lost me for UV island and weld UV vertices.

    Let's take an example.
    This is one of my tunnel. 2 textures : road and walls/roof. If I decompose what I did for the road, I mapped it dividing the faces composing it into 5 groups :

    Group 1 (5 faces) :
    Capturedcran105.png

    Groups 2, 3, 4 and 5 (1 face each) :
    Capturedcran106.png

    Are those what you call UV islands ?
    I guess that's explaining the interest of taking time in unwrapping correctly the 3D model.

    As for welding UV vertices : when I select my welded face on the model with a UV editor open, the face appear there already welded. Or are you speaking of something else ?

    Edit :

    Damn normals :rolleyes:
    Capturedcran107.png
     
    #8 DePains, Nov 8, 2018
    Last edited: Nov 8, 2018
  9. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    UV Island is one that is selected on left side of the screen, my UV map is kinda terrible, I'm still trying to learn stuff and sometimes my brain is just not with me, like today, but I try to explain how I currently understand the thing:
    upload_2018-11-8_15-4-39.png

    These are unwelded vertices, only ones on left actually matter, one in mesh are not so important for other than shading and appearance of mesh I think:
    upload_2018-11-8_15-6-10.png upload_2018-11-8_15-6-30.png


    For basic cube, here are unwelded UV vertices that Blender produces with smart UV map option, there are many islands now as UV vertices are not welded (again speaking only about left side window ignoring right side):
    upload_2018-11-8_15-9-26.png upload_2018-11-8_15-9-41.png
    You could use that placement if each side needs to have different texturing, but you would still put all textures to single texture atlas and you would weld those UV vertices, by box selecting one spot where there is vertex, then press w and weld or remove doubles. By default there is 6 surfaces or islands I think, so what welding vertices does is that it makes whole that to be ONE island, you can then

    Now for that basic cube object if all sides are going to be using same texture, like for example similar concrete, you would place each square on top of each other, it seems there was two vertices that were welded:
    upload_2018-11-8_15-13-1.png upload_2018-11-8_15-20-19.png
    Reason for placing them like this is that now they can be rendered with one batch, except that one side, but separating it and placing on top of others should work well too.

    Surfaces matter, polygons don't matter so much, when you weld those vertices that one island becomes one surface that is rendered by one call and all other surfaces that use same UV map and material/texture are batched together to that same drawcall. You want to have something like 1000 or more polygons in one drawcall as anything less is just wasting CPU power.

    However with only few bridges and tunnels I doubt you need to worry about this too much.

    There is probably even more to it, but that is kinda basics of how I currently understand it. Also some 3D programs did call islands with different name, which I don't currently remember. Blender and Autodesk use different name for it, but for me island is quite descriptive.

    My struggle to learn modeling, once I thought I understand UV mapping, then I stumbled upon performance and UV mapping, which changed everything about that and now I realize how difficult and time consuming UV mapping actually is, but probably I don't know it all and I might be even wrong about something, but that is what understanding I have got from browsing those performance related links you have read too. It is actually quite interesting too, you can make model very simple easy way and it works, but to make huge city, all of those tricks need to be pulled out from sleeve and then some :D
     
    • Informative Informative x 1
  10. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Thanks for sharing your knowledge, you still know more than many here I think, me anyway !

    Edit :

    Well I do not seem to have issues to UV map those things :
    Capturedcran108.png

    I tried the "Smart UV project" option from the drop down "u" menu, then "UVs" menu > export UV layout, open in editing software, doubled the size (2048*2048 sic) and copied twice the road diffuse, selected around the others UV layout, moved the selection rectangle over a part I wanted, copy/paste and move where the UVs are. Save as dds.

    As for the walls, it's to big to make them all fit on 1 texture, it'd have to be too big. How many draw(s) with that :
    Capturedcran109.png ?

    Thank you
     
    #10 DePains, Nov 8, 2018
    Last edited: Nov 8, 2018
    • Like Like x 1
  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