BaldEagle Tools - LODEditor

Home      LODEditor       Theater Building Utilities       Models

 

LODEditor Help & Tutorials

LOD Editor Tutorial

Node Structure – Splits

By

Rick "Dragon" Prior

 

Introduction:

After talking with a few people, I thought it might be useful to write an article about the node structure with emphasis on the Split nodes. In the initial release of LE, the AddNode function is limited to adding a Split-Slot combination. Future releases will expand the capability of this function which means you must have a good understanding of how the nodes are structured. I'll try to explain how the Split nodes work and how they fit within the node structure (very difficult to do on paper but I will give it a try!). I will use the MiG-21 LOD as en example throughout so you can follow along.

 

Background Information:

First, lets open the MiG-21 LOD, which is #2835, and look at the node structure (I may refer to the node structure as the node tree, tree, list, or something similar). Obviously, it begins with a Root node and then has groups of nodes separated by Splits. You can think of each small group of nodes a separate model itself. In reality, that is how the model is built. As Falcon renders the model, it goes through it and makes some decisions:

Is this Switch activated?

Is this DOF applicable?

Can I view this Split plane?

The Switch and DOF decision points are pretty simple. They are either on or off. The Split is a little more difficult. Within each Split node, you will find a Normal that consists of a Unit Vector (nx, ny, nz) and a Scale value. The Unit Vector simply indicates what direction the Split Plane is pointing. The Scale indicates how far from the center it is located. In the following example:

nx = 0.000000

ny = 0.000000

nz = -1.00000

Scale = 3.45200

In the above example, the plane is flat and pointing UP. You might think it should be pointing down due to the negative Z value but Falcon uses Z- as the up direction. Remember that! The location of the plane is at positive 3.452 which is nearly 3.5 feet BELOW center (positive Z). Based on most aircraft models, this plane would most like cut right below the fuselage and be used to determine the drawing sequence of the fuselage and the landing gears (more on that later).

Now, lets take that Normal Plane and compare it to where we are looking from. Lets say we were viewing the aircraft from above. For those of you who ever had Linear Algebra (or remember it), if you take the Dot Product of two vectors, you get the angle between them. Well, this is exactly what Falcon is doing. It takes the Dot Product of that Split Normal vector and your current View Vector. If the angle is less than 90 degrees, then you can "See" the plane defined by that Split Normal.

What does all that mean? Well, if you are viewing from an angle where you CAN see the plane, then Falcon will take the first branch of the Split Node. So, if you were looking down on the aircraft from above, Falcon would follow the branch indicated by Ptr1 within the Split Node. After that branch is drawn complete, it will then take the Ptr2 branch. Now, what do you think would happen if you were to view the aircraft from the bottom? Well, you guessed it. It would draw down the Ptr2 branch first and then do the Ptr1 branch. What Falcon is trying to do is draw the objects (or groups like I mentioned earlier) that are furthest away (or behind) first. Then draw the ones closest (or in front) last. This eliminates look throughs and puts everything in the proper perspective.

Ok. Now we all know what the Split Nodes do within the model. What the heck do the values within Ptr1 and Ptr2 mean? Well, to be honest, as I am writing this, it is becoming obvious that an option Fred and myself talked about would be quite useful! That is to put the actual Node Number next to all the branch pointers. But for now, what those numbers mean is the offset in bytes to the start of the node that the branch points to. Lets say Ptr1 = 12564. That means that if you start at the Root Node and go 12564 bytes forward, that would be the start of the node that Ptr1 points to.

Well, that number does not mean a whole lot to you so you have to look at the node tree to figure it out. If you expand a Split in the node tree list, you will see that the nodes following a Split are indented to the right. All of these nodes are contained within the Ptr1 branch! Also, all the nodes that get collapsed and expanded with that Split are part of Ptr1. Now, if you scroll down to the next node that is EVEN with the Split, that is Ptr2. Basically, if you collapse the Split, the very next item in the tree is Ptr2.

To make things even more confusing, the tree can branch many times. That means, that you can have a Split and within the Ptr1 Branch, you can have another Split, and within the branches of that Split, you can have another, and so on. Just remember that all the Splits that are located within the original Split Branch, are PART of that original Branch!

Example:

What you should know so far:

What purpose the Split nodes have within the model.

How to read the Split Plane.

What nodes are contained within both branches of the Split.

Now lets look at the MiG-21 structure and walk through it. Whenever I am doing a lot of work with a model, I like to "map" out the structure on paper so it is always handy. (If you are only making minor modifications, this is really not necessary, but if you intend to add slots or anything else, it is vital!).

Get yourself a piece of paper and load up LOD 2835. While we map this out, it is important that you indent things so they line up over top each other. This will make a whole lot more sense as we begin to walk through the model.

The tree begins with a Root (like all of them do) and then you have a Split at node 1. Open up this split and note the Normal Plane. Write down starting at the left:

1 Split (0,0,-1) 1.474

