Screen-space model outline (t3ssel8r-style), computed from the GBuffer hardware depth + world-normal buffers. 更多...
#include <Outline.h>
Public 成员函数 | |
| Outline (Graphics *gfx) | |
| Outline. | |
| ~Outline () | |
| Outline. | |
| Outline (const Outline &)=delete | |
| Outline & | operator= (const Outline &)=delete |
| void | setColor (float r, float g, float b) |
| Sets the color. | |
| float | getColorR () const |
| Returns the color r. | |
| float | getColorG () const |
| Returns the color g. | |
| float | getColorB () const |
| Returns the color b. | |
| void | setWidth (float width) |
| Outline thickness in screen pixels (>= 0.5). | |
| float | getWidth () const |
| Returns the width. | |
| void | setDepthThreshold (float threshold) |
| View-space depth discontinuity that starts a depth edge. | |
| float | getDepthThreshold () const |
| Returns the depth threshold. | |
| void | setDepthSensitivity (float sensitivity) |
| Extra per-unit-distance depth tolerance (keeps outlines distance-consistent). | |
| float | getDepthSensitivity () const |
| Returns the depth sensitivity. | |
| void | setNormalThreshold (float threshold) |
| Normal discontinuity (1 - dot(n, nN)) that starts a crease edge. | |
| float | getNormalThreshold () const |
| Returns the normal threshold. | |
| void | setSoftness (float softness) |
| Smoothstep band used to fade edges (0 = hard, 1 = soft). | |
| float | getSoftness () const |
| Returns the softness. | |
| void | setClip (float nearZ, float farZ) |
| Near/far used to linearize the hardware depth. | |
| bool | hasParam (const std::string &name) const |
| True when param. | |
| void | setFloat (const std::string &name, float value) |
| Sets the float. | |
| float | getFloat (const std::string &name) const |
| Returns the float. | |
| bool | apply (Graphics *gfx, Texture *hwDepth, Texture *worldNormal) |
Draw the outline over the currently bound canvas / screen. hwDepth is the D32 GBuffer (Vulkan NDC z), worldNormal the GBuffer world normal (RGBA8, n * 0.5 + 0.5). Automatically uploads texel size and clip uniforms. Returns false if either input is missing. | |
| bool | applyTo (Graphics *gfx, Texture *hwDepth, Texture *worldNormal, Canvas *dest) |
| Applies to. | |
| Shader * | getShader () const |
| Returns the shader. | |
详细描述
Screen-space model outline (t3ssel8r-style), computed from the GBuffer hardware depth + world-normal buffers.
Technique: for every pixel sample the depth (Vulkan NDC z, binding 0) and world normal (RGB = n * 0.5 + 0.5, binding 1) of an 8-neighbourhood at a configurable width. A pixel becomes an outline when the view-space depth discontinuity (silhouette / occlusion edge) or the normal discontinuity (crease) exceeds a threshold. The pass emits vec4(outlineColor, edgeMask) which is blended (SrcAlpha) over the already-rendered scene, so applying it on top of a 3D frame yields crisp ink outlines without a separate composite target.
Pipeline: single screen-space draw reading depth + normal. Feed it the GBuffer textures from RenderControl::getGBuffer() (getHwDepthTexture() / getNormalTexture()) after the 3D geometry pass, with the scene still bound as the current canvas. See AmbientOcclusion::applyFromGBuffer for the same binding convention.
构造及析构函数说明
◆ Outline() [1/2]
|
explicit |
在文件 Outline.cpp 第 54 行定义.
◆ ~Outline()
|
default |
◆ Outline() [2/2]
|
delete |
成员函数说明
◆ apply()
Draw the outline over the currently bound canvas / screen. hwDepth is the D32 GBuffer (Vulkan NDC z), worldNormal the GBuffer world normal (RGBA8, n * 0.5 + 0.5). Automatically uploads texel size and clip uniforms. Returns false if either input is missing.
在文件 Outline.cpp 第 147 行定义.
引用了 eve::graphics::Graphics::drawTexturedRectShaderDepth(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth() , 以及 eve::graphics::Canvas::getWidth().
被这些函数引用 applyTo() , 以及 eve::graphics::RenderSystem3D::render().
◆ applyTo()
| bool eve::graphics::Outline::applyTo | ( | Graphics * | gfx, |
| Texture * | hwDepth, | ||
| Texture * | worldNormal, | ||
| Canvas * | dest | ||
| ) |
Applies to.
在文件 Outline.cpp 第 163 行定义.
引用了 apply(), eve::graphics::Graphics::getCanvas(), ok , 以及 eve::graphics::Graphics::setCanvas().
◆ getColorB()
| float eve::graphics::Outline::getColorB | ( | ) | const |
Returns the color b.
在文件 Outline.cpp 第 73 行定义.
◆ getColorG()
| float eve::graphics::Outline::getColorG | ( | ) | const |
Returns the color g.
在文件 Outline.cpp 第 72 行定义.
◆ getColorR()
| float eve::graphics::Outline::getColorR | ( | ) | const |
Returns the color r.
在文件 Outline.cpp 第 71 行定义.
◆ getDepthSensitivity()
| float eve::graphics::Outline::getDepthSensitivity | ( | ) | const |
Returns the depth sensitivity.
在文件 Outline.cpp 第 94 行定义.
◆ getDepthThreshold()
| float eve::graphics::Outline::getDepthThreshold | ( | ) | const |
Returns the depth threshold.
在文件 Outline.cpp 第 87 行定义.
◆ getFloat()
| float eve::graphics::Outline::getFloat | ( | const std::string & | name | ) | const |
◆ getNormalThreshold()
| float eve::graphics::Outline::getNormalThreshold | ( | ) | const |
Returns the normal threshold.
在文件 Outline.cpp 第 101 行定义.
◆ getShader()
|
inline |
◆ getSoftness()
| float eve::graphics::Outline::getSoftness | ( | ) | const |
Returns the softness.
在文件 Outline.cpp 第 108 行定义.
◆ getWidth()
| float eve::graphics::Outline::getWidth | ( | ) | const |
Returns the width.
在文件 Outline.cpp 第 80 行定义.
◆ hasParam()
| bool eve::graphics::Outline::hasParam | ( | const std::string & | name | ) | const |
◆ operator=()
◆ setClip()
| void eve::graphics::Outline::setClip | ( | float | nearZ, |
| float | farZ | ||
| ) |
Near/far used to linearize the hardware depth.
在文件 Outline.cpp 第 110 行定义.
◆ setColor()
| void eve::graphics::Outline::setColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
◆ setDepthSensitivity()
| void eve::graphics::Outline::setDepthSensitivity | ( | float | sensitivity | ) |
Extra per-unit-distance depth tolerance (keeps outlines distance-consistent).
在文件 Outline.cpp 第 89 行定义.
◆ setDepthThreshold()
| void eve::graphics::Outline::setDepthThreshold | ( | float | threshold | ) |
View-space depth discontinuity that starts a depth edge.
在文件 Outline.cpp 第 82 行定义.
◆ setFloat()
| void eve::graphics::Outline::setFloat | ( | const std::string & | name, |
| float | value | ||
| ) |
◆ setNormalThreshold()
| void eve::graphics::Outline::setNormalThreshold | ( | float | threshold | ) |
Normal discontinuity (1 - dot(n, nN)) that starts a crease edge.
在文件 Outline.cpp 第 96 行定义.
◆ setSoftness()
| void eve::graphics::Outline::setSoftness | ( | float | softness | ) |
Smoothstep band used to fade edges (0 = hard, 1 = soft).
在文件 Outline.cpp 第 103 行定义.
◆ setWidth()
| void eve::graphics::Outline::setWidth | ( | float | width | ) |
Outline thickness in screen pixels (>= 0.5).
在文件 Outline.cpp 第 75 行定义.
引用了 eve::graphics::Shader::sendFloat() , 以及 width.
该类的文档由以下文件生成:
- src/modules/graphics/Outline.h
- src/modules/graphics/Outline.cpp