Need help with billboard trees

Discussion in 'Track Modding' started by pleclair, Aug 5, 2013.

  1. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    Hey guys,

    As you may or may not know already, I'm working on the conversion of Nordschleife Tourist found here and I'm currently having a shot at swapping the trees so they billboard.

    Might even add some 3d one, but that's later on.

    So, before knowing anything about how its done, I opened up a tree object from Nords, and it was a cross shape, made of two rectangular planes.

    Pretty much what I had expected.

    I thought I could simply take a tree object from, say, Belgium, and put it in it's place.

    So I opened up a belgium tree object, and to my surprise, it was a bunch of trees, making the outline of a segment of the track.

    Great.

    I wanted to see the wireframe, clicked that, and saw nothing. I opened up the .gmt after converting to rf1, in 3dsmax, and again, it was all empty, except a small green rectangle.

    By clicking this, and going to vertex submode, revealed a bunch of vertex.

    For nords, seems I have a few tree objects with multiple trees, and some with only 1.

    I tried to follow Mario Morais findings about billboard trees here.

    So after opening the tree object from the paddock of Nords, which contained all the similar tree you find at the pit location, I selected the object, went into submode (polygon) first, and then deleted a section of the cross, leaving only 1 rectangular plane.

    I then followed his step to enable the billboarding effect.

    Did everything mentionned there, the only thing I wasnt sure was the reference coords to local. Its that drop down menu saying view at the top, I selected local, was it there I should have done this?

    Other that that, managed to do all he mentionned, saved the gmt (with rf2 tools active, so I had the same converter window), and when I open the scene again in 3dsimed, with the new tree object in, every other trees I didnt touched are still fine, and the same, but the one I modified is missing. If I right click on where it should be, I dont see the tree object or texture listed there.

    The dashed diagonal line was going from top/left, to bottom right... etc

    What are you doing to create a billboard tree in your track?

    Why is ISI using vertexes to create their trees, when most modders seems to be more comfortable using rectangular planes? Are both giving the same result? Even performance wise, when having many many trees?

    Should I create my tree with simple vertexes or planes?

    To assign a material to a vertex, how does that work? You drag the material to it? And that's it? How do you control size of trees etc this way?

    I'm new to all this if you didnt followed my progress with nords... so please try to explain with as much details as possible, with screenshots or video would be most helpful.

    Thanks in advance!
     
  2. Bink

    Bink Registered

    Joined:
    Nov 20, 2011
    Messages:
    523
    Likes Received:
    2
    hi.. I don't know anything about billboards... just wanted to thank you for working on the green hell... and also bump this back up.
     
  3. Denstjiro

    Denstjiro Registered

    Joined:
    Oct 6, 2010
    Messages:
    2,952
    Likes Received:
    14
  4. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    The tree issue I see there is the one with alpha chroma blending. I didnt knew it looked bad with Transparency AA set to off.

    I disabled that feature on my rFactor as it has a severe impact on performance.

    Not helpful for my particular problem, but good to know nevertheless!

    Thanks!

    Hopefully someone can provide some pointers. I had a couple more shots at it, and I dunno... cant seems to understand how its done.


    Concerning the OP topic, how do I create a plane inside an object?

    Like, the pit trees object from Nords, it's one object, but with multiple planes within.

    If I create a plane, then a second one, it's gonna end up two separate objects...


    Here is what I tried a bit earlier.

    I took another tree object from Nords, this time, a single tree. I erase the original object (a star shaped of planes, think it had 6 sides), and I created a single plane in its very place, so it would appear in place of the original one once in the scene.

    I followed Mario Morais steps to set the vertex alpha to 90 to all 4 vertexes. I retriangulated, made sure the z is facing the face of the object. Turn the diagonal dash line so it goes from top left to bottom right.

    I dragged the tree gmat from the previous object to the new plane. Wanted to try to use the same texture so its easier and faster to test.

    Then I set the gmt converter with the options mentionned, and exported. When I opened the object in 3dsimed, there was nothing.

    Object list revealed no objects either. Only a material in the mat viewer. The tree texture.
     
  5. Johannes Rojola

    Johannes Rojola Registered

    Joined:
    Sep 8, 2011
    Messages:
    1,038
    Likes Received:
    38
    I feel your frustration. I have never ever gotten billboard tree to work making it from scratch. Only way I have succeeded is that I have imported working tree from Joesville Max -test file to my own project.

    You can try it if it works and work from there.
     
  6. WiZPER

    WiZPER Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,517
    Likes Received:
    186
    Ahh, here the thread is... First off, a vertex is a point in space, three of these connected by edges makes a vertice, and two or more vertices makes a polygon. When computing graphics there are no such thing as rectangular planes or polygons - everything is calculated as triangles (vertices)

    ISI is showing it as two vertices because the nature of the plane is important for the billboarding to define which is front and back. If you got your plane mapped from the 'back' you'll never see it since it always turns to face you...

    But for making the BB-trees I think 3dsimed is the wrong tool for the job, editing and modeling is horrible in there. 3dmax would handle this much better...
     
  7. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Yes... Billboaring is tricky at first, but when you wade it through couple of times it's getting easier...;)

    Unfortunately I never used 3dsimed (except for exporting something in 3ds - format, very rarely), so I cannot help you there.

    In 3dsmax vertex numbering (depends on how plane is drawn in max viewport) and triangulation (top-left, bottom-right) could be tricky.

    It's good practice to move plane to 0,0,0 coords and reset xform before editing triangulation. Sometimes you need to rotate plane (in poly mode) locally 180 degrees and flip v mapping coords (with uvw xform modifier) to get orientation right in game.

    When you got it right (test export single plane), you can clone and attach multiple billboards together to single object.

    Cheers!
     
  8. A13

    A13 Registered

    Joined:
    Jul 31, 2012
    Messages:
    123
    Likes Received:
    29
    Are you sure you really want this ? :p

    Thank you for working on the Nordschleife, I had some great laps last evening. It feels good to be back on old familiar terrain :)
    On the other side I'm not sure if it's a good idea to go for this track, as it's your first conversion and there are a lot of small details to take care. At least the track itself should give enough motivation to go through this nightmare process :)

    I've experimented the last weeks a bit with billboarding stuff, but haven't achieved satisfying results, so for sure I've missed something too.

    There are a lot of things to consider to get it to work. Some of them were already mentioned, but maybe it's helpful to have them listed again, it's so easy to overlook something.
    I've tried working with stamp vertex instead with billboarding.

    After you imported the trees from rF1, for sure you made quads out of the polygons.

    - you need to set the right material
    - set triangulation from top left to right bottom
    - vertex numbering must fit (statement from ISI track technology v3: "Triangulation is not the only important factor. The way the quad is drawn in 3ds Max decides the vertex numbering, which in turn defines the base line for the quad’s pivot point. If the numbering is incorrect, it will result in the quad being rendering upside-down, because the top edge is being used as the pivot’s base line. A quick Local 180° rotation action in Polygon mode and a UVW Xform flipping the V coordinates will fix this.")
    - vertex alpha is set to something not 100
    View attachment 9157
    - in my case I randomized some of the bushes too and collapsed them to one object and exported them with this settings
    View attachment 9158
    View attachment 9159

    That's the way I got it to work, or maybe not, because it works only for one of my bushes and one of my grass polys.
    With all other polys I have (different kinds of bushes, grass, flowers), I got the billboarding work, but every poly has the same size. Instead changing the size, they changed z position in game. (in Max they are attached to surface and have different sizes)
    I cloned the bush that is working and remapped it to get more vegetable in, but these polys refuse to work correctly too.
    View attachment 9160
    Maybe someone knows how to fix it ;)

    good luck :)
     
  9. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    What i do in Lienz is get the existent trees and swap with quads.

    The material will be the same you can change it later.
    Use my Gmaterialtool 1.8f to generate the quads.

    The script creates the quads in right vertex order and sets alpha just need only apply the right shader and instance options.

    If you want to swap with old trees to get the position and size you need to convert each tree has to be a separate object. You can do it with the Gmaterialtool.

    try first for a small number of trees
    Guide
    1- In Geometry , "Elements/Vertex" section use DETACH button to detach all selected trees. Can check DEL to delete old objects

    2- Now need to Attach the cross shapes as a single object. Select all old trees and and use "GROUPS by Dist." button and check "attach". by default the radius distance is 3 meters. if your trees are to close reduce the distance. This function is slow if you select large number of trees may take a while.

    3- When you get the trees as a separate objects can use the BillBoard Quad in "GMT Converter Tools". Select the all trees leave all options by default just check "Del old obj" if you want to delete the old trees. My quads UV sets all texture so you must use a texture with one tree.

    4- Can use PointTools "moveTosurface" function to fix the Z position.


    Sorry if some English is not correct. :)


    Edit: I suppose you import all track to 3ds max right?
     
    Last edited by a moderator: Aug 6, 2013
  10. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    Hmmm, I'm not trying to make them with 3dsimed. I'm doing them with 3dsmax...

    I mentioned using 3dsimed to open up the tree object to see if I was seeing something... instead of packing the track to try it in game.

    But, if I get what you are saying, if I somehow screwed up in the steps, and the face is facing back, I wont see it in game.. which looks normal to me.

    But I should still see the object in 3dsimed right? I mean maybe not visually, but if I'd right click on its location, 3dsimed would list it in the context menu, no?

    I use 3dsimed to edit properties thats it... Can't create with that... even positioning and scaling is trivial...
     
  11. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    Hello Mario,

    Your english is fine! I can understand you correctly, no worry!

    Hmmm, I tried to import all the track in 3dsmax, but it crashed on the first try. So I only have the road objects (initial ones, plus those I detached, forming the outline) loaded into 3dsmax. Not the extra scenery. And no trees :( Maybe I got those at the paddock tho.

    I could try importing the whole scene again, as I would only need to work on the trees and stuff I haven't touched yet. So upon a full export, I could take only the trees out of all files.

    Will give a try to the steps you just mentioned, and I'll be back with the results.
     
  12. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    I tried your steps just now, and it ended up with a script error.

    I loaded up tptree.gmt (had it saved in .max format from yesterday, with only 1 bad tree, the result of my experiment, but there was all the other paddock trees with it)

    I clicked detach in element mode, with del checked, and it broken down the tree object with many trees into separate objects.

    So far so good!

    Then I selected all objects, checked attach, reduced the radius to 2m, since there was tree looking closer than 3m to each other (I assume that's what it is for?), and pressed group by dist.

    I got this error out of the script:

    View attachment 9164

    Any ideas?

    EDIT: When I click group by dist, should I select everything, like I did, or all elements forming up one tree?

    Maybe I got that wrong... trying again with one tree, currently redetaching...

    Ok, I tried to detach all objects within the original object, worked again.

    Then I selected the elements making up one tree, and clicked group by dist again, and it resulted in the same error.

    I got the latest version of the script, the one you linked in your post.


    EDIT 2: Currently giving a shot at a full scene import again...

    only got 3gb ram... its tight for such a thing I think...
     
    Last edited by a moderator: Aug 6, 2013
  13. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    The nodes are editable poly?

    I can import all track to 3ds max file if you want. just need to organize the gmt's by folders. For example

    Code:
    <yourtrack>
          +-------<Textures>
          |
          +-------<GMT>
                        +----<Track>
                        +----<Trees>
                        +----<Objs>
                        +----<terrain>
                        +----<sysObjs>  (for Xobjects, start lights..)

    Pack all and send to me..
    The Textures can be the MAS file.

    For road mesh i use Quadify ( to remove triangles) and tessellate to add more polys. The MAX functions only work for one selected object :-(
     
  14. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    Oh... that might have been the reason why it didnt worked. I converted the one I tried yesterday, but the others were still editable mesh.

    I'll try again once the import either fail or succeed.
     
  15. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    Hmm, I forgot that all trees were part of the same object. To edit that particular one yesterday, I had to convert the original edit mesh to edit poly.

    So it was already set to this.

    I just detached everything again to see if the detached part were poly, and they are. Group by dist on all the objects still resulted in that same error.

    Is the version of rf tools relevant? Do I need a particular one? Think I have the rf1 enabled atm.

    EDIT: I'm using max 2010, does it haves anything to do with the error?

    EDIT2: I just tried, from a blank new scene, to create two cubes, convert them to edit poly, selected them, and tried to group by dist with attach selected, and it resulted in the same error still... Was wondering if it had anything to do with the objects themselves... (the trees)
     
    Last edited by a moderator: Aug 6, 2013
  16. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    Is a bug!! sorry

    The correct line is
    Code:
    pgv =((cont_i*100)/ncont) as integer
    		FixDeadverts_bar.value = pgv
    
    remove the "cal"

    Edit: The fix version GMaterialTool 1.8g
     
    Last edited by a moderator: Aug 6, 2013
  17. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    :)

    Happy to help you find a bug then! And also happy it's one, and not on my end! :)

    I made some progress meanwhile... I thought that you group by dist function were certainly available manually in 3dsmax, so I searched the web how to attach objects together in 3dsmax, and found out how! That will help tremendously now!

    Having your script fixed will be even better tho, but now I know how its done without.

    Also, I tried the create quads function, and I must say that I'm impressed! It's awesome! It replaced the old tree with a nice quad, filled with the old texture material! Pure awesomeness!

    Once I can afford your other product, like the importer and track maker, I'll get them for sure. Haven't read much on track maker, cause I knew I couldnt get it now, and didnt want to be disappointed of working without it.. I'm sure it is of great help, seeing how gmaterials and the importer works!

    On a side note, I tried twice to import the full scene in 3dsmax, and failed both times again. Second time, I restarted my comp and made sure nothing else was running, and didnt even touched it... so I really can't do it.

    I'll pack the extracted files from 3dsimed in rf1 format and send it online. I'll pm you the link once online.

    If you can simply import it in 3dsmax, save it in max, and return it to me, maybe then I'll be able to open it, and do more serious work on the surroundings, or try to :)

    Thank you very much for your help by the way, much appreciated, and most helpful!
     
  18. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    I would so have liked to come back and say it works!!!

    But it doesn't :(

    I went simple, and instead of opening the paddock trees (multiple), I opened up a single one.

    A star shape.

    Converted the thing to edit poly. Then went to the gmt converter tools in your script, and created a quad in its place, deleting the old objects, and using the old texture.

    Worked a charm in 3dsmax, I instantly saw the new tree replace the old one, with the texture applied.

    So far so good again! I set up the gmt exporter with the options you mentioned in your other post, and exported to gmt.

    I opened up the gmt in 3dsimed, and again, empty. Nothing showing.

    If I open up the original tree in 3dsimed, I see it just fine, albeit very small when loading, need to zoom in, but I looked everything on the new exported one, and cant find it. Centering the view on it, and zooming in reveals nothing.

    Here is my 3dsmax file for that particular tree. Can you check it out and tell me what I did wrong?

    Nords tree.max (244 KB)
    https://mega.co.nz/#!8EpEjDSA!WW3MOQRFgq2n7waAQkOI4QxTJ2MxpdyW_BU0rnrKqks

    EDIT: After seeing it didnt worked in 3dsimed, I went back to 3dsmax, double checked the triangulation, and it seemed fine. The diagonal line was top left to bottom right, and the z axis was to the face of the quad.

    But you say z (red axis), but my z axis is blue, x is red. Could it be the problem? Should I make the x axis facing?
     
  19. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    I don't use 3dsimed is to buggy.

    For the GMT import to max the gmt must be save with 3dsimedv2 or the original GMT from rf1. when save in 3dsimedv3 don't work.
     
  20. pleclair

    pleclair Registered

    Joined:
    May 10, 2013
    Messages:
    793
    Likes Received:
    0
    Hmmm, that could explain why.

    But then tell me, I used 3dsimedv3 to first open up the scn file of the original packed track. I then saved it to rf1, removed all objects except the road elements, and imported fine into 3dsmax, and worked from there.

    Have you downloaded the .max file I sent and see what could be wrong with that particular tree? Does it looks like a bad import?
     

Share This Page