This is a split that is cutting the plane at 1.474 feet below zero and pointing UP. If you were viewing the MiG from above, the Dot Product would be TRUE so you would take Ptr1 first. Expand this Split and look at the nodes found within it (all Ptr1 branch nodes). You will see you have a Switch (#4), SubTree, DOF (#2) and a few draw nodes. If you turn on Switch 4 and DOF 2, you will see that this is drawing the cannon firing (bottom of fuselage below the cockpit). You may need to change your views to see what was added. Now, if you think about it, it all makes sense. If you are looking from above, you want to draw the cannon fire first and then draw the fuselage. If not, you would see the cannon fire coming from the cockpit! Likewise, if you were viewing from below, it would take Ptr2 first and draw the fuselage and then draw the cannon firing so you would see it in the proper spot. Now, write down "Cannon" indented below the Split like this:

1 Split (0,0,-1) 1.474

Cannon

Ok. The next node in the tree is the second Split at node 7. Write it down as before directly under the first one as it is indented at the same level:

1 Split (0,0,-1) 1.474

Cannon

7 Split (0,1,0) 1.873

This Split cuts in the positive Y direction at 1.873 feet meaning that if you were viewing the MiG from the Y+ direction then it would take the Ptr1 branch first. Now expand the Split and look at the nodes contained within Ptr1 branch. It has 3 more Splits and a few CP nodes. Lets do the same thing for the Split located at node 8:

1 Split (0,0,-1) 1.474

Cannon

7 Split (0,1,0) 1.873

8 Split (1,0,0) 4.337

Here, it splits in the positive X position at 4.337 feet. Look at the Ptr1 branch of this split and you see DOF #0 with a group of CP nodes. If you turn on DOF #0, you will see that it draws the Y- elevator:

1 Split (0,0,-1) 1.474

Cannon

7 Split (0,1,0) 1.873

8 Split (1,0,0) 4.337

Y- Elevator

This should all begin to make sense. If you CAN see from the Y+ direction as per the Split in node 8, then you should draw the furthest part first which is the Y- elevator. Also, if you look at the Split in node 7, it checks to see if you are viewing from the front of the plane (X+ direction). In that case, you want to draw the back of the plane first!

Now, lets look at the next Split which is at node 19. You should put it right under the Split at node 8:

1 Split (0,0,-1) 1.474

Cannon

7 Split (0,1,0) 1.873

8 Split (1,0,0) 4.337

Y- Elevator

19 Split (0,1,0) 11.045

Within Ptr1 branch of this Split, you have Switch 1 which draws the lights out on the Y- wingtip. Write that down indented and go to the next Split node and do the same. You should now have:

1 Split (0,0,-1) 1.474

Cannon

7 Split (0,1,0) 1.873

8 Split (1,0,0) 4.337

Y- Elevator

19 Split (0,1,0) 11.045

Y- Lights

44 Split (0,0,-1) -0.119

Now, in node 44, I just rounded the number to -1 since it is very close. You do not need to be concerned with any slight rotation to the Split Normal. (It is this way because the wing is actually slanted slightly). Within Ptr1 branch of Split 44, you have 2 more splits and some draw nodes. You can continue through these nodes and should end up with this:

1 Split (0,0,-1) 1.474

Cannon

7 Split (0,1,0) 1.873

8 Split (1,0,0) 4.337

Y- Elevator

19 Split (0,1,0) 11.045

Y- Lights

44 Split (0,0,-1) -0.119

45 Split (0,1,0) 6.826

Slot #0

47 Split (0,1,0) 5.391

Slot #1

Y- Landing Gear

Y- Wing

As you can see, Ptr1 of the Split located at node 7, draws the Y- elevator, wing, lights, gear and slots. Basically, everything that is on the Y- side of the fuselage (which happens to be at 1.873 feet!). Lets take a deeper look into Ptr1 of Split 7:

It first checks if we are looking from the front of the MiG (node 8). If we are, then it draws the back elevator. Remember, we already Split to determine which side to draw in node 7! Now, it checks to see if we are looking from the Y+ side in node 19. If so, it draws the outer most part of the wing which is the lights. Next, it checks which side of the wing (top or bottom) we are looking at in node 44. If we are looking at the wing from the top, then it should draw stuff that is below the wing first, that is the Slots. In node 45 it is checking which Slot is visible and draws the 2 slots in the proper order along with the landing gear.

Now, lets say you wanted to add another Slot to this wing. Where might you put it? Well, node 44 already determined that you need to draw the items below the wing first so you would put it within Ptr1 branch of Split node 44. Within this branch you can see that it draws Slot #0, Slot #1 and then the Gear. If you wanted another hardpoint between the two slots, you would add a Split-Slot combination just BEFORE the Split at 47. What points to node 47? That would be the Ptr2 branch of the Split at node 45 (Slot #0 is Ptr1). So if we were to open up the Split at 45 and click Add button on Ptr2, we would be inserting a Slot in between the two. (More information on adding nodes in a separate tutorial).

Go ahead and map out the rest of the structure. I find these mappings quite useful when adding nodes and slots. It is also helpful when you want to jump to a certain location. Example: You want to make a modification to the Y- wing. You look on your paper and know it is contained within the Split at 47 and that it is at the end of that branch.