RefPoint parameter performance influences

From FSDeveloper Wiki
Jump to: navigation, search

The RefPoint of your scenery object has two parameters that can have a big influence on the performance, if they are used incorrect. In this tutorial it will be explained what these parameters do and how you can use them to get the best performance out of your scenery.

v1 value

The first of these two parameters is the v1 value. The usage of this parameter is rather simple. It is the range in which your object will be visible. So if the distance from the RefPoint of your aircraft to the RefPoint of the scenery object is bigger then the value given for the v1, the object will not be displayed.

So the v1 value can be used to make sure that some object will display from further away, while other objects will only be shown when you are closer (for example small objects, that are not noticeable from further away). For the best performance you should make sure that the v1 value is not bigger then needed.

v2 value

But only the v1 value is not enough to control the display of your object in an optimal way. Imagine that you have just flown over your object and it is now behind you. Then the distance from your aircraft to the object is probably still smaller then the v1 value, but it should not be displayed anymore. This is where the v2 comes in. This is basically the radius of your object. When the object is behind you, but you are still within the radius of the v2 value from the RefPoint it will still be displayed.

While the v2 value is often called a radius it is a rectangle in theory. To get the best performance you should always make the v2 as small as possible. That means it should be just big enough to let your entire object fit in it. If used in a macro that can take any rotation, this means that the smallest v2 value that can be used is equal to:

v2 = (x_max^2 + y_max^2)^0.5

where x_max and y_max are the maximum coordinates that are used in your object.

If you make the v2 value too small, then the object will dissapear when part of it should still be visible (the RefPoint of the object is behind you and you are futher from it then the v2 value, but part of the object is located further away from the RefPoint and thus still visible). This only happens from certain angles and the best fix it to increase the v2 value.

So, to get the best performance you must always use the minimum v2 value. When I optimized my EHAM scenery I did this and the result was some extra frames! When you are lazy, just like me, you will probably forget to enter the v2 value when you are placing a macro. In that case it might be a good idea to hardcode the value in the macro. Then you can never forget to enter it.