当前位置: 首页 > 工具软件 > Ogre-Next > 使用案例 >

ogre-next 学习笔记 - Day 6

端木昱
2023-12-01

ogre-next 学习笔记 - Day 6

看完了hlms,看看还有没有不一样的东西。
看了看ogre解决方案,除了hlms以及与ogre1.x相同的东西,就只剩一堆的sample。

看看每个sample都是干嘛的。


Sample_AnimationTagPoint

"TagPoints are much more powerful in 2.1 than they were in 1.x\n"
"The 1.x TagPoints have many issues which won't be described here.\n"
"In 2.1; TagPoints are for all intent and purposes, superior SceneNodes\n"
"Those wanting full flexibility may choose to only use TagPoints instead of.\n"
"SceneNodes, thus your nodes will always be able to be attached and detached\n"
"to/from bones at will without worrying about proper downcasting or keeping track\n"
"of which nodes are TagPoints and which are regular SceneNodes.\n"
"Note however TagPoints consume a little more RAM per node than SceneNodes.\n\n"
"This sample shows multiple ways in which TagPoints are used to attach to bones\n"

ogre2.x的 TagPoints 更强大。


Sample_AreaApproxLights

"Shows how to setup texture masks for the Area Light fake approximations.\n"
"using Overlays and the Unlit Hlms implementation.\n"
"Also shows photorealistic area lights using Linearly Transformed Cosines (LTC).\n"
"LTC area lights currently do not support textures. Approximation does.\n"
"Please note area lights use regular Forward (not Forward+) and cannot have\n"
"shadow mapping.\n"
"This sample depends on the media files:\n"
"   * Samples/Media/2.0/scripts/Compositors/ShadowMapDebugging.compositor" 

展示通过设置纹理mask实现近似区域光。以及线性余弦变化算法实现照片级光照。


Sample_CustomRenderable

"Shows how to create a custom class derived from both MovableObject and Renderable\n"
"for fine control over rendering.\n"
"This example uses an Immutable buffer. For an in-depth example of how to use the\n"
"the other two different types of buffers (default and dynamic) which allow\n"
"modification, see the DynamicGeometry sample."

展示如何自定义renderable。


Sample_Decals

 "LEGAL: Uses Saint Peter's Basilica (C) by Emil Persson under CC Attrib 3.0 Unported\n"
"See Samples/Media/materials/textures/Cubemaps/License.txt for more information."

屏幕空间贴花


Sample_DynamicGeometry

        "Shows how to create a Mesh programmatically from code and update it.\n"
        "None of the cubes were loaded from disk.\n"
        "All of the animation is performed by uploading new vertex data from CPU.\n"
        "The cubes, from left to right.\n"
        "   1. It is a BT_IMMUTABLE buffer example.\n"
        "   2. Uses BT_DEFAULT buffer and updates a single vertex.\n"
        "   3. Uses BT_DYNAMIC_* and uploads all the vertices again on every map\n"
        "      (dynamic buffers are required to reupload all data after mapping).\n"
        "   4. Same as 3., but shows how to perform more than one map per frame\n"
        "      (advanced GPU memory management)." 

动态几何体


Sample_Forward3D

