[WIP] rFactor2 export scripts for Blender 2.80+

Discussion in 'Third Party Content' started by Traveller, Dec 6, 2020.

  1. Lobsang

    Lobsang Registered

    Joined:
    Aug 11, 2021
    Messages:
    2
    Likes Received:
    0
    I'm very new to this - this is my first 3d model ever and used and learning blender at the same time.
    But I ended up smashing together some lidar data with drone imagery and my local kart track

    So I'm not 100% sure if this is because I've gone about things the hard way or whether its an issue with the latest Blender 2.93.2

    My first step was to try and export the track to GMT and I get
    "NoneType has no attribute type
    Location: Unknown Location -1"


    Any tips for a noob?
     

    Attached Files:

  2. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    21
    Likes Received:
    21
    Okay, looks like it is time for a review of how things work with the export scripts.

    There are two types of objects when using the Traveller scripts. First is the basic Blender object, and second is the rFObject. The rFObject is a superset of a basic Blender object.

    To be a rFObject, a parent (an Empty) with rFactor 2 metadata is an absolute requirement. This metadata is contained in Custom Properties attached to the Empty. The more typical mesh data is contained in the child of the parent. Both parent and child are needed in order to export a proper GMT. Without the parent, the export script will report an error because vital rF metadata is not available.

    Much like a rFObject, rfMaterial is a superset of basic Blender materials. Applying just a Blender material will not be satisfactory. rFMaterial includes a superset of data not found in a basic Blender material. You can start with Add rFactor Object or you can use Add rFactor Material - both automatically add the needed rFMaterial parameters to an rFObject.

    Once the scripts are installed and active, there are two methods to create a rFObject: Add rFactor Object -and- Add rFactor Material.

    Add rFactor Object creates a basic Blender cube and assigns an Empty/parent with the rFactor metadata in one click. The parent/child object is created. This is a great way to start building objects using the various hard surface/boolean tools that exist.

    Add rFactor Material provides a methiod to add the parent/Empty with the rFactor metadata to an existing basic Blender object. The option could be called 'Add rFactor metadata' or 'Promote basic mesh object to rFObject' or 'Convert mesh to rFObject'. Most of the metadata contents relate to materials, thus it appears the current label was given to this option.

    In both @Mitch9 and @Lobsang postings, basic Blender objects seem to be selected when the exporter is called. This will fail. These Blender objects need to be either replaced with an Add rFactor Object based object -or- the existing, selected mesh needs to have the Add rFactor Material option run on it.
     
    Gilles Benoit, svictor and Emery like this.
  3. Lobsang

    Lobsang Registered

    Joined:
    Aug 11, 2021
    Messages:
    2
    Likes Received:
    0
    Cheers for the explanation DXP
    I only half understood the empty parent part, I'll give that a shot now
     
  4. Traveller

    Traveller Member

    Joined:
    Oct 7, 2010
    Messages:
    821
    Likes Received:
    369
    The parent is the GMT container. It has the overall GMT properties data, as well all the meshes. An empty object was chosen as that was the closest match I could find in Blender to the function-- that is nothing but data, that meshes could be linked to. Materials are linked to meshes. Textures are linked to materials. The use of nodes in Blender 2.80+ makes the last linkage fun.

    Starting a new scene with either rFactor2 Menu/ Initiate SCN or Initiate GEN will set up the base configuration with a default rF2 cube. SCNs are for tracks, GENs are for cars. Those distinctions are made for possible export of base SCN or GEN files. The SCN/GEN setup can be made by hand, as well, for existing scenes.

    Thank you to @dxp_rlong for his assistance.
     
    Emery likes this.
  5. DiggerHawk

    DiggerHawk Registered

    Joined:
    Jul 29, 2020
    Messages:
    77
    Likes Received:
    110
    Does anybody know if it is possible to export a mesh from Blender that allows the windscreen rain effect to work? I have managed to get the rain drops to build up on the windscreen but I can't get them to run down or back as according to studio 397's guide that requires painting the vertices using the vertex paint modifier in 3dsmax. Is there an equivalent to vertex illumination in Blender? I tried using Blender vertex paint mode but that just made the mesh transparent in rF2.

    Another issue I have come across is when you export a mesh that uses two or more UV maps they can become glitched with edges being connected in the UV map that shouldn't be, creating a tangled mess. This happens only with Vertex normals but not with Face or Up normals and can be avoided as long as you don't un-wrap the UV's for the other UV layers. Is this an expected outcome or is it a bug?
     
  6. haunetal1990

    haunetal1990 Registered

    Joined:
    Jan 4, 2012
    Messages:
    58
    Likes Received:
    113
    have got the problem that i can't export my car in blender & 3ds max to a gmt file. And it hasn't "so many" polys (78.000)..
     

    Attached Files:

  7. Mitch9

    Mitch9 Registered

    Joined:
    Jul 26, 2020
    Messages:
    173
    Likes Received:
    108
    78,000 polys for a single object or for the entire car (multiple objects)? the limit is around 65k verts for a single object, which I think also includes uv coordinates
     
  8. haunetal1990

    haunetal1990 Registered

    Joined:
    Jan 4, 2012
    Messages:
    58
    Likes Received:
    113
    Zandvoort_2020 - 2.51 - the gmt file "TyreStacks_005_LOD0" has 20,3 mb and
    Total Points = 123588 \Total Faces = 175608

    any questions? haha
    The CM cars has so 100.000 polys. And there isn't problems to export that files
     
  9. Mitch9

    Mitch9 Registered

    Joined:
    Jul 26, 2020
    Messages:
    173
    Likes Received:
    108
    pretty sure the limit was mentioned somewhere before; might have changed, might have never been there. Either way it was just a suggestion. (idk what a CM car is)
     
  10. haunetal1990

    haunetal1990 Registered

    Joined:
    Jan 4, 2012
    Messages:
    58
    Likes Received:
    113
    CM = Codemasters = F1 2010 - .. many Mods used codemasters cars :/

    Chassis has now 43.000 Polys and the export in blender didn't work, but in 3ds max.
     
    Last edited: Sep 13, 2021
    Mitch9 likes this.
  11. Martin Lacina

    Martin Lacina Registered

    Joined:
    Nov 13, 2018
    Messages:
    6
    Likes Received:
    0
    Hello guys. Just now im struggling with how to create the billboarding trees using blender. I know in 3dsmax its easy to create it where the exporter has some feature which will set the pivot point of each mesh even in case of many meshes are joined to one object. I tried to find out how all this works and if there would be some possibility to create it without neccesity of 3dsmax and now im very close but its a very complicated process try/error because if you create tree with texture with multiple trees the UV mapping looks like this when i reviewed some tracks for Automobilista but i guss the process should be same for rf2 as well. UV1 is mapped only to one tree from this texture. Second UV is slight mistery for me but this is it what this 3dsmax exporter set automaticly but here we should do it manually but its a crude really. But it work like everything is scaled down to have just 1 point or 4 points on the same place and the position of this point is important. This is what define the pivot point i guess. If you scale your object up you have to automaticaly scale these points far from the texture and should go diagonaly like here. UV 3 is just the UV map of entire texture with all the trees. Do somebody know what is the relationship between the scale of the object and position of this poin in UV2? Now its a bit tricky process to find this point. :-D Some script would be really helpfull.

    [​IMG] [​IMG]
    [​IMG]
     
  12. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    6
    Likes Received:
    1
    Hello all,
    I am very new to rf2, to 3d modeling and to developing tracks for rf2. I am loving this thread so far and hoping I can get some questions answers as I work through the initial steps of understanding each part of the process. I am trying to do this as "free" as possible for now so I am using @Traveller's blender add-on. So far I have been able to load in the devmod mode of the game with my custom track (which only has a flat cube for a platform).

    First question, I had was how does 3dsimed fit in the workflow using blender. I have seen the name thrown around but I do not fully understand what utility it provides.

    Second question, I am having trouble exporting this race surface which I have started on. I attached an image of the error and my setup.
    upload_2021-9-25_10-14-57.png
    Looks like it might be the same or similar problem as @haunetal1990 's last post. I am curious what the error is caused by

    Edit: After poking around for a while it seems like the issue is due to having an Ngon in my mesh. When I select all faces with more than 4 sides and then I triangulate faces, it seems to resolve the issue.
     
    Last edited: Sep 26, 2021
    Gilles Benoit likes this.
  13. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    6
    Likes Received:
    1
    I am working on a kart track. Does anyone know how to get a Kart into Dev mode to test with? Seems like you cannot get 397's Karts into dev mode since they are encrypted .mas files but correct me if I am wrong.
     
  14. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    21
    Likes Received:
    21
    3DSimEd has been around for sometime, before the Traveller scripts. I haven't used it in a long time. It once was the only option outside of 3DS MAX to produce GMTs. Mostly a conversion app, limited mesh & material editing.

    rF2 seems happiest with triangles so the scripts attempt to convert to tris on export. I remember once seeing in a console error something about N-Gons and Expermental. I usually prefer to convert to tris object by object, a little picky I suppose.


    This is a more general modding question, not Blender specific. It may have been discussed in the Modding thread in this forum. What ever the answer is, it will be the same answer for any type of encrypted car, not just karts.
     
    Gilles Benoit and OoperDuper like this.
  15. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    6
    Likes Received:
    1
    Anyone have good tutorials they would recommend for texturing a track? I have been reading forums and looking through blender tutorial videos but I have not found one that helps yet. What I am struggling with the most is how do I paint on track limit lines, how do I get a good road texture to cover my road with out it tiling horribly.

    Similar but separate question is if I have track and grass next to each other, do they need to be separate objects so that they can have separate materials in rf2?

    Hopefully these are not stupid questions but I am hoping I can shortcut some research but asking question early to people using the blender rf2 exporter.
     
  16. Mitch9

    Mitch9 Registered

    Joined:
    Jul 26, 2020
    Messages:
    173
    Likes Received:
    108
    Not related to the scripts, but to aliviate the tiling use a long texture - 1 or 2k wide x 4k long.
    Grass and road needs separate materials since materials are what define the surface physics. Dont forget to read the official dev guide
     
    OoperDuper likes this.
  17. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    6
    Likes Received:
    1
    Thanks for the advice. I am very new so I am not sure I am actually doing the texturing correctly. I have been trying mess around with how I do the UV wrapping but I am still learning.
    As for the materials, can a single object/GMT(if those are synonymous) have multiple materials? Like faces 0-4 have Material1 and faces 5-10 have Material2?
     
  18. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    6
    Likes Received:
    1
    I have been able to improve the look of the textures but I am still having trouble applying multiple materials to the same object. I am attempting to apply an asphalt material to my roads and then apply a white paint material to the faces for my track lines which are in the same object in blender. When I export the object from blender to GMT and view it in rf2, the asphalt material seems to overwrite where I had the white paint material in blender. Not sure this is a limitation of the exporter of a fact that a GMT can only have one material attached to it.
    Edit: I have seen the post by @Traveller where he has multiple meshes in one GMT each with a different material but I get an error whenever I try to export.
    Edit 2: My issue turned out to be with one of the materials I was using in the GMT I was trying to export. This material had been created manually by copying the nodes in the material editor of another material which I assume is the wrong way to do it. I ended up just creating a new RF2 object with the add-on and using the material created with it to remake the faulty material. Then got rid of the new Rf2 object and used the new material where the faulty material was being used.

    Now my issue is that between the meshes, I am getting big bumps when driving over the seam. There is no visible gap and all the vertices should be lined up.
     
    Last edited: Oct 15, 2021 at 5:37 PM
  19. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    21
    Likes Received:
    21
    While a Blender object can contain multiple materials, turning a Blender object into a rFObject limits the Blender object's behavior. We need to treat the rFObject as _the_ object. The rFObject contains metadata for a rFactor 2 GMT.

    The Traveller scripts have two methods for creating a rFObject: Add rFactor2 Object & Add rFactor2 Material. Both result in a rFObject containing a single rFMesh with a single (temporary) rFMaterial. A single rFMesh can have only one rFMaterial. Although, a rFObject can have multiple rFMesh/rFMaterial entries.

    To match the pattern of a GMT, each rFMesh in a rFObject can have only one rFMaterial. Each rFMesh contains its own rFMaterial metadata.

    With the scripts you can create only one rFMesh at a time. To have more than one rFMesh in a rFObject, you need to build each Blender mesh (or the auto-generated rFObject cube) such that it will only have one rFMaterial. Using the scripts, each Blender mesh (or auto-generated cube) becomes a rFObject/rFMesh/rFMaterial in order to create the needed rFMesh/rFMaterial item.

    Once you have each Blender mesh (or auto-generated cube) as a rFObject/rFMesh/rFMaterial, you can Outliner:Select Hierarchy and re-parent the rFMesh/rFMaterial to another rFObject. This action will leave behind the previous rFObject and any other rFMesh/rFMaterial items that were in the previous rFObject. When there are no other rFMesh/rFMaterial items you want to keep in the previous rFObject, the previous rFObject can be deleted.

    This process will provide a rFObject (GMT) that rFactor 2 will see as a single object with multiple materials.

    If you build a single Blender object that you want to put multiple materials on, you will need to do a Edit Mode:Mesh:Separate:Selection. Selection being the polys which will receive the same single material. Use the Add rFactor2 Material menu option on each separated selection to create rFObjects. As above, select the first level child (the rFMesh/rFMaterial) of the rFObject, using the shift key, drag & drop the rFMesh/rFMaterial on the desired rFObject (the new parent).

    Once you have added the rFMesh/rFMaterial to the rFObject, you can still modify the mesh, the UVs, the materials, etc. without having to extract the rFMesh/rFMaterial from the rFObject. If you do extract the rFMesh/rFMaterial, the extraced item will no longer function as a rFObject and may not retain all of the rFMesh metadata.

    The simplified rFObject hierarchy looks like:

    rFObject
    rFMesh
    rFMaterial​
    rFMesh
    rFMaterial​
    rFMesh
    rFMaterial​
    ...etc...

    Note: Current version of the scripts may label what I'm calling a rFMesh with a suffix of '_OBJ'. This relates to the fact that Blender calls that level 'Object Properties'. The scripts consider this level a 'MESH', thus my label of 'rFMesh'. Sorry about the confusing labeling.

    Hope all that makes sense.
     
    Last edited: Oct 17, 2021 at 3:31 PM
    OoperDuper likes this.
  20. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    6
    Likes Received:
    1
    Yes, I think this made lots of sense! Thank you. I think my remaining issue is that as a result of separating materials to separate meshs a seam results between two rfMesh (for example between the asphalt of my road and the asphalt outside of the road) which the kart hits and it shocks the car when visibly it does not look like there is any bump there. Maybe I should use the same material for the road and off the road so that I can use a single mesh but I was thinking maybe they should behave differently and maybe that would prevent me from using RealRoad properly. Not sure I am making any sense but also this might now be the right forum to be asking this in. Anyways thank you again!
    Edit: I guess I should also preface this with I am trying to create a fairly simple Kart track which is an asphalt road surrounded by asphalt with white lines. Hopefully that paints the picture a little better.
     
    Last edited: Oct 17, 2021 at 6:38 PM

Share This Page