Wednesday, July 28, 2010

Facade Tuning and Tips

I have updated some of the facade documentation on the wiki with new performance tips for using facades.

A few quick notes:
  • Your facades must be counter-clockwise (when viewed from above). Do not repeat the first point; X-Plane will "close" your building for you. (A four sided building should have four points, not five.)
  • If you turn off two-sided facade drawing and your walls look wrong (and your roof disappears) your facade is wound in the wrong direction.
The performance tips go into a fair amount of detail about saving memory. Most of X-Plane's rendering fall into two categories:
  1. Shared meshes (objects), where the geometry of the object is saved once and used lots of times. Objects usually hurt frame-rate by consuming CPU time, because for each drawing of the object, we have to do some setup to draw that shared geometry in a different location. (Version ten should feature some major improvements in object efficiency.)
  2. Non-shared meshes (everything else), where every single "instance" of a tree, facade, forest, etc. is uniquely constructed in memory. Non-shared messages are very fast (because we can submit a huge pile of non-shared messages to the video card in one shot) but they consume a lot of memory (because we pay for RAM per building/tree, not just once). Typically non-shared meshes are limited by virtual address space, not by framerate.
Facades are non-shared meshes, so the performance tips focus on how to limit the amount of RAM needed to represent your facade.


Dan said...

Not entirely related to your post... but since we're on the subject of facades I'll throw in some observations from using facades to create fences in WED and OverlayEditor;

If you create a fence using facades with roofs to represent the angled and outward pointing top part of the fence with the barb wires, they always ends up pointing in the wrong direction when using WED. In reality these will be pointing away from the airport boundary to keep trespassers away, but that's really hard to control in WED, probably due to some limitations in WED to avoid design errors. From a perspective of keeping the design errors to a minimum when drawing houses with real roofs that's a good idea, but not when you need that extra bit of flexibility. In OE I could just draw the polygon in the oposite direction, and the facade would automatically mirror pointing in the direction I wanted, giving a realistic representation of a fence.

I wouldn't call it a bug... but it would be nice to hear your thoughts on the matter!

Benjamin Supnik said...

It's a design limitation that you can't easily tilt your wall top out. But...try this. Instead of a roof slope of around 45 (to tilt in) try a roof slope of...315 to tilt out. ;-) (You can't use -45 as it will be clamped to 0 by the code, strangely.)

Benjamin Supnik said...

Also I should say: WED's requirement that the facade not be inside out keeps the DSF valid wrt the DSF spec, which says that all facade polygons should be counter-clockwise. Technically if you invert a walls-only polygon x-plane won't that much, but a wall outset via slope 315 is better.