Blender JBeam export-plugin

Discussion in 'Programming' started by HagDerVriese, Sep 12, 2014.

  1. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    I am working on a Blender export-plugin:
    newFrame.png newFrame2.png
    It generates the jBeam Data directly from the Blender mesh data
    As you see in the pictues above, generation of nodes and the beams
    works good so far. Now i have added the export for collision triangles (submesh)
    My problem now is, i can´t force the game to render the collision-triangles.
    I need this for debugging purposes.

    Is it possible to show the collision-triangles
    and which command do i have to use, to make them visble in game?
     
  2. DrowsySam

    DrowsySam
    Expand Collapse

    Joined:
    Jul 30, 2013
    Messages:
    996
    Right here?

    db72b2492d.jpg
     
  3. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    hey thx a lot. -it works- I am new to the game... don´t wonder:cool:
     
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    You can show the Coltris from the SideMenu (That button on the top-right of the screen), go to Vehicle Debug and you will find it.

    Glad to see you there Hag, and great work on the exporter.
    We already have an exporter that does similar thing and let you choose a prefix name for the nodes, but doesn't have Coltris exporter.
    http://www.beamng.com/threads/5775-...es-and-Beams?highlight=jbeam+blender+exporter

    I have some suggestions:

    You should make some context menu for this plugin, in which you can set the amount of 'tabs space' to put ahead the node line. In the same menu there should be the possibility to set a node prefix.
    Find a way to name the nodes like this:
    i6to8dk.png
    The other exporter has something like this, but it's quite messy.

    Good luck!
     
  5. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    thx Nadox, a good Idea!

    First i will complete the coltris function to get that done. I ve thought about the renaming of the nodes.
    blender-editor.png

    What do you think, is it a good idea to say: the red line in the Blender top view is the marking, every node on the left side get a "l" , the midle none and on the right an "r". At the moment i use the Blender filename as name for the vehicle and mesh-name as group name for BeamNG. I have done that to make it possible to have more than one mesh in the blender file at the same time.
    From the groupname i could take the first 2 or 3 digits as further differentiation .

    an example:

    The mesh is called "Frame"

    the nodes number would be:

    fra1l
    fra1
    fra1r

    :cool:HAG
     
    #5 HagDerVriese, Sep 12, 2014
    Last edited: Sep 12, 2014
  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    The X Axis as reference point for L and R naming is a good idea.
    I think it would be better if the exporter Jbeam would have the name of the Object instead of the Blend name. In any case, I think people will open that Jbeam file just to copy and paste the Nodes, Beams and coltris in their final JBeam file.
     
  7. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    i have seen that in some vehicles parts are not stored in the main jbeam file,
    they are stored in beside-files and in the mainfile they re only linked to the beside-file.
    But i don´t now enough right now about the structure of the vehicles.
    I took your tutorial as base and my plugin generates a file like the one you used in the tutorial.
    This plugin-generatet file is "playable" in game. That was what i wanted to do.

    - - - Updated - - -

    newFrame3.png
    okay coltris are there, but how can i see, if they re right side up?
    i changed the normals of the above faces upside down to see if it makes
    a difference, but i have found none.

    How can i test if they are right as they are?
     
  8. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    There isn't a proper way to debug the way the coltris faces right now.
    A triangle faces outside when you define the nodes in anti-clockwise sense


    (imported from here)

    If you want a double test, just take a car and get it to touch the triangle: if it tend to grab the car, it means it's facing the wrong way, if it doesn't grab the car it's good :)
     
  9. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    balltest.png

    So far i ve got nodes, beams and coltris working. At the moment i try to add
    a flexbody-mesh but i can´t figure out why its not visible or added. Maybe anyone
    could take a look at the Jbeam-files and tell what i am doing wrong?

    The Sorting of the Nodes-numbers will be the next on my todoo, but first i want to
    get the meshes working.
     

    Attached Files:

  10. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    I got the flexbody working by doing a few things (I'm not sure exactly which of these was the key, but here goes):

    1.) I re-exported the ball object from Blender, but first changed the name in Blender to 'ball' instead of Football, so that the object name and .dae name match.
    2.) I changed the JBeam flexbody section to reference "ball", not "football", and also changed the indentation a little (not sure why this would make a difference, but apparently it did).


    (imported from here)

    Hope this helps - I'm pretty keen to see a Blender exporter that handles coltris, since the realtime vehicle editor is currently broken (default vehicle list location can't be changed) and the BNEeditor only deals with nodes and beams.
     
  11. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    this helps a lot.Great Work, thx I got it working now!
    ball-working.png
    I will implement the changes and than begin
    reorganisation of node-numbers.

    - - - Updated - - -

    First Beta-release

    Today i reworked the plugin to get it install-able in Blender.
    It comes without any warranty. Its made with Linux Blender Version
    I had some trouble get the materials working in game so i decided to
    let the plugin pregenerate a material-file too. Thats the next on my list.
    The nodes-reorganisation will be the next maybe

    :cool:HAG
     

    Attached Files:

    #11 HagDerVriese, Sep 13, 2014
    Last edited: Sep 13, 2014
  12. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    okay, a next version is ready for beta release:

    I got working now:

    Nodes, beams, Coltris
    Material file : the plugin stores a material file as " projectname.material "
    you can rename it to material.cs, to let the game recognize it.
    I have to avoid overwriting existing materials, so you can decide
    yourself if you need to or not.

    The nodes-numbers are renamed as follows:
    first to digits of your projectname + running number +
    "r " if its on the right of Blenders red x-axis-line or " l " for the left side.

    blender-show.png

    Projectname = Example

    ["ex0r", -1.0, -1.0, 0.0422],
    ["ex0l", -1.0, 1.0, 0.0422],
    ["ex1l", 1.0, 1.0, 0.0422],
    ["ex1r", 1.0, -1.0, 0.0422],
    ["ex2r", -1.0, -1.0, 2.0422],
    ["bo2l", -1.0, 1.0, 2.0422],

    Please try out my plugin and let me know if you found something wrong
    or if you have got a good idea for making it better

    :cool:HAG
     

    Attached Files:

  13. Rokzy rules

    Rokzy rules
    Expand Collapse

    Joined:
    Dec 31, 2013
    Messages:
    379
    -----Ignore my post I got it installed-----
     
    #13 Rokzy rules, Sep 19, 2014
    Last edited: Sep 19, 2014
  14. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    Hi Hag,
    Well done, I'm looking forward to trying this out when I get some spare time next week. In the meantime I've got a question:

    Coltri nodes need to be listed in a counter-clockwise direction in order for the triangle to face outward. Does this script take into account the direction of normal in Blender? It would be great to have the coltri normals all facing outwards if the same is true of the Blender model.

    Also, could you perhaps keep the node names as simple as possible, i.e. just "1", "2", "3"... etc? Often it's necessary to manually fine-tune a N/B structure in notepad after exporting, and this is greatly simplified by short node names, preferably just numbers.
     
  15. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    I made it by trial&error and changed the reading direction until i was able to move the box and ball with the pickup across the map. So i think it should be faced right. But I am not definitely sure. At an acute angel the vehicle is grabbed at both reading-directions. Therfore i hoped, you guys could improve it and give me some feedback.

    How is this idea: i serve both variants, to be choosen by the user? The simple nodes count by numbers is relatively simple to add again.
     
  16. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    Even better :)
     
  17. Rokzy rules

    Rokzy rules
    Expand Collapse

    Joined:
    Dec 31, 2013
    Messages:
    379
    every time I use it I get this error message :




    error.png


    I'm a blender noob so probably did something wrong. Any help is appreciated!
     
  18. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    I'm also getting this error message unfortunately.
     
  19. HagDerVriese

    HagDerVriese
    Expand Collapse

    Joined:
    Apr 17, 2013
    Messages:
    18
    I downloaded the plugin zip and installed it in a fresh Blender install and tryed
    to reach the same Error, but i did not get it. I work on Linux and made the plugin
    with the linux blender version. My next step will be to install a Windows version of
    Blender using wine and try again to get the same error. This is nessesary to solve
    that problem.
    Maybe you could retry it using a project with only one mesh in it for
    the jbeam structure. One coming problem i imagine, could be, that the plugin doesn´t
    decide whether the mesh(es) contained in the blender project are thought as jbeam-structure
    or not. This means it uses every contained object from type mesh as jbeam structure.

    In Nadeox tutorial about bringing static meshes in game, you see there is an empty
    Blender object used to declare a group, where the needed parts belong to. Maybe i can
    do it the same way, to make sure my plugin can recognize which objects are jbeam
    structures and which should be used as probs.

    But first i will try to solve the above error.

    :cool:HAG

    - - - Updated - - -

    It was important to know if you also try the previous version of my plugin? Did you get the same error there?

    :cool:HAG
     
  20. TomiL88

    TomiL88
    Expand Collapse

    Joined:
    Aug 6, 2013
    Messages:
    169
    Great job on this. But I dont get the material file at all. I have material and texture in Blender assigned to object.
     
  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