Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
animations [2019/03/12 12:21] – [Model-Animation caching] adminanimations [2019/09/09 09:25] – [Model-Animation caching] admin
Line 1: Line 1:
 ====== Model-Animations ====== ====== Model-Animations ======
  
-If you load a model from DAE or X3D with embedded animations, Gorilla3D will automatically load and add all animations to the model.+If you load a model from G3D, DAE or X3D with embedded animations, Gorilla3D will automatically load and add all animations to the model.
  
 Animations are handled by the TGorillaAnimationManager inside of a TGorillaModel component. Animations are handled by the TGorillaAnimationManager inside of a TGorillaModel component.
Line 34: Line 34:
 </file> </file>
  
-==== Iterating through model-animations ====+==== Iterating model-animations ====
  
-To iterate through the animations list and playback you can use the provided methods **PlayNextAnimation()** and **PlayPreviousAnimation()**.+To iterate the animation list and playback you can use the provided methods **PlayNextAnimation()** and **PlayPreviousAnimation()**.
  
 <file pascal Form1.pas> <file pascal Form1.pas>
Line 88: Line 88:
 Due to those performance needs, Gorilla3D offers some caching techniques for model animations. Due to those performance needs, Gorilla3D offers some caching techniques for model animations.
  
-As you've seen in the previous examples for loading a model, there was a supplied parameter for animation caching: "GORILLA_ANIMATION_CACHING_DEFAULT".+As you've seen in the previous examples for loading a model, there was a supplied parameter for animation caching: "GORILLA_ANIMATION_CACHING_DEFAULT" (Gorilla.DefTypes.pas)
  
 Gorilla3D offers a configurable caching mechanism to suite your needs. Gorilla3D offers a configurable caching mechanism to suite your needs.
Line 95: Line 95:
  
 ^ Flag ^ Notes ^ ^ Flag ^ Notes ^
-| TAnimationCachingFlag.AllAttributes     | All attributes of each vertex are cached. This may be the fastest method, but memory usage is enormous. If possible use TAnimationCachingFlag.VertexPosition instead. | +| TAnimationCachingFlag.AllAttributes     | All attributes (position, texcoord, color, normal, ...) of each vertex are cached in a framebuffer object. This may be the fastest method, but memory usage is enormous. If possible use TAnimationCachingFlag.VertexPosition instead. |
- +
 | TAnimationCachingFlag.Compressed    | Compressed caching is recommend for large models and long animations, but will not create a framebuffer directly in GPU memory. Cached frames will be compressed inside the application memory. On MSWINDOWS x86 we use LZ4 compression for enourmous performance boost. On all other platforms we use ZLib compression algorithms by default. | | TAnimationCachingFlag.Compressed    | Compressed caching is recommend for large models and long animations, but will not create a framebuffer directly in GPU memory. Cached frames will be compressed inside the application memory. On MSWINDOWS x86 we use LZ4 compression for enourmous performance boost. On all other platforms we use ZLib compression algorithms by default. |
 +| TAnimationCachingFlag.VertexPosition | Cached frames will ONLY contain the vertex position. The rest of the vertex data will come from a static mesh buffer (not animatable). This is the recommend setting for caching, because in 95% of all cases you only transform vertex position on an animation skin. |
  
-| TAnimationCachingFlag.VertexPosition | Cached frames will ONLY contain the vertex position. +The constant value "GORILLA_ANIMATION_CACHING_DEFAULT" uses only the VertexPosition flag as default setting: 
-The other vertex data components will come from the static mesh bufferThis is the recommend setting for cachingbecause in 95% of all cases you only need to transform vertex position on animation skin|+<code> 
 +GORILLA_ANIMATION_CACHING_DEFAULT : TAnimationCachingFlags = [VertexPosition]; 
 +</code> 
 + 
 +=== Hint === 
 +It is possible to combine compressed and vertex-position caching flags to reduce the number of data compressedOtherwise on compressed caching, full vertex data will be cached. 
 + 
 +<code> 
 +GORILLA_ANIMATION_CACHING_COMPRESSEDEX = TAnimationCachingFlags = [TAnimationCachingFlag.CompressedTAnimationCachingFlag.VertexPosition] 
 +</code> 
 + 
 +=== Framerate === 
 + 
 +The caching framerate used is currently fixed to 60 FPS. 
 +But in future you should be allowed to configure this setting to reduce memory usage.
  
 Next step: [[materials|Materials]] Next step: [[materials|Materials]]