"Forward3D & Clustered are techniques capable of rendering many lights. It is required in order\n"  
"to render non-shadow casting non-directional lights with the PBS implementation.\n"
"Deferred shading has a lot of problems (transparency, antialiasing, multiple BDRF). Besides,\n"
"it uses a lot of bandwidth. Forward+/Forward2.5 is great, but requires DX11 HW (needs UAV) and\n"
"a Z-Prepass. This Z-prepass is often a turn off for many (even though in some cases it may\n"
"improve performance, i.e. if you’re heavily pixel shader or ROP [Raster OPeration] bound).\n"
"It’s not superior on all accounts, but it can work on DX10 hardware and doesn’t require a\n"
"Z-prepass. The result is a nice generic algorithm that can run on a lot of hardware and can\n"
"handle a lot of lights. Whether it performs better or worse than Deferred or Forward+ depends\n"
"on the scene.\n"
"\n\n"
"Like its alternatives Defered & Forward+, it works best with many small lights, or few big\n"
"lights.\n"
"Forward3D & Clustered have many parameters, and this demo shows different presets that often\n"
"trade quality for speed; but sometimes some presets work better on some scenarios than others.\n"
"This demo stresses the implementation, showing you both its strengths and limitations\n"
"   1. Increase the number of lights to show the artifacts.\n"
"   2. Decrease the lights' radius to alleviate the artifacts.\n"
"   3. Switch profiles to see the differences. Often profile 0 & 5 work best.\n"
"   4. Repeat steps 1 through 3 using a High threshold.\n"
"   5. It may be better to have fewer but bigger lights in outdoor scenes\n"
"   6. Lights are 'lodded' based on distance to camera as a side effect of how the algorithm works\n"
"It is quite unrealistic that all lights to have the same parameters. Heterogenous\n"
"light parameters will give you better results.\n"
"Also avoid keeping too many lights tight in the same place. If we increase the distance\n"
"between each light in this sample, the artifacts begin to disappear.\n"
"Light's size has a direct impact on quality. Theoretically all lights have an unlimited\n"
"range. However we cut it off after certain threshold for performance reasons. Very low\n"
"thresholds stress the F3D system, but very high thresholds will cut the light too early.\n"
"\n"
"Forward+ and Deferred as alternative implementations are planned in the future.\n"
"\n"
"This sample depends on the media files:\n"
"   * Samples/Media/2.0/scripts/Compositors/ShadowMapDebugging.compositor"

Forward3D和 Clustered技术能够渲染许多灯光。使用PBS实现。


Sample_Hdr

"This samples shows the HDR (High Dynamic Range) pipeline in action\n"
"HDR combined with PBR let us use real world values as input for our lighting and\n"
"a real world scale such as lumen, lux and EV Stops (photography, in log2 space)\n"
"The parameters for the presets have been taken from Wikipedia:\n"

HDR


Sample_HdrSmaa

 "This samples shows how to use HDR in combination with SMAA\n"
        "See HDR sample and Tutorial_SMAA for separate if you wish to see them individually.\n"
        "This sample depends on the media files:\n"
        "   * Samples/Media/2.0/materials/Common/Copyback.material (Copyback_1xFP32_ps)\n"
        "   * Samples/Media/2.0/materials/HDR/*.*\n"
        "   * Samples/Media/2.0/materials/Tutorial_SMAA/*.*\n"
        "   * Samples/Media/2.0/materials/HDR_SMAA/*.*\n"
        "\n"
        "\n"
        "LEGAL: Uses Saint Peter's Basilica (C) by Emil Persson under CC Attrib 3.0 Unported\n"
        "See Samples/Media/materials/textures/Cubemaps/License.txt for more information."

HDR + SMAA


Sample_ImportAnimationsShareSkeletonInstance

        "This sample shows how to directly import animation clips from multiple .skeleton files \n"
        "directly into a single skeleton from a v2Mesh\n"
        "And also how to share the same skeleton instance between components of the same\n"
        "actor/character. For example, an RPG player wearing armour, boots, helmets, etc.\n"
        "In this sample, the feet, hands, head, legs and torso are all separate items using\n"
        "the same skeleton." );

从多个.skeleton里导入动画片段文件。


Sample_InstantRadiosity

"This sample shows how to use 'Instant Radiosity' (IR for short).\n"
"IR traces rays in CPU and creates a VPL (Virtual Point Light) at every hit point to mimic\n"
"the effect of Global Illumination. A few highlights:\n"
"   * As GI solution, IR is neither too fast nor too slow. Somewhere in the middle.\n"
"   * The build process may be expensive enough for it to not be real time.\n"
"   * The advantage of IR is that it works on dynamic objects.\n"
"   * VPLs get averaged and clustered based on cluster size to improve speed.\n"
"There's several ways to fight light leaking:\n"
"   * Smaller cluster sizes are more accurate, but are much slower (because of more VPLs)\n"
"   * Smaller mVplMaxRange is faster and leaks less, but its illumination reach is lower,\n"
"     causing them to be less accurate\n"
"   * mBias pushes the placement of the VPL away from its true position. This is not physically\n"
"     accurate but allows to reduce mVplMaxRange and fight light leaking at the same time.\n"
"   * mVplThreshold helps removing very weak VPLs, improving performance\n"

使用IR算法的全局光照。


Sample_LocalCubemaps

