Screen-space model outline (t3ssel8r-style), computed from the GBuffer hardware depth + world-normal buffers. 更多...
#include <Outline.h>
Public 成员函数 | |
| Outline (Graphics *gfx) | |
| ~Outline () | |
| Outline (const Outline &)=delete | |
| Outline & | operator= (const Outline &)=delete |
| void | setColor (float r, float g, float b) |
| float | getColorR () const |
| float | getColorG () const |
| float | getColorB () const |
| void | setWidth (float width) |
| Outline thickness in screen pixels (>= 0.5). | |
| float | getWidth () const |
| void | setDepthThreshold (float threshold) |
| View-space depth discontinuity that starts a depth edge. | |
| float | getDepthThreshold () const |
| void | setDepthSensitivity (float sensitivity) |
| Extra per-unit-distance depth tolerance (keeps outlines distance-consistent). | |
| float | getDepthSensitivity () const |
| void | setNormalThreshold (float threshold) |
| Normal discontinuity (1 - dot(n, nN)) that starts a crease edge. | |
| float | getNormalThreshold () const |
| void | setSoftness (float softness) |
| Smoothstep band used to fade edges (0 = hard, 1 = soft). | |
| float | getSoftness () const |
| void | setClip (float nearZ, float farZ) |
| Near/far used to linearize the hardware depth. | |
| bool | hasParam (const std::string &name) const |
| void | setFloat (const std::string &name, float value) |
| float | getFloat (const std::string &name) const |
| 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) |
| Shader * | getShader () const |
详细描述
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 第 50 行定义.
◆ ~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 第 143 行定义.
引用了 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 | ||
| ) |
在文件 Outline.cpp 第 159 行定义.
引用了 apply(), eve::graphics::Graphics::getCanvas(), ok , 以及 eve::graphics::Graphics::setCanvas().
◆ getColorB()
| float eve::graphics::Outline::getColorB | ( | ) | const |
在文件 Outline.cpp 第 69 行定义.
◆ getColorG()
| float eve::graphics::Outline::getColorG | ( | ) | const |
在文件 Outline.cpp 第 68 行定义.
◆ getColorR()
| float eve::graphics::Outline::getColorR | ( | ) | const |
在文件 Outline.cpp 第 67 行定义.
◆ getDepthSensitivity()
| float eve::graphics::Outline::getDepthSensitivity | ( | ) | const |
在文件 Outline.cpp 第 90 行定义.
◆ getDepthThreshold()
| float eve::graphics::Outline::getDepthThreshold | ( | ) | const |
在文件 Outline.cpp 第 83 行定义.
◆ getFloat()
| float eve::graphics::Outline::getFloat | ( | const std::string & | name | ) | const |
在文件 Outline.cpp 第 124 行定义.
引用了 eve::graphics::Shader::getFromVar(), name , 以及 v.
◆ getNormalThreshold()
| float eve::graphics::Outline::getNormalThreshold | ( | ) | const |
在文件 Outline.cpp 第 97 行定义.
◆ getShader()
◆ getSoftness()
| float eve::graphics::Outline::getSoftness | ( | ) | const |
在文件 Outline.cpp 第 104 行定义.
◆ getWidth()
| float eve::graphics::Outline::getWidth | ( | ) | const |
在文件 Outline.cpp 第 76 行定义.
◆ hasParam()
| bool eve::graphics::Outline::hasParam | ( | const std::string & | name | ) | const |
在文件 Outline.cpp 第 115 行定义.
引用了 eve::graphics::Shader::hasUniform() , 以及 name.
◆ operator=()
◆ setClip()
| void eve::graphics::Outline::setClip | ( | float | nearZ, |
| float | farZ | ||
| ) |
Near/far used to linearize the hardware depth.
在文件 Outline.cpp 第 106 行定义.
◆ setColor()
| void eve::graphics::Outline::setColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
在文件 Outline.cpp 第 56 行定义.
引用了 b , 以及 eve::graphics::Shader::sendFloat().
◆ setDepthSensitivity()
| void eve::graphics::Outline::setDepthSensitivity | ( | float | sensitivity | ) |
Extra per-unit-distance depth tolerance (keeps outlines distance-consistent).
在文件 Outline.cpp 第 85 行定义.
◆ setDepthThreshold()
| void eve::graphics::Outline::setDepthThreshold | ( | float | threshold | ) |
View-space depth discontinuity that starts a depth edge.
在文件 Outline.cpp 第 78 行定义.
◆ setFloat()
| void eve::graphics::Outline::setFloat | ( | const std::string & | name, |
| float | value | ||
| ) |
在文件 Outline.cpp 第 119 行定义.
引用了 name, eve::graphics::Shader::sendFloat() , 以及 value.
◆ setNormalThreshold()
| void eve::graphics::Outline::setNormalThreshold | ( | float | threshold | ) |
Normal discontinuity (1 - dot(n, nN)) that starts a crease edge.
在文件 Outline.cpp 第 92 行定义.
◆ setSoftness()
| void eve::graphics::Outline::setSoftness | ( | float | softness | ) |
Smoothstep band used to fade edges (0 = hard, 1 = soft).
在文件 Outline.cpp 第 99 行定义.
◆ setWidth()
| void eve::graphics::Outline::setWidth | ( | float | width | ) |
Outline thickness in screen pixels (>= 0.5).
在文件 Outline.cpp 第 71 行定义.
引用了 eve::graphics::Shader::sendFloat() , 以及 width.
该类的文档由以下文件生成:
- src/modules/graphics/Outline.h
- src/modules/graphics/Outline.cpp