载入中...
搜索中...
未找到
eve::graphics::AmbientOcclusion类 参考

Screen-space ambient occlusion. 更多...

#include <AmbientOcclusion.h>

Public 成员函数

 AmbientOcclusion (Graphics *gfx)
 Ambient occlusion.
 
 ~AmbientOcclusion ()
 Ambient occlusion.
 
 AmbientOcclusion (const AmbientOcclusion &)=delete
 
AmbientOcclusion & operator= (const AmbientOcclusion &)=delete
 
void setQuality (const std::string &quality)
 "low" | "medium" | "high" (unknown → medium).
 
std::string getQuality () const
 Returns the quality.
 
void setMode (const std::string &mode)
 "ssao" | "hbao" | "gtao".
 
std::string getMode () const
 Returns the mode.
 
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)
 Sets the inv view proj.
 
void setRadius (float radius)
 Sets the radius.
 
void setBias (float bias)
 Sets the bias.
 
void setIntensity (float intensity)
 Sets the intensity.
 
void setPower (float power)
 Sets the power.
 
void setThickness (float thickness)
 Sets the thickness.
 
float getRadius () const
 Returns the radius.
 
float getBias () const
 Returns the bias.
 
float getIntensity () const
 Returns the intensity.
 
float getPower () const
 Returns the power.
 
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.
 
int getSampleCount () const
 Returns the sample count.
 
float getDownscale () const
 Returns the downscale.
 
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)
 Computes to.
 
void blur (Graphics *gfx, Texture *aoMap)
 Bilateral blur of an AO map (RGB=AO, A=depth).
 
void blurTo (Graphics *gfx, Texture *aoMap, Canvas *dest)
 Blur to.
 
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)
 Applies overlay to.
 
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)
 Applies from depth to.
 
void applyFromGBuffer (Graphics *gfx, Texture *hwDepth, Texture *worldNormal)
 Applies from g buffer.
 
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
 Returns the shader.
 
Shader * getSsaoShader () const
 Returns the ssao shader.
 
Shader * getHbaoShader () const
 Returns the hbao shader.
 
Shader * getGtaoShader () const
 Returns the gtao shader.
 
Shader * getBlurShader () const
 Returns the blur shader.
 
Shader * getOverlayShader () const
 Returns the overlay shader.
 
Shader * getFromDepthShader () const
 Returns the from depth shader.
 

详细描述

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 第 29 行定义.

构造及析构函数说明

◆ AmbientOcclusion() [1/2]

eve::graphics::AmbientOcclusion::AmbientOcclusion ( Graphics *  gfx)
explicit

Ambient occlusion.

在文件 AmbientOcclusion.cpp 第 160 行定义.

◆ ~AmbientOcclusion()

eve::graphics::AmbientOcclusion::~AmbientOcclusion ( )
default

Ambient occlusion.

◆ AmbientOcclusion() [2/2]

eve::graphics::AmbientOcclusion::AmbientOcclusion ( const AmbientOcclusion &  )
delete

成员函数说明

◆ applyFromDepth()

void eve::graphics::AmbientOcclusion::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.

在文件 AmbientOcclusion.cpp 第 430 行定义.

引用了 applyFromGBuffer().

被这些函数引用 applyFromDepthTo().

◆ applyFromDepthTo()

void eve::graphics::AmbientOcclusion::applyFromDepthTo ( Graphics *  gfx,
Texture *  linearDepth,
Canvas *  dest 
)

Applies from depth to.

在文件 AmbientOcclusion.cpp 第 452 行定义.

引用了 applyFromDepth(), eve::graphics::Graphics::getCanvas() , 以及 eve::graphics::Graphics::setCanvas().

◆ applyFromGBuffer()

◆ applyOverlay()

void eve::graphics::AmbientOcclusion::applyOverlay ( Graphics *  gfx,
Texture *  aoMap 
)

Darken the current target with AO: black + alpha=(1-ao)*intensity. Draw over an already-rendered scene (SrcAlpha blend).

在文件 AmbientOcclusion.cpp 第 410 行定义.

引用了 eve::graphics::Shader::hasUniform() , 以及 eve::graphics::Shader::sendFloat().

被这些函数引用 applyOverlayTo().

