Difference between revisions of "Instance node OpenCOLLADA extension"

From COLLADA Public Wiki
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{extension|company=[[The Khronos Group]]|product=[[OpenCOLLADA]]}}
+
{{extension|company=The Khronos Group|product=OpenCOLLADA}}
  
 
== LOD ==
 
== LOD ==
Line 16: Line 16:
 
|-
 
|-
 
|}
 
|}
 
  
 
== Threshold ==
 
== Threshold ==
 +
[[File:Lod-threshold.png|thumb]]
 
Optional parameter. The pixel-size radius of the model’s bounding sphere rendered on the screen, for a given camera angle and distance. The engine can use the formula below, if true the application should follow the proxy node url, and test again with the new threshold.
 
Optional parameter. The pixel-size radius of the model’s bounding sphere rendered on the screen, for a given camera angle and distance. The engine can use the formula below, if true the application should follow the proxy node url, and test again with the new threshold.
  
Line 31: Line 31:
  
 
In other words, if the object covers less pixels than the threshold value, then there is not enough resolution available to display correctly all the details, so a proxy should be used instead.
 
In other words, if the object covers less pixels than the threshold value, then there is not enough resolution available to display correctly all the details, so a proxy should be used instead.
 +
 +
  
  

Latest revision as of 18:47, 4 May 2016

Extension information
This article is part of the COLLADA extensions directory
Adding to the extensions directory

LOD

COLLADA format allows to instance nodes. However there is no way to provide the application with multiple choices of which node to use, which is the basic construct for Level Of Detail (LOD). This extension allow an instanced node and all its hierarchy to be replaced by another node and all its hierarchy, providing the basic mechanism to implement LOD and other node swapping mechanisms. In the spirit of COLLADA design, an application can ignore this extra information completely and use the instanced node. The highest level of detail node is provided as the default instance, and the application that understand this extension can follow the chain of proxies to find the node it want to use.


Element Attributes supported Description
<proxy> url xs:anyURI - link to the next LOD to consider.
<threshold> Float - in pixels units - parameter to indicate when to use next LOD.

Threshold

Lod-threshold.png

Optional parameter. The pixel-size radius of the model’s bounding sphere rendered on the screen, for a given camera angle and distance. The engine can use the formula below, if true the application should follow the proxy node url, and test again with the new threshold.


threshold > R *viewportX / tan(fovX/2) / dist

R is the radius of a bounding sphere of the object FOV is the Field Of View of the camera viewportX is the resolution of the viewport in X direction Dist is the distance from the camera to the center of the bounding sphere


In other words, if the object covers less pixels than the threshold value, then there is not enough resolution available to display correctly all the details, so a proxy should be used instead.



Example

 <library_nodes>
 
   <node id="_lodGroup1_pCube1" name="pCube1" type="NODE">
     <instance_geometry url="#pCubeShape1">
       <bind_material>
       <technique_common>
         <instance_material symbol="initialShadingGroup" target="#lambert1"/>
       </technique_common>
     </bind_material>
    </instance_geometry>
 </node>
 
 <node id="_lodGroup1_pSphere1" name="pSphere1" type="NODE">
   <instance_geometry url="#pSphereShape1">
     <bind_material>
       <technique_common>
         <instance_material symbol="initialShadingGroup" target="#lambert1"/>
       </technique_common>
     </bind_material>
   </instance_geometry>
 </node>
 
 <node id="_lodGroup1_pCone1" name="pCone1" type="NODE">
   <instance_geometry url="#pConeShape1">
     <bind_material>
       <technique_common>
         <instance_material symbol="initialShadingGroup" target="#lambert1"/>
       </technique_common>
     </bind_material>
   </instance_geometry>
 </node>
 
 <node id="LOD__lodGroup1_pSphere1" name="pSphere1" type="NODE">
   <matrix sid="transform">1 0 0 -2.086495 0 1 0 0 0 0 1 4.060825 0 0 0 1</matrix>
   <instance_node url="#_lodGroup1_pSphere1">
     <extra> 
       <technique profile="OpenCOLLADAMaya">
         <proxy url="#LOD__lodGroup1_pCone1">
           <threshold> 5.42 </threshold>
         </proxy>
       </technique>
     </extra>
   </instance_node>
 </node>
   
 <node id="LOD__lodGroup1_pCone1" name="pSphere1" type="NODE">
   <matrix sid="transform">1 0 0 6.69011 0 1 0 2.24191 0 0 1 5.94719 0 0 0 1</matrix>
     <instance_node url="#_lodGroup1_pCone1"/>
 </node>
 
 </library_nodes> 
 
   
 <library_visual_scenes>
 
   <visual_scene id="VisualSceneNode" name="untitled">
     <node id="_lodGroup1" name="lodGroup1" type="NODE">
       <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
         <node>
           <matrix sid="transform">1 0 0 -6.691324 0 1 0 1.807466 0 0 1 5.741866 0 0 0 1</matrix>
           <instance_node url="#_lodGroup1_pCube1">
             <extra>
               <technique profile="OpenCOLLADAMaya">
                <proxy url="#LOD__lodGroup1_pSphere1">
                  <threshold> 1.23 </threshold>
                </proxy>
              </technique>
            </extra>
         </instance_node>
       </node>
     </node>
   </visual_scene>
 
 </library_visual_scenes>