I like to think I have a fairly good feel for how the different LODs for a mesh should look, and indeed when I can even leave them out. In some situations I will leave out the lowest and low LODs if I feel that they'll never be seen (although I've noticed that the lowest can often be seen very close when an object first comes into view, or first comes back into view after being hidden by another object, or looked away from; but that's a different story). This can, of course, save a ton of land impact. So normally I just mesh away, upload, make sure my viewer's RenderVolumeLODFactor is set to no more than 2 and then cam around and away like crazy and see how the object reacts and looks. This has generally served me well.
Fact is though, as is detailed in Beq's article in this issue of Prim Perfect, there's an actual calculation that can be done to know exactly what the distances are. That's just too handy and some hard numbers will always trump a vague feel. So, given that, I took what's given on the Wiki and wrote the following script to give the bare minimum information.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////// | |
// Z&A Mesh Info | |
// By Antony Fairport | |
// | |
// Z&A Mesh Info - Simple tool to help figure how when LOD switches | |
// happen. Based on the information made available via an article in | |
// http://en.calameo.com/read/000004234610f002a5334 and, from that, in | |
// http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | |
// | |
// Revision history: | |
// ------------------------------------------------------------ | |
// | |
// 2015-04-02 | |
// Initial revision. | |
////////////////////////////////////////////////////////////////////// | |
// Calculate and show the mesh information. | |
ShowMeshInfo() | |
{ | |
vector vBox = llGetScale(); | |
float nDiameter = llSqrt( | |
( vBox.x * vBox.x ) + | |
( vBox.y * vBox.y ) + | |
( vBox.z * vBox.z ) | |
) / 2; | |
llOwnerSay( | |
"At standard viewer settings the LOD changes for this object should be:\n" + | |
"High to medium: " + ( (string) ( nDiameter / 0.24 ) ) + " m\n" + | |
"Medium to low: " + ( (string) ( nDiameter / 0.06 ) ) + " m\n" + | |
"Low to lowest: " + ( (string) ( nDiameter / 0.03 ) ) + " m" | |
); | |
} | |
////////////////////////////////////////////////////////////////////// | |
// Default state. | |
default | |
{ | |
////////////////////////////////////////////////////////////////// | |
// Do stuff when we enter this state. | |
state_entry() | |
{ | |
ShowMeshInfo(); | |
} | |
////////////////////////////////////////////////////////////////// | |
// Do stuff when someone touches us. | |
touch_start( integer _ ) | |
{ | |
// But only if it's the owner. | |
if ( llDetectedKey( 0 ) == llGetOwner() ) | |
{ | |
ShowMeshInfo(); | |
} | |
} | |
} |
Hopefully that's useful to someone else too.
No comments:
Post a Comment