"This sample shows how to use Parallax Reflect Cubemaps for accurate local reflections.\n"
"First, you'll have to create several probes with parametrized sizes, and the system\n"
"will transition between the areas as you move around\n"
"\n"
"This sample depends on the media files:\n"
"   * Samples/Media/2.0/scripts/Compositors/LocalCubemaps.compositor\n"
"   * Samples/Media/2.0/materials/LocalCubemaps/*\n"
"\n"

演示如何使用视差反射立方体贴图进行精确的局部反射


Sample_LocalCubemapsManualProbes

 "This sample shows how to use Parallax Reflect Cubemaps for accurate local reflections.\n"
        "This time, we showcase the differences between manual and automatic modes.\n"
        "The documentation of HlmsPbsDatablock::setCubemapProbe explains the differences.\n"
        "But in summary:\n\n"

演示如何使用视差反射立方体贴图进行精确的局部反射。展示手动和自动模式之间的差异


Sample_MorphAnimations

        "This sample shows how to setup morph animations. \n"

此示例显示如何设置变形动画


Sample_PbsMaterials

"Shows how to use the PBS material system. There's nothing really fancy,\n"
        "it's just programmer art. The PBS materials can be setup from script or\n"
        "code. This sample does both. At the time being, not all settings from the\n"

PBS材质

Sample_Postprocessing

        "Shows how to use the compositor for postprocessing effects.\n"

后处理

Sample_ScreenSpaceReflections


屏幕空间反射。


Sample_ShadowMapDebugging

       "Shows how to render the shadow map textures from a shadow node (compositor),\n"
        "using Overlays and the Unlit Hlms implementation.\n"

渲染阴影贴图纹理

Sample_ShadowMapFromCode

        "This sample is almost exactly the same as ShadowMapDebugging.\n"
        "The main difference is that the shadow nodes are being generated programmatically\n"
        "via ShadowNodeHelper::createShadowNodeWithSettings instead of relying on\n"
        "Compositor scripts.\n"
        "This sample was added due to popular demand.\n\n"
        "Creating shadow nodes via code can be a complex and error prone task, thus\n"
        "ShadowNodeHelper greatly facilitates the job.\n"
        "If the code does not suit your particular needs, you can grab its internal code\n"
        "and analyze/understand how it works so you can adapt it to your particular needs.\n" );

通过代码实现渲染阴影贴图

Sample_StencilTest

        "Shows how to properly use the Stencil Test. A sphere is drawn in one pass, filling\n"

模板测试

Sample_StereoRendering

"This tutorial demonstrates the most basic rendering loop: Variable framerate.\n"
"Variable framerate means the application adapts to the current frame rendering\n"
"performance and boosts or decreases the movement speed of objects to maintain\n"
"the appearance that objects are moving at a constant velocity.\n"
"When framerate is low, it looks 'frame skippy'; when framerate is high,\n"
"it looks very smooth.\n"
"Note: If you can't exceed 60 FPS, it's probably because of VSync being turned on.\n"
"\n"
"Despite what it seems, this is the most basic form of updating, and a horrible way\n"
"to update your objects if you want to do any kind of serious game development.\n"
"Keep going through the Tutorials for superior methods of updating the rendering loop.\n"
"\n"
"Note: The cube is black because there is no lighting. We are not focusing on that." );

立体渲染(用于VR)


Sample_Tutorial_Distortion

"This example shows how to make compositing setup that renders different parts of the scene to different textures.\n"
"Here we will render distortion pass to its own texture and use shader to compose the scene and distortion pass.\n"
"Distortion setup can be used to create blastwave effects, mix with fire particle effects to get heat distortion etc.\n"
"You can use this setup with all kind of objects but in this example we are using only textured simple spheres\n"
"For proper use, you should use particle systems to get better results.\n" );

纹理变形


Sample_Tutorial_DynamicCubemap

 "Shows how to setup dynamic cubemapping via the compositor, so that it can\n"
        "be used for dynamic reflections.\n"

动态cubemapping,以便用于动态反射。


Sample_Tutorial_ReconstructPosFromDepth

        "This tutorial shows how to reconstruct the position from only the depth buffer in\n"
        "a very efficient way. This is very useful for Deferred Shading, SSAO, etc.\n"
        "The sample uses the compositor feature 'quad_normals camera_far_corners_view_space'\n"
        "in combination with a special shader so that we can unproject the depth sampled\n"
        "from the depth buffer and combine it with the frustum corners to get the view space\n"
        "projection. The code (commented out) also shows how to get the world-space position\n"
        "which requires only slight adjustments.\n\n"
        "Additionally, we show how to avoid depth buffer decompression using the compositor.\n"

