[WIP] rFactor2 export scripts for Blender 2.80+

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

  1. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    26
    Likes Received:
    24
    The scripts don't have any tools for smoothing track bumps. Only thing I can think of is that I don't look at it as separating materials. I look at it as separating meshes, using Blender's Edit Mode:Mesh:Separate By Material ('by selection' works also). Using that tool has never left any gaps or bumps -- unless you move the mesh from its original position after separation. Beyond that I just rebuild track sections until I get what I'm looking for. The folks over in the Modding forum probably have more info about fixing bumps than I have, because I'm primarily focused on the scripts.
     
    OoperDuper likes this.
  2. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    11
    Likes Received:
    1
    I am having better luck with separating meshe by material now. I am not sure what I was doing wrong initially. I also changed from having my lines on the track from being apart of the track to being a separate object which floats slightly above the track with no collision. Works for now and I no longer have the weird bumps.

    New question which actually pertains to the scripts: Is there a limit to the number of vertices in a GMT? Getting an error when trying to export a GMT that has approx 20k vertecies.

    Exporting quadrangles-only mesh.
    10590 10590
    2
    Exporting a mixed mesh of both triangles and quadrangles. Experimental.
    4093 33 0
    24558 99
    8219 8219
    2
    Exporting a mixed mesh of both triangles and quadrangles. Experimental.
    1215 2061 0
    7290 6183
    4491 4491
    Python: Traceback (most recent call last):
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rf2_gmt_Source\rF2_Menu_Stuff.py", line 528, in execute
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rfactor2_gmt_WIP\rF2_GMT_Export.py", line 1805, in save_gmt_override
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rfactor2_gmt_WIP\rF2_GMT_Export.py", line 1753, in save_gmt
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rfactor2_gmt_WIP\rF2_GMT_Export.py", line 1735, in PutrF2GMT
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rfactor2_gmt_WIP\rF2_GMT_Export.py", line 1506, in PutMeshes_rF2
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rfactor2_gmt_WIP\rF2_GMT_Export.py", line 1026, in Triangulate
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rfactor2_gmt_WIP\rF2_GMT_Export.py", line 917, in GetFaces
    File "D:\Blender Foundation\blender-2.93.0-windows64\2.93\scripts\addons\io_rf2_gmt_Source\rF2_GMT_Stuff.py", line 5537, in AddWord
    struct.error: ushort format requires 0 <= number <= 0xffff
     
    Last edited: Oct 26, 2021
  3. Martin Lacina

    Martin Lacina Registered

    Joined:
    Nov 13, 2018
    Messages:
    10
    Likes Received:
    2
    Hi guys. Hopefully i will get some feedback. Im struggling how to export mesh with vertex colour informations from blender to 3dsimed through fbx format. Some vertices are coloured with RGB colour and any of them also with Alpha. I can transfere RGB informations but not alpha. This is the simple example what i need. The inner rectangle has alpha set to 0 and the rest has 255 but unfortunately after export and import into 3dsimed this black rectangle has alpha set also to 255 so the entire object is fully opaque. The alpha informations i need to make the texture transition between grass gravel on the terrain but im not succesfull so far. How this blender script handle the vertex colour/alpha informations? Would be possible to export something like this properly?
    [​IMG]
     
    Corti likes this.
  4. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    11
    Likes Received:
    1
  5. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    26
    Likes Received:
    24
    @OoperDuper, about the error on export, I haven't seen that particular sequence before. Generally, something along these lines concerns an odd bit of geometry somewhere in the mesh you are trying to export. If I was smart enough to keep previous versions, I try the latest to see if will export correctly, Then the next version back, etc. I have found that I've left some errant vertex or poly around that the exporter doesn't know what to do with. If I don't have the older versions, I make a duplicate mesh, move it to a separate collection, and cut the mesh in half, try to export each half. If one half does export and the other doesn't, then I split the one that doesn't in half again, repeat until I find the section giving the problem and rebuild it. Not sure that will fix it, but the only thing I know.

    As for the road shader issues, that goes back to the beginning of the scripts. They were mostly written before S397 and Blender switched to PBR based rendering. So there are no real PBR shader assignments in the scripts are at this time. The Legacy Diffuse Shader (the default assignment) only supports one UV map. You might try the Legacy Special Shader. It has 4 UV maps. They are named as pre-PBR maps, but they should show up in mat editor as ABCD UV maps, in the same order. Haven't tried that yet.
     
    Last edited: Nov 5, 2021
    OoperDuper likes this.
  6. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    26
    Likes Received:
    24
    @Martin Lacina - from the screenshot, it looks like you are not using the Traveller scripts. I have to guess you are exporting a Blender mesh object to a FBX file. I don't have experience in that sequence. If that is not what you are doing, I would need to know more about the exact steps you are taking with the scripts.
     
  7. OoperDuper

    OoperDuper Registered

    Joined:
    Sep 25, 2021
    Messages:
    11
    Likes Received:
    1
    Good idea about splitting up the mesh until finding the problem area. I will have to give that a try. I ended up splitting my mesh into two parts. One part is much bigger but it seemed to do the trick in letting me export but the bigger piece still takes 15 seconds to export which is abnormal for me.

    You talk about a Legacy Special Shader. Is that something I set in the materials editor or is this something in blender? Also I noticed that in the material editor you can select which UV channel you want for a specific texture in a shader. I tried to set everything to UV_A since I figured that is what is setup by the default diffuse shader, but it didnt really fix anything yet. I think my issue might be with the textures I am using but I am unsure. In the material editor, the preview for the textures (other than for the albedo) is not showing and looks like some kind of error.
     
  8. Martin Lacina

    Martin Lacina Registered

    Joined:
    Nov 13, 2018
    Messages:
    10
    Likes Received:
    2
    Yes i did try to draw vertex alpha with "erase alpha" brush in vertex paint mod. Then i exported via fbx and what i did in newest blender 2.93 i also imported into 2.79 and i see vertex alpha but in 3d simed i dont see the alpha values. Everything is opaque.
    But i tried also the script so In blender 2.93 i:
    1. Created rfactor object
    2. In vertex colour layer called "diffuse alpha" i draw vertexes with "erase alpha brush"
    3.exported gmts
    4. Imported gmt in 3dsimed but still not see the alpha values in affected vertices.
     
  9. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    26
    Likes Received:
    24
    @OoperDuper - the Legacy Special Shader is on the rFactor 2 menu:
    rfactor_menu.png
    and should populate the UV list like this:
    UV_list.png
    The names are different, but mat edit should see them as ABCD.
    Let me know if that works for you.
     
    OoperDuper likes this.
  10. dxp_rlong

    dxp_rlong Registered

    Joined:
    Nov 5, 2018
    Messages:
    26
    Likes Received:
    24
    @Martin Lacina - This sounds like an issue with 3DSimED. If you can export via FBX & import back into Blender and the correct vert data is present, yet import the same FBX into 3DSimED and vert data is not correct - that seems to indicate where the issue is. Same with the scripts, the rFactor object is using the same vertex data as a Blender mesh uses. Since I haven't used 3DSimED in years, I don't have any recent experience with it.
     
  11. Martin Lacina

    Martin Lacina Registered

    Joined:
    Nov 13, 2018
    Messages:
    10
    Likes Received:
    2
    Wow guys. I did it. Instead of "erase alpha" brush in Diffuse alpha layer i used substract and now i can read the correct alpha values in 3Dsimed. Unfortunatelly if i have already some existing object with proper 4 UV layers and i want to add rfactor material via script this will overwrite/damage material and UV layers. So does it mean if i want to modify some existing object which is not created by script i have to do everything again from scratch? My godness to have this feature of vertex color layers in fbx exported would be great because to work partially with fbx and partially with script would be a huge mess.
     
    Last edited: Nov 7, 2021
    Emery likes this.
  12. Martin Lacina

    Martin Lacina Registered

    Joined:
    Nov 13, 2018
    Messages:
    10
    Likes Received:
    2
    So just for your information. Finally the issue was with 3dsimed itself as it couldn't load vertex alpha values with fbx importer. It could export it but not import back so after update to version 3.2b everything is perfect. What i paint with erase/add alpha brush i see in 3dsimed so no need to create vertex colour layers.
     
  13. Rock

    Rock Registered

    Joined:
    May 28, 2015
    Messages:
    156
    Likes Received:
    18
    Hello
    I have installed the plugin (import export) but when I go to file/import/... I don’t see the possibility of importing a .Gmt.
    You can help me?
     

    Attached Files:

  14. Traveller

    Traveller Member

    Joined:
    Oct 7, 2010
    Messages:
    827
    Likes Received:
    372
    The 2.80+ scripts are export only. Everything is currently done through the rFactor2 Menu. I don't see it on the line in your screenshots. Do you have it installed/ activated?
    Image3.jpg
     
  15. Rock

    Rock Registered

    Joined:
    May 28, 2015
    Messages:
    156
    Likes Received:
    18
    Indeed, the rFoctor2 tab does not exist for me.
    I think my version of Blender should not be compatible.
    My search "Blender 2.80 + script" leads to invalid things. Can you show me a link to a compatible version, pleas
     
  16. Traveller

    Traveller Member

    Joined:
    Oct 7, 2010
    Messages:
    827
    Likes Received:
    372
    Blender 2.93 through 3.00, but not 3.10.
     
  17. Rock

    Rock Registered

    Joined:
    May 28, 2015
    Messages:
    156
    Likes Received:
    18
    I installed Blender-2.93.8 winx64, then put the plug in C:\ Program Files\ Blrnder Foundation \Blender 2.93 \2.93\ Scripts\ Addons_contrib\ (io_rfactor_gmt_080_64-bit). I see the file "_init_.py" to install in "Edit/Preferences/Add-ons/Install.." But once installed, I can’t find how to activate it. Because I don’t see it in the list (jpeg). I have to do something wrong?
     

    Attached Files:

  18. Traveller

    Traveller Member

    Joined:
    Oct 7, 2010
    Messages:
    827
    Likes Received:
    372
    Get the file in the first post of the thread. It will contain: upload_2022-3-25_11-10-16.png
     
  19. Rock

    Rock Registered

    Joined:
    May 28, 2015
    Messages:
    156
    Likes Received:
    18
    Thanks indeed with this one he works.
    Indeed the import of Gmt does not work live.
    Is there another method to do this or do you know another thread of discussion a advise me.
     
  20. Traveller

    Traveller Member

    Joined:
    Oct 7, 2010
    Messages:
    827
    Likes Received:
    372

Share This Page