1. Welcome to CAST's newly designed and improved Forum

    Log in or Sign up and share the knowledge!

    Dismiss Notice

Geometry Optimization and File Efficiency

Discussion in 'Tips & Tricks!' started by Dany, Feb 3, 2014.

  1. Dany

    Dany Super Moderator

    Joined:
    Jan 16, 2014
    Messages:
    509
    Likes Received:
    19
    Hello everyone,

    I wrote two tips about optimizing geometry in .wyg files, which I strongly recommend you read (in the order they were published) in order to better-understand the concepts below: Part 1 and Part 2. (In case these don't load, you may download their contents from the third message below.) In addition to practical information, these tips offer an in-depth look at how WYSIWYG's Shaded View engine works--and understanding all that is the real key to properly-optimizing your files, whether the situation requires cleaning up a file before importing it or optimizing what's already been imported.

    Above and beyond this though, it is important to remember that WYSIWYG can only do so much if the imported model is inefficient to begin with: if a model is made of more polygons/faces/surfaces than absolutely necessary, WYSIWYG has no choice but to process all that geometry--and will likely get bogged down as a result. It is therefore always best to import models that are made from the least possible amount of polygons/faces/surfaces; please remember that WYSIWYG is a lighting design software, not a 3D modeler or animator, so its strengths lie in simulating lights, not parsing millions of polygons. Here are some ideas for what you can do to ensure that imported models are as efficient as possible:

    - Models should never contain anything that is irrelevant to your work in WYSIWYG. For example, if the CAD file of a mobile or modular stage shows exactly how the stage is put together (complete with substructure, casters/wheels, nuts & bolts, etc., etc., etc.) remove all that from the file prior to importing it, and only import a single surface that's the actual stage floor--everything else is pointless to import because it will never be lit anyway. Naturally, the same principle can be applied to absolutely anything you import into a .wyg file: if it doesn't need to be lit, it should either not be there at all, or it should contain the least amount of geometry possible.

    - Use a mesh decimator (either one built into the software in which the model was created or one found in a third party utility such as MeshLab) in order to optimize/reduce the number of polygons/faces/surfaces that make up the model. (Mesh decimation is the process by which the number of a model's component surfaces/faces/polygons is reduced without affecting its overall shape.) A couple of notes regarding MeshLab:
    • It is freely-available from http://sourceforge.net/projects/meshlab/?source=directory.
    • It supports a limited number of file formats; if the model requiring decimation is not in a format that can be imported by MeshLab (i.e. usually a .DWG or .DXF file--which MeshLab can NOT import), it must be converted to a file format that MeshLab supports. A great utility that facilitates this conversion is AccuTrans 3D, which can import and export almost any 3D file format; I recommend exporting to Collada (.CDA) format for this purpose.
    • Once the model has been loaded into MeshLab, it may be decimated with the Edge Collapse Decimation tool found in the Filters menu's Remeshing submenu. You don't have to worry about the various values and options in this tool's dialog.. leaving them as they are filled in automatically by MeshLab and simply hitting Apply will do a good job of decimating the model. You will have to hit this button multiple times to keep decimating, but please note that once you've gone "too far" (i.e. the object starts losing its shape) there is no Undo function, so you will have to re-import the mesh and start from scratch; as such, it is a good idea to make a (mental) note of the number of times you hit Apply.
    I will add more information here as it comes up and as it comes to me, but feel please free to reply to this thread and add your own tips for optimizing geometry and generally ensuring that .wyg files are as efficient as they can be.


    Cheers,

    Dany
     
  2. Dany

    Dany Super Moderator

    Joined:
    Jan 16, 2014
    Messages:
    509
    Likes Received:
    19
    Optimizing geometry by re-drawing models

    Hi again, everyone,

    It took a while, but I finally came across a great example of the kind of geometry that can slow wysiwyg down considerably: in the file attached here, the model on the left, while it appears to be rather simple, is made of almost sixteen thousand polygons! Such a model would indeed be Mesh-Consolidated (into three separate objects—one for each upright and one for the arch between them), but even so, the massive amount of mostly unnecessary underlying geometry (i.e. the polygons that make up this model) will slow wysiwyg down to a crawl. (In the file that this object came from, there were twelve such objects—the support structure for a large roof—and to say that performance was poor is an understatement.)

    I do not know why a seemingly-simple object like this was drawn with such great detail (note how even the nuts and bolts were modelled), but that's all there was to work with—as is often the case. One option would have been to take the model into MeshLab and simplify/decimate it, but that was not the appropriate solution here because while the polygon count would indeed have been reduced, details such as the aforementioned nuts and bolts would have remained in the file—that is simply how mesh decimation works. As explained above, such details are completely unnecessary because they will never be seen, and if they are not visible, why bother keeping them there? (They are so small that the only way to actually see them is to zoom right into them—something that would never be required, considering what they are.)

    The more appropriate/correct solution, therefore, was to simply re-draw the object (in WYSIWYG, of course), as follows:

    1. I set the Layer that the object was on to Uneditable, created a new Layer on which to draw and made this new Layer current.
    2. I activated End Point Snap, switched to Isometric View* and, using CTRL+Arrow keys, I positioned it to a what I felt was a good working angle.
    3. I zoomed into the base of one of the upright objects, and started “tracing†a Surface around its bottom, as you can see in the screenshot attached here. (I specifically did not snap to every point around the rounded corner of the base piece because that would do nothing but re-create the original polygons that I was trying to get rid of in the first place; aside from this, there was no reason to keep such a fine curvature, again because it is irrelevant when seen from far away—which is the only way this part of the object would be seen.)
    4. Once I finished tracing the bottom of the base piece with the Surface object, I ensured that the Isometric Workplane was set to Plan and Extruded the Surface to the height of the base piece. (The holes in the original base piece were also irrelevant to lighting visualization, so I did not re-create them; if these holes were required though, I would have drawn Cylinder objects to match the holes, and then used Boolean Subtract to cut out the holes using the Cylinders as the ‘cutters’.)
    5. I continued in the same way with the rest of the upright, completely avoiding redrawing any unnecessary details such as nuts and bolts and holes, and ensuring that I keep necessary details to a bare minimum—without affecting the overall shape of the model. I was careful to switch to the relevant Isometric Workplane when performing extrusions that were not parallel to the XY plane, or to switch to the Left, Right, Front or Back views for the same purpose.
    6. Since the two upright pieces were the same (but mirrored across the middle of the arch between them) I simply used the Mirror command to create the other upright once the first one was complete.
    7. Still working in Isometric View I traced the right side of the arch between the uprights with three more Surface objects, and then switched to the Right View to Extrude them to the width of the arch. (Since the arch is such a large piece of geometry (and can therefore be seen from far away) it was important to maintain its curvature. As such, when drawing the Surface, I Snapped it to every End Point that created the curve in the original object.)

    As you can see in the attached file, the re-drawn model looks, for all intents and purposes, identical to the original—and it is made of a total of 29 objects (which, in turn, are made of 346 polygons**) not fifteen thousand nine hundred and forty eight that make up the original. The final step here was to select the objects I drew and Group them together, to make it easier to work with the model (i.e. move it, copy & paste it, etc.).

    Please click here to download the screenshot and sample file mentioned above, and let me know if you have any questions about any of this (or if you require further details regarding my process).


    Cheers,

    Dany


    * Working in Isometric View ensures that you Snap to the exact point that you need to snap to; when using the Plan, Left, Right, Front or Back views, it is not hard to Snap to a point on one side of the object, and then to a point on the other side, resulting in an incorrect surface.

    ** To get the polygon count, simply select the model and Break it apart, using the Break > Solids into Surfaces command in the Tools menu.
     
    #2 Dany, Sep 30, 2014
    Last edited by a moderator: Sep 30, 2014
  3. Dany

    Dany Super Moderator

    Joined:
    Jan 16, 2014
    Messages:
    509
    Likes Received:
    19
    Here are the PDFs in case the links from the first message don't load into your browser.
     

    Attached Files:

  4. maoningbo

    maoningbo New Member

    Joined:
    Mar 15, 2014
    Messages:
    4
    Likes Received:
    0
    非常好的建议
     

Share This Page