本站的主題是商業,創業,美食,葡萄酒,閱讀,網路科技。
這是我的 FB粉專 以及 IG,我比較常使用 Threads,歡迎大家追蹤互動~
Sample_Character
The sample demonstrates how to get the Ogre::AnimationState of each animation from the asset file, and play/stop the animation. The main work of this sample is delegated to the class SinbadCharacterController, and most of the resources used in this sample are in “mediapacksSinbad.zip”, which is supposed to be generated by Blender (there is a .blend file in the zip file). “Sinbad.zip” includes:
Sinbad.mesh
Sinbad.skeleton
Sinbad.material
3 tga textures
Sword.mesh
Sinbad.mesh
Sinbad.skeleton
Sinbad.material
3 tga textures
Sword.mesh
The format of the .mesh file is like:
<mesh>
<submeshes>
<submesh …>
<faces …>
<geometry …>
<boneassignments …>
</submesh>
<submesh …>
<faces …>
<geometry …>
<boneassignments …>
</submesh>
….
<submeshes>
<skeletonlink name=”Sinbad.skeleton” />
</mesh>
The format of the .skeleton file is like:
<skeleton>
<bones>
<bone id=”0″ name=”…”>
<bone id=”1″ name=”…”>
<bone id=”2″ name=”…”>
…
</bones>
<bonehierarchy>
…
</bonehierarchy>
<animations>
<animation name=”Dance” length=”…”>
<tracks>
<track bone=”ThumbMed.R”>
<track bone=”IndexFingerMed.R”>
<track bone=”Clavicle.R”>
…
</tracks>
</animation>
<animation name=”DrawSwords” length=”…”>
<tracks>
<track bone=”…”>
<track bone=”…”>
<track bone=”…”>
…
</tracks>
</animation>
…
</animations>
</skeleton>
Note:
1. In SinbadCharacterController::setupBody, sceneMgr->createMovableObject(“RibbonTrail”, ¶ms) is supposed to create an Ogre::RibbonTrail.
2. fading in/out animation makes the animation more natural (see SinbadCharacterController::fadeAnimations).
Sample_Compositor
The GUI of this sample has the following effects:
Bloom
Glass
Old TV
B&W
Embossed
Sharpen Edges
Invert
Posterize
Laplace
Tiling
Old Movie
HDR
Gaussian Blur
Radial Blur
ASCII
Halftone
Night Vision
Dither
Motion Blur
Heat Vision
Sample_Compositor::registerCompositors demonstrates how to register the parsed compositors to Ogre::CompositorManager.
In Sample_Compositor::checkBoxToggled, CompositorManager::getSingleton().setCompositorEnabled can enable/disable certain effect.
Note:
In Sample_Compositor::createTextures, “HalftoneVolume” is created for “media/materials/scripts/Halftone.material”; “DitherTex” is created for “media/materials/scripts/Dither.material”.
Sample_CubeMapping
Material “Examples/DynamicCubeMap” indicates that “ogrehead.mesh” needs cube mapping, and the cubic texture is generated in the sample.
The sample also inherits from Ogre::RenderTargetListener, overrides preRenderTargetUpdate and postRenderTargetUpdate methods.
The sample changes the perspective angles in preRenderTargetUpdate in order to make the cubic texture, and recovers the objects (which was set invisible in preRenderTargetUpdate) in postRenderTargetUpdate.
Note:
The creation/destruction of both entity and texture are managed by the OGRE engine, and there is nothing to do in the client side (no containers, no responsibility of destroying them). It's a nice design. It simplifies the work in the client side, and therefore decreases errors.
Sample_DeferredShading
The message box popped out when I ran the sample:
<faces …>
<geometry …>
<boneassignments …>
</submesh>
….
<submeshes>
<skeletonlink name=”Sinbad.skeleton” />
</mesh>
The format of the .skeleton file is like:
<skeleton>
<bones>
<bone id=”0″ name=”…”>
<bone id=”1″ name=”…”>
<bone id=”2″ name=”…”>
…
</bones>
<bonehierarchy>
…
</bonehierarchy>
<animations>
<animation name=”Dance” length=”…”>
<tracks>
<track bone=”ThumbMed.R”>
<track bone=”IndexFingerMed.R”>
<track bone=”Clavicle.R”>
…
</tracks>
</animation>
<animation name=”DrawSwords” length=”…”>
<tracks>
<track bone=”…”>
<track bone=”…”>
<track bone=”…”>
…
</tracks>
</animation>
…
</animations>
</skeleton>
Note:
1. In SinbadCharacterController::setupBody, sceneMgr->createMovableObject(“RibbonTrail”, ¶ms) is supposed to create an Ogre::RibbonTrail.
2. fading in/out animation makes the animation more natural (see SinbadCharacterController::fadeAnimations).
Sample_Compositor
The GUI of this sample has the following effects:
Bloom
Glass
Old TV
B&W
Embossed
Sharpen Edges
Invert
Posterize
Laplace
Tiling
Old Movie
HDR
Gaussian Blur
Radial Blur
ASCII
Halftone
Night Vision
Dither
Motion Blur
Heat Vision
Sample_Compositor::registerCompositors demonstrates how to register the parsed compositors to Ogre::CompositorManager.
In Sample_Compositor::checkBoxToggled, CompositorManager::getSingleton().setCompositorEnabled can enable/disable certain effect.
Note:
In Sample_Compositor::createTextures, “HalftoneVolume” is created for “media/materials/scripts/Halftone.material”; “DitherTex” is created for “media/materials/scripts/Dither.material”.
Sample_CubeMapping
Material “Examples/DynamicCubeMap” indicates that “ogrehead.mesh” needs cube mapping, and the cubic texture is generated in the sample.
The sample also inherits from Ogre::RenderTargetListener, overrides preRenderTargetUpdate and postRenderTargetUpdate methods.
The sample changes the perspective angles in preRenderTargetUpdate in order to make the cubic texture, and recovers the objects (which was set invisible in preRenderTargetUpdate) in postRenderTargetUpdate.
Note:
The creation/destruction of both entity and texture are managed by the OGRE engine, and there is nothing to do in the client side (no containers, no responsibility of destroying them). It's a nice design. It simplifies the work in the client side, and therefore decreases errors.
Sample_DeferredShading
The message box popped out when I ran the sample:
But it worked normally in another computer. I guess it's hardware dependent, and temporarily leave it unsolved.
The sample demonstrates deferred shading, and uses SSAO (Screen Space Ambient Occlusion) to beautify the output scene (SSAO uses the information in G-buffer as well). OGRE requires plenty of work in the client side to achieve deferred shading, so the code in both the CPU side and shaders is complex. I don't trace the details here, and only list some reference links and the class diagram I drew.
Sample_DualQuaternion
This is the first time I learn “dual quaternion skinning”. It's a paper in 2008:
Reference links:
http://www.crytek.com/cryengine/presentations/spherical-skinning-with-dual-quaternions-and-qtangents
In Sample_DualQuaternion::setupModels, the sample switches between “linear blend skinning” and “dual quaternion skinning” by setting different materials. See:
file media/materials/scripts/DualQuaternion.material
material spine
material spineDualQuat
本站的主題是商業,創業,美食,葡萄酒,閱讀,網路科技。