◆ applyOverlayTo()

void eve::graphics::AmbientOcclusion::applyOverlayTo ( Graphics *  gfx,
Texture *  aoMap,
Canvas *  dest 
)

◆ blur()

void eve::graphics::AmbientOcclusion::blur ( Graphics *  gfx,
Texture *  aoMap 
)

Bilateral blur of an AO map (RGB=AO, A=depth).

在文件 AmbientOcclusion.cpp 第 394 行定义.

引用了 eve::graphics::Texture::getHeight(), eve::graphics::Texture::getWidth() , 以及 eve::graphics::Shader::sendFloat().

被这些函数引用 blurTo().

◆ blurTo()

void eve::graphics::AmbientOcclusion::blurTo ( Graphics *  gfx,
Texture *  aoMap,
Canvas *  dest 
)

◆ compute()

void eve::graphics::AmbientOcclusion::compute ( Graphics *  gfx,
Texture *  linearDepth 
)

Compute AO into the currently bound canvas / screen. Output RGB = AO (1=open), A = depth01.

在文件 AmbientOcclusion.cpp 第 378 行定义.

引用了 eve::graphics::Texture::getHeight() , 以及 eve::graphics::Texture::getWidth().

◆ computeTo()

void eve::graphics::AmbientOcclusion::computeTo ( Graphics *  gfx,
Texture *  linearDepth,
Canvas *  dest 
)

◆ getBias()

float eve::graphics::AmbientOcclusion::getBias ( ) const

Returns the bias.

在文件 AmbientOcclusion.cpp 第 292 行定义.

◆ getBlurShader()

Shader * eve::graphics::AmbientOcclusion::getBlurShader ( ) const
inline

Returns the blur shader.

在文件 AmbientOcclusion.h 第 150 行定义.

◆ getDownscale()

float eve::graphics::AmbientOcclusion::getDownscale ( ) const
inline

Returns the downscale.

在文件 AmbientOcclusion.h 第 91 行定义.

◆ getFloat()

float eve::graphics::AmbientOcclusion::getFloat ( const std::string &  name) const

Returns the float.

在文件 AmbientOcclusion.cpp 第 313 行定义.

引用了 active, eve::graphics::Shader::getFromVar(), eve::graphics::Shader::hasUniform(), name , 以及 v.

被这些函数引用 getSampleCount().

◆ getFromDepthShader()

Shader * eve::graphics::AmbientOcclusion::getFromDepthShader ( ) const
inline

Returns the from depth shader.

在文件 AmbientOcclusion.h 第 154 行定义.

◆ getGtaoShader()

Shader * eve::graphics::AmbientOcclusion::getGtaoShader ( ) const
inline

Returns the gtao shader.

在文件 AmbientOcclusion.h 第 148 行定义.

◆ getHbaoShader()

Shader * eve::graphics::AmbientOcclusion::getHbaoShader ( ) const
inline

Returns the hbao shader.

在文件 AmbientOcclusion.h 第 146 行定义.

◆ getIntensity()

float eve::graphics::AmbientOcclusion::getIntensity ( ) const

Returns the intensity.

在文件 AmbientOcclusion.cpp 第 293 行定义.

◆ getMode()

std::string eve::graphics::AmbientOcclusion::getMode ( ) const
inline

Returns the mode.

在文件 AmbientOcclusion.h 第 47 行定义.

◆ getOverlayShader()

Shader * eve::graphics::AmbientOcclusion::getOverlayShader ( ) const
inline

Returns the overlay shader.

在文件 AmbientOcclusion.h 第 152 行定义.

◆ getPower()

float eve::graphics::AmbientOcclusion::getPower ( ) const

Returns the power.

在文件 AmbientOcclusion.cpp 第 294 行定义.

◆ getQuality()

std::string eve::graphics::AmbientOcclusion::getQuality ( ) const
inline

Returns the quality.

在文件 AmbientOcclusion.h 第 42 行定义.

◆ getRadius()

float eve::graphics::AmbientOcclusion::getRadius ( ) const

Returns the radius.

在文件 AmbientOcclusion.cpp 第 291 行定义.

◆ getSampleCount()

int eve::graphics::AmbientOcclusion::getSampleCount ( ) const