通过深度缓冲重构位置。


Sample_Tutorial_SMAA

SMAA
对与SMAA的介绍,网上有很多。SMAA的实现细节可以看

SMAA算法详解


Sample_Tutorial_SSAO

SSAO


Sample_Tutorial_Terrain

Terrain


Sample_Tutorial01_Initialization

初始化


Sample_Tutorial02_VariableFramerate

可变帧率


Sample_Tutorial03_DeterministicLoop

    "This tutorial is very similar to Tutorial02; however it uses a fixed framerate instead\n"
    "of a variable one. This means timeSinceLast will always be 1/25 (or whatever value you\n"
    "set); and the update will always be capped at 25hz / 25 FPS.\n"
    "We chose a value of 25hz to demonstrate the big difference. A value of 60hz will look\n"
    "smooth.\n"
    "\n"

本教程与教程02非常相似;但是,它使用固定的帧速率而不是可变的帧速率。这意味着TimesInclast将始终为1/25(或您设置的任何值);并且更新将始终限制在25hz/25fps。我们选择了一个25hz的值来演示这个巨大的差异。60hz的值看起来很平滑。


Sample_Tutorial04_InterpolationLoop

"This tutorial combines fixed and variable framerate: Logic is executed at 25hz, while\n"
"graphics are being rendered at a variable rate, interpolating between frames to\n"
"achieve a smooth result.\n"
"When OGRE or the GPU is taking too long, you will see a 'frame skip' effect, when\n"
"the CPU is taking too long to process the Logic code, you will see a 'slow motion'\n"
"effect.\n"

本教程结合了固定帧速率和可变帧速率:逻辑以25hz执行,图形以可变速率渲染,在帧之间插值以获得平滑结果


Sample_Tutorial05_MultithreadingBasics

"This tutorial shows how to setup two update loops: One for Graphics, another for\n"
        "Logic, each in its own thread. We don't render anything because we will now need\n"
        "to do a robust synchronization for creating, destroying and updating Entities,\n"
        "which is too complex to show in just one tutorial step.\n"
        "\n"
    

基本的多线程渲染

Sample_Tutorial06_Multithreading

高级多线程渲染


Sample_TutorialCompute01_UavTexture

        "This sample shows how to setup and use UAV Textures with compute shaders." );

计算着色器的无序访问纹理


Sample_TutorialCompute02_UavBuffer

无序访问缓存


Sample_TutorialSky_Postprocess

        "Shows how to create a sky as simple postprocess effect.\n"
        "The vertex shader ensures the depth is always = 1, and the pixel shader\n"
        "takes a cubemap texture.\n"

使用后处理创建天空


Sample_TutorialUav01_Setup

        "Shows how to setup an UAV (Unordered Access View).\n"

设置UAV


Sample_TutorialUav02_Setup

        "This sample is exactly as TutorialUav01_Setup, except that it shows\n"
        "reading from the UAVs as an UAV (e.g. use imageLoad) instead of using\n"

读取UAV


Sample_V1Interfaces

ogre 2.x使用ogre1.x 对象,例如Entity


Sample_V2ManualObject

"Original ManualObject allowed users to simply create custom meshes in runtime.\n"

运行时简单地创建自定义网格


Sample_V2Mesh

"The mesh file format for v2 objects (i.e. Items) is currently WIP. You can easily\n"
"import V1 meshes into the V2 format.\n"

ogre2.x mesh。ogre2.x导入 ogre1.x的mesh。


只是简单的过了一遍每个sample的描述,并没有细看。大概知道了每个sample的作用。都是如何使用ogre2.x的功能。

到这里oger2.x的大致功能已经分析完了。

接下来就可以深入 ogre-next 了。

从这几天的学习来看,虽然ogre-next没有很多的文档,但是它自身的结构,流程以及sample功能的描述更合理,也更详尽。所以学起来花的时间/精力不算很多。

由于ogre-next使用了很多高级技术,大多数又基于HLMS。HLMS的设计是为了降低代码以及shader编写,用起来会更简单。但是,反过来说,想要深入的话,需要更多的相关知识,更好的代码以及shader能力了。

 类似资料: