Screen-space ambient occlusion. 更多...
#include <AmbientOcclusion.h>
Public 成员函数 | |
| AmbientOcclusion (Graphics *gfx) | |
| ~AmbientOcclusion () | |
| AmbientOcclusion (const AmbientOcclusion &)=delete | |
| AmbientOcclusion & | operator= (const AmbientOcclusion &)=delete |
| void | setQuality (const std::string &quality) |
| "low" | "medium" | "high" (unknown → medium). | |
| std::string | getQuality () const |
| void | setMode (const std::string &mode) |
| "ssao" | "hbao" | "gtao". | |
| std::string | getMode () const |
| void | setCamera (float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ, float fovYDeg, float aspect, float nearZ, float farZ) |
| Camera for depth reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by compute*. | |
| void | setInvViewProj (const glm::mat4 &invViewProj) |
| void | setRadius (float radius) |
| void | setBias (float bias) |
| void | setIntensity (float intensity) |
| void | setPower (float power) |
| void | setThickness (float thickness) |
| float | getRadius () const |
| float | getBias () const |
| float | getIntensity () const |
| float | getPower () const |
| bool | hasParam (const std::string &name) const |
| void | setFloat (const std::string &name, float value) |
| float | getFloat (const std::string &name) const |
| int | getSampleCount () const |
| float | getDownscale () const |
| int | resolutionFor (int fullSize) const |
| Downscale helper: returns floor(dim / downscale), at least 1. Callers create AO canvases at this size for the active quality tier. | |
| void | compute (Graphics *gfx, Texture *linearDepth) |
| Compute AO into the currently bound canvas / screen. Output RGB = AO (1=open), A = depth01. | |
| void | computeTo (Graphics *gfx, Texture *linearDepth, Canvas *dest) |
| void | blur (Graphics *gfx, Texture *aoMap) |
| Bilateral blur of an AO map (RGB=AO, A=depth). | |
| void | blurTo (Graphics *gfx, Texture *aoMap, Canvas *dest) |
| void | applyOverlay (Graphics *gfx, Texture *aoMap) |
| Darken the current target with AO: black + alpha=(1-ao)*intensity. Draw over an already-rendered scene (SrcAlpha blend). | |
| void | applyOverlayTo (Graphics *gfx, Texture *aoMap, Canvas *dest) |
| void | applyFromDepth (Graphics *gfx, Texture *hwDepth) |
| One-pass SSAO overlay for the 3D swapchain path. Samples hardware D32 (Vulkan NDC z in .r) and darkens the already-drawn scene. Optional worldNormal is GBuffer RGB = n*0.5+0.5; null reconstructs from depth. Call after forward draws while the swapchain pass is still open. Canvas compute() still uses 8-bit linear depth in R. | |
| void | applyFromDepthTo (Graphics *gfx, Texture *linearDepth, Canvas *dest) |
| void | applyFromGBuffer (Graphics *gfx, Texture *hwDepth, Texture *worldNormal) |
| Texture * | newLinearDepthTexture (Graphics *gfx, int width, int height, float(*depth01)(int x, int y, void *userdata), void *userdata) |
| Build an RGBA8 texture with linear depth in R (G=B=R, A=255). Owned by Graphics (same convention as Volumetric). | |
| Shader * | getShader () const |
| Shader * | getSsaoShader () const |
| Shader * | getHbaoShader () const |
| Shader * | getGtaoShader () const |
| Shader * | getBlurShader () const |
| Shader * | getOverlayShader () const |
| Shader * | getFromDepthShader () const |
详细描述
Screen-space ambient occlusion.
Modes:
- "ssao" — Crytek/Mittring hemisphere sampling
- "hbao" — horizon-based AO (NVIDIA-inspired)
- "gtao" — ground-truth AO (Jimenez/Frostbite-inspired, single-frame)
Quality presets ("low" | "medium" | "high") control sample/dir counts and suggested downscale via resolutionFor().
Pipeline: compute(depth) → optional blur(ao) → applyOverlay(ao) over scene. Depth input matches Volumetric::newLinearDepthTexture (R = linear 0..1).
在文件 AmbientOcclusion.h 第 27 行定义.
构造及析构函数说明
◆ AmbientOcclusion() [1/2]
|
explicit |
在文件 AmbientOcclusion.cpp 第 158 行定义.
◆ ~AmbientOcclusion()
|
default |
◆ AmbientOcclusion() [2/2]
|
delete |
成员函数说明
◆ applyFromDepth()
One-pass SSAO overlay for the 3D swapchain path. Samples hardware D32 (Vulkan NDC z in .r) and darkens the already-drawn scene. Optional worldNormal is GBuffer RGB = n*0.5+0.5; null reconstructs from depth. Call after forward draws while the swapchain pass is still open. Canvas compute() still uses 8-bit linear depth in R.
在文件 AmbientOcclusion.cpp 第 428 行定义.
引用了 applyFromGBuffer().
被这些函数引用 applyFromDepthTo().
◆ applyFromDepthTo()
◆ applyFromGBuffer()
| void eve::graphics::AmbientOcclusion::applyFromGBuffer | ( | Graphics * | gfx, |
| Texture * | hwDepth, | ||
| Texture * | worldNormal | ||
| ) |
在文件 AmbientOcclusion.cpp 第 432 行定义.
引用了 eve::graphics::Graphics::drawTexturedRectShaderDepth(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Texture::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth(), eve::graphics::Texture::getWidth(), eve::graphics::Canvas::getWidth() , 以及 eve::graphics::Shader::sendFloat().
被这些函数引用 applyFromDepth() , 以及 eve::graphics::RenderSystem3D::render().
◆ applyOverlay()
Darken the current target with AO: black + alpha=(1-ao)*intensity. Draw over an already-rendered scene (SrcAlpha blend).
在文件 AmbientOcclusion.cpp 第 408 行定义.
引用了 eve::graphics::Shader::hasUniform() , 以及 eve::graphics::Shader::sendFloat().
被这些函数引用 applyOverlayTo().
◆ applyOverlayTo()
◆ blur()
Bilateral blur of an AO map (RGB=AO, A=depth).
在文件 AmbientOcclusion.cpp 第 392 行定义.
引用了 eve::graphics::Texture::getHeight(), eve::graphics::Texture::getWidth() , 以及 eve::graphics::Shader::sendFloat().
被这些函数引用 blurTo().
◆ blurTo()
在文件 AmbientOcclusion.cpp 第 399 行定义.
引用了 blur(), eve::graphics::Graphics::getCanvas() , 以及 eve::graphics::Graphics::setCanvas().
◆ compute()
Compute AO into the currently bound canvas / screen. Output RGB = AO (1=open), A = depth01.
在文件 AmbientOcclusion.cpp 第 376 行定义.
引用了 eve::graphics::Texture::getHeight() , 以及 eve::graphics::Texture::getWidth().
被这些函数引用 computeTo().
◆ computeTo()
| void eve::graphics::AmbientOcclusion::computeTo | ( | Graphics * | gfx, |
| Texture * | linearDepth, | ||
| Canvas * | dest | ||
| ) |
在文件 AmbientOcclusion.cpp 第 383 行定义.
引用了 compute(), eve::graphics::Graphics::getCanvas() , 以及 eve::graphics::Graphics::setCanvas().
◆ getBias()
| float eve::graphics::AmbientOcclusion::getBias | ( | ) | const |
在文件 AmbientOcclusion.cpp 第 290 行定义.
◆ getBlurShader()
|
inline |
在文件 AmbientOcclusion.h 第 118 行定义.
◆ getDownscale()
|
inline |
在文件 AmbientOcclusion.h 第 70 行定义.
◆ getFloat()
| float eve::graphics::AmbientOcclusion::getFloat | ( | const std::string & | name | ) | const |
在文件 AmbientOcclusion.cpp 第 311 行定义.
引用了 active, eve::graphics::Shader::getFromVar(), eve::graphics::Shader::hasUniform(), name , 以及 v.
被这些函数引用 getSampleCount().
◆ getFromDepthShader()
|
inline |
在文件 AmbientOcclusion.h 第 120 行定义.
◆ getGtaoShader()
|
inline |
在文件 AmbientOcclusion.h 第 117 行定义.
◆ getHbaoShader()
|
inline |
在文件 AmbientOcclusion.h 第 116 行定义.
◆ getIntensity()
| float eve::graphics::AmbientOcclusion::getIntensity | ( | ) | const |
在文件 AmbientOcclusion.cpp 第 291 行定义.
◆ getMode()
|
inline |
在文件 AmbientOcclusion.h 第 41 行定义.
◆ getOverlayShader()
|
inline |
在文件 AmbientOcclusion.h 第 119 行定义.
◆ getPower()
| float eve::graphics::AmbientOcclusion::getPower | ( | ) | const |
在文件 AmbientOcclusion.cpp 第 292 行定义.
◆ getQuality()
|
inline |
在文件 AmbientOcclusion.h 第 37 行定义.
◆ getRadius()
| float eve::graphics::AmbientOcclusion::getRadius | ( | ) | const |
在文件 AmbientOcclusion.cpp 第 289 行定义.
◆ getSampleCount()
| int eve::graphics::AmbientOcclusion::getSampleCount | ( | ) | const |
Effective sample count (ssao) or dirCount*stepCount (hbao/gtao).
在文件 AmbientOcclusion.cpp 第 335 行定义.
引用了 getFloat().
◆ getShader()
| Shader * eve::graphics::AmbientOcclusion::getShader | ( | ) | const |
在文件 AmbientOcclusion.cpp 第 176 行定义.
◆ getSsaoShader()
|
inline |
在文件 AmbientOcclusion.h 第 115 行定义.
◆ hasParam()
| bool eve::graphics::AmbientOcclusion::hasParam | ( | const std::string & | name | ) | const |
在文件 AmbientOcclusion.cpp 第 294 行定义.
引用了 eve::graphics::Shader::hasUniform() , 以及 name.
◆ newLinearDepthTexture()
| Texture * eve::graphics::AmbientOcclusion::newLinearDepthTexture | ( | Graphics * | gfx, |
| int | width, | ||
| int | height, | ||
| float(*)(int x, int y, void *userdata) | depth01, | ||
| void * | userdata | ||
| ) |
Build an RGBA8 texture with linear depth in R (G=B=R, A=255). Owned by Graphics (same convention as Volumetric).
在文件 AmbientOcclusion.cpp 第 459 行定义.
引用了 b, d, height, eve::graphics::Graphics::newTexture(), width, x , 以及 y.
◆ operator=()
|
delete |
◆ resolutionFor()
| int eve::graphics::AmbientOcclusion::resolutionFor | ( | int | fullSize | ) | const |
Downscale helper: returns floor(dim / downscale), at least 1. Callers create AO canvases at this size for the active quality tier.
在文件 AmbientOcclusion.cpp 第 344 行定义.
◆ setBias()
| void eve::graphics::AmbientOcclusion::setBias | ( | float | bias | ) |
在文件 AmbientOcclusion.cpp 第 267 行定义.
引用了 setFloat().
◆ setCamera()
| void eve::graphics::AmbientOcclusion::setCamera | ( | float | eyeX, |
| float | eyeY, | ||
| float | eyeZ, | ||
| float | targetX, | ||
| float | targetY, | ||
| float | targetZ, | ||
| float | upX, | ||
| float | upY, | ||
| float | upZ, | ||
| float | fovYDeg, | ||
| float | aspect, | ||
| float | nearZ, | ||
| float | farZ | ||
| ) |
Camera for depth reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by compute*.
在文件 AmbientOcclusion.cpp 第 238 行定义.
引用了 fovRad, eve::graphics::perspectiveVulkanRH_ZO(), proj, eve::graphics::Shader::sendFloat(), setInvViewProj() , 以及 view.
◆ setFloat()
| void eve::graphics::AmbientOcclusion::setFloat | ( | const std::string & | name, |
| float | value | ||
| ) |
在文件 AmbientOcclusion.cpp 第 302 行定义.
引用了 eve::graphics::Shader::hasUniform(), name, eve::graphics::Shader::sendFloat() , 以及 value.
被这些函数引用 setBias(), setIntensity(), setPower() , 以及 setRadius().
◆ setIntensity()
| void eve::graphics::AmbientOcclusion::setIntensity | ( | float | intensity | ) |
在文件 AmbientOcclusion.cpp 第 272 行定义.
引用了 eve::graphics::Shader::sendFloat() , 以及 setFloat().
◆ setInvViewProj()
| void eve::graphics::AmbientOcclusion::setInvViewProj | ( | const glm::mat4 & | invViewProj | ) |
◆ setMode()
| void eve::graphics::AmbientOcclusion::setMode | ( | const std::string & | mode | ) |
"ssao" | "hbao" | "gtao".
在文件 AmbientOcclusion.cpp 第 220 行定义.
◆ setPower()
| void eve::graphics::AmbientOcclusion::setPower | ( | float | power | ) |
在文件 AmbientOcclusion.cpp 第 278 行定义.
引用了 power , 以及 setFloat().
◆ setQuality()
| void eve::graphics::AmbientOcclusion::setQuality | ( | const std::string & | quality | ) |
"low" | "medium" | "high" (unknown → medium).
在文件 AmbientOcclusion.cpp 第 215 行定义.
◆ setRadius()
| void eve::graphics::AmbientOcclusion::setRadius | ( | float | radius | ) |
在文件 AmbientOcclusion.cpp 第 262 行定义.
引用了 setFloat().
◆ setThickness()
| void eve::graphics::AmbientOcclusion::setThickness | ( | float | thickness | ) |
在文件 AmbientOcclusion.cpp 第 283 行定义.
引用了 eve::graphics::Shader::hasUniform(), eve::graphics::Shader::sendFloat() , 以及 thickness.
该类的文档由以下文件生成:
- src/modules/graphics/AmbientOcclusion.h
- src/modules/graphics/AmbientOcclusion.cpp