Returns the sample count.

Effective sample count (ssao) or dirCount*stepCount (hbao/gtao).

在文件 AmbientOcclusion.cpp 第 337 行定义.

引用了 getFloat() , 以及 steps.

◆ getShader()

Shader * eve::graphics::AmbientOcclusion::getShader ( ) const

Returns the shader.

在文件 AmbientOcclusion.cpp 第 178 行定义.

◆ getSsaoShader()

Shader * eve::graphics::AmbientOcclusion::getSsaoShader ( ) const
inline

Returns the ssao shader.

在文件 AmbientOcclusion.h 第 144 行定义.

◆ hasParam()

bool eve::graphics::AmbientOcclusion::hasParam ( const std::string &  name) const

True when param.

在文件 AmbientOcclusion.cpp 第 296 行定义.

引用了 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).

参数
depth01Float.

在文件 AmbientOcclusion.cpp 第 461 行定义.

引用了 b, d, height, eve::graphics::Graphics::newTexture(), width, x , 以及 y.

◆ operator=()

AmbientOcclusion & eve::graphics::AmbientOcclusion::operator= ( const AmbientOcclusion &  )
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 第 346 行定义.

◆ setBias()

void eve::graphics::AmbientOcclusion::setBias ( float  bias)

Sets the bias.

在文件 AmbientOcclusion.cpp 第 269 行定义.

引用了 bias , 以及 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 第 240 行定义.

引用了 fovRad, eve::graphics::perspectiveVulkanRH_ZO(), proj, eve::graphics::Shader::sendFloat(), setInvViewProj(), targetX , 以及 view.

◆ setFloat()

void eve::graphics::AmbientOcclusion::setFloat ( const std::string &  name,
float  value 
)

Sets the float.

在文件 AmbientOcclusion.cpp 第 304 行定义.

引用了 eve::graphics::Shader::hasUniform(), name, eve::graphics::Shader::sendFloat() , 以及 value.

被这些函数引用 setBias(), setIntensity(), setPower() , 以及 setRadius().

◆ setIntensity()

void eve::graphics::AmbientOcclusion::setIntensity ( float  intensity)

Sets the intensity.

在文件 AmbientOcclusion.cpp 第 274 行定义.

引用了 eve::graphics::Shader::sendFloat() , 以及 setFloat().

被这些函数引用 eve::graphics::RenderSystem3D::render().

◆ setInvViewProj()

void eve::graphics::AmbientOcclusion::setInvViewProj ( const glm::mat4 &  invViewProj)

Sets the inv view proj.

在文件 AmbientOcclusion.cpp 第 232 行定义.

引用了 invViewProj , 以及 eve::graphics::Shader::sendMatrix().

被这些函数引用 setCamera().

◆ setMode()

void eve::graphics::AmbientOcclusion::setMode ( const std::string &  mode)

"ssao" | "hbao" | "gtao".

在文件 AmbientOcclusion.cpp 第 222 行定义.

◆ setPower()

void eve::graphics::AmbientOcclusion::setPower ( float  power)

Sets the power.

在文件 AmbientOcclusion.cpp 第 280 行定义.

引用了 power , 以及 setFloat().

被这些函数引用 eve::graphics::RenderSystem3D::render().

◆ setQuality()

void eve::graphics::AmbientOcclusion::setQuality ( const std::string &  quality)

"low" | "medium" | "high" (unknown → medium).

在文件 AmbientOcclusion.cpp 第 217 行定义.

被这些函数引用 eve::graphics::RenderSystem3D::render().

◆ setRadius()

void eve::graphics::AmbientOcclusion::setRadius ( float  radius)

Sets the radius.

在文件 AmbientOcclusion.cpp 第 264 行定义.

引用了 radius , 以及 setFloat().

被这些函数引用 eve::graphics::RenderSystem3D::render().

◆ setThickness()

void eve::graphics::AmbientOcclusion::setThickness ( float  thickness)

Sets the thickness.

在文件 AmbientOcclusion.cpp 第 285 行定义.

引用了 eve::graphics::Shader::hasUniform(), eve::graphics::Shader::sendFloat() , 以及 thickness.


该类的文档由以下文件生成: