Screen-space reflections (SSR) as a fullscreen post pass. @lifetime All Graphics and texture arguments are borrowed by this effect. 更多...
#include <ScreenSpaceReflection.h>
Public 成员函数 | |
| ScreenSpaceReflection (Graphics *gfx) | |
| Screen space reflection. | |
| ~ScreenSpaceReflection () | |
| Screen space reflection. | |
| ScreenSpaceReflection (const ScreenSpaceReflection &)=delete | |
| ScreenSpaceReflection & | operator= (const ScreenSpaceReflection &)=delete |
| 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) + near/far. | |
| void | setInvViewProj (const glm::mat4 &invViewProj) |
| Sets the inv view proj. | |
| void | setTemporalMotionTexture (Texture *motionDepth) |
| Set packed linear-depth and motion texture used by temporal SSR resolve. | |
| void | setDepthPyramid (Texture *atlas, int levels) |
| Set the shared horizontally packed RG min/max depth hierarchy. | |
| void | invalidateHistory () |
| Discard temporal reflection history after a render-chain discontinuity. | |
| void | setEnabled (bool enabled) |
| Enable/disable the pass. When disabled it emits transparent (0 hit). | |
| bool | getEnabled () const |
| Returns the enabled. | |
| void | setQuality (const std::string &quality) |
| Set "low", "medium", "high" or "ultra" SSR quality preset. | |
| std::string | getQuality () const |
| Return the active SSR quality preset. | |
| void | setMaxDistance (float meters) |
| Sets the max distance. | |
| void | setStepLength (float meters) |
| Sets the step length. | |
| void | setMaxSteps (int steps) |
| Sets the max steps. | |
| void | setThickness (float meters) |
| Sets the thickness. | |
| void | setStrength (float strength) |
| Sets the strength. | |
| void | setMaxRoughness (float roughness) |
| Skip SSR above this material roughness and rely on reflection backup. | |
| void | setResolutionScale (float scale) |
| Set internal SSR resolution scale in the range 0.25 to 1.0. | |
| float | getStrength () const |
| Returns the strength. | |
| float | getMaxRoughness () const |
| Returns the max roughness. | |
| float | getResolutionScale () const |
| Returns the resolution scale. | |
| 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. | |
| void | applyFromSceneTo (Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal, Canvas *dest) |
| Write the SSR result into the currently bound canvas / dest. | |
| void | applyFromSceneTo (Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal, Texture *albedo, Canvas *dest) |
| Write SSR using albedo to preserve diffuse energy during reflection replacement. | |
| void | applyFromScene (Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal, Texture *albedo=nullptr) |
| Write SSR into the currently bound canvas / screen. | |
| Canvas * | getReflectionCanvas () |
| Owned reflection canvas (created on first use at the current target size). | |
| Texture * | getReflectionTexture () |
| The reflection texture from the owned canvas, or nullptr before first apply. | |
| bool | hasValidHistory () const |
| True once a temporally resolved reflection frame is safe to sample. | |
| int | getSpatialPassCount () const |
| Number of explicit A-trous prefilter passes for the active quality. | |
| Shader * | getShader () const |
| Returns the shader. | |
详细描述
Screen-space reflections (SSR) as a fullscreen post pass. @lifetime All Graphics and texture arguments are borrowed by this effect.
Reads the lit scene color, hardware depth (D32) and world normal, and for each pixel ray-marches the reflected ray in screen space. Where the ray hits geometry it emits the reflected scene color with A = hit validity, so a surface (e.g. Water) can blend it over an env-cubemap backup.
Mirrors GlobalIllumination and can be invoked manually with applyFromSceneTo. RenderSystem3D also runs it automatically when ssr or reflectionChain is enabled in RenderControl.
在文件 ScreenSpaceReflection.h 第 30 行定义.
构造及析构函数说明
◆ ScreenSpaceReflection() [1/2]
|
explicit |
Screen space reflection.
在文件 ScreenSpaceReflection.cpp 第 64 行定义.
◆ ~ScreenSpaceReflection()
| eve::graphics::ScreenSpaceReflection::~ScreenSpaceReflection | ( | ) |
Screen space reflection.
在文件 ScreenSpaceReflection.cpp 第 69 行定义.
◆ ScreenSpaceReflection() [2/2]
|
delete |
成员函数说明
◆ applyFromScene()
| void eve::graphics::ScreenSpaceReflection::applyFromScene | ( | Graphics * | gfx, |
| Texture * | sceneColor, | ||
| Texture * | hwDepth, | ||
| Texture * | worldNormal, | ||
| Texture * | albedo = nullptr |
||
| ) |
Write SSR into the currently bound canvas / screen.
在文件 ScreenSpaceReflection.cpp 第 327 行定义.
引用了 albedo, eve::graphics::Graphics::drawTexturedRectShader4(), 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().
被这些函数引用 applyFromSceneTo().
◆ applyFromSceneTo() [1/2]
|
inline |
Write the SSR result into the currently bound canvas / dest.
Applies from scene to.
在文件 ScreenSpaceReflection.h 第 95 行定义.
◆ applyFromSceneTo() [2/2]
| void eve::graphics::ScreenSpaceReflection::applyFromSceneTo | ( | Graphics * | gfx, |
| Texture * | sceneColor, | ||
| Texture * | hwDepth, | ||
| Texture * | worldNormal, | ||
| Texture * | albedo, | ||
| Canvas * | dest | ||
| ) |
Write SSR using albedo to preserve diffuse energy during reflection replacement.
在文件 ScreenSpaceReflection.cpp 第 292 行定义.
引用了 albedo, applyFromScene(), eve::graphics::Graphics::getCanvas(), eve::graphics::Canvas::getTexture() , 以及 eve::graphics::Graphics::setCanvas().
◆ getEnabled()
|
inline |
Returns the enabled.
在文件 ScreenSpaceReflection.h 第 59 行定义.
◆ getFloat()
| float eve::graphics::ScreenSpaceReflection::getFloat | ( | const std::string & | name | ) | const |
Returns the float.
在文件 ScreenSpaceReflection.cpp 第 265 行定义.
引用了 eve::graphics::Shader::getFromVar(), eve::graphics::Shader::hasUniform(), name , 以及 v.
◆ getMaxRoughness()
|
inline |
Returns the max roughness.
在文件 ScreenSpaceReflection.h 第 83 行定义.
◆ getQuality()
|
inline |
Return the active SSR quality preset.
在文件 ScreenSpaceReflection.h 第 64 行定义.
◆ getReflectionCanvas()
| Canvas * eve::graphics::ScreenSpaceReflection::getReflectionCanvas | ( | ) |
Owned reflection canvas (created on first use at the current target size).
在文件 ScreenSpaceReflection.cpp 第 306 行定义.
引用了 eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getPixelHeight(), eve::graphics::Graphics::getPixelWidth(), eve::graphics::Graphics::getWidth(), eve::graphics::Canvas::getWidth() , 以及 eve::graphics::Graphics::newHDRCanvas().
被这些函数引用 getReflectionTexture() , 以及 eve::graphics::RenderSystem3D::render().
◆ getReflectionTexture()
| Texture * eve::graphics::ScreenSpaceReflection::getReflectionTexture | ( | ) |
The reflection texture from the owned canvas, or nullptr before first apply.
在文件 ScreenSpaceReflection.cpp 第 321 行定义.
引用了 getReflectionCanvas() , 以及 eve::graphics::Canvas::getTexture().
◆ getResolutionScale()
|
inline |
Returns the resolution scale.
在文件 ScreenSpaceReflection.h 第 85 行定义.
◆ getShader()
|
inline |
Returns the shader.
在文件 ScreenSpaceReflection.h 第 119 行定义.
◆ getSpatialPassCount()
|
inline |
Number of explicit A-trous prefilter passes for the active quality.
在文件 ScreenSpaceReflection.h 第 114 行定义.
◆ getStrength()
|
inline |
Returns the strength.
在文件 ScreenSpaceReflection.h 第 81 行定义.
◆ hasParam()
| bool eve::graphics::ScreenSpaceReflection::hasParam | ( | const std::string & | name | ) | const |
True when param.
在文件 ScreenSpaceReflection.cpp 第 245 行定义.
引用了 eve::graphics::Shader::hasUniform() , 以及 name.
◆ hasValidHistory()
|
inline |
True once a temporally resolved reflection frame is safe to sample.
在文件 ScreenSpaceReflection.h 第 112 行定义.
◆ invalidateHistory()
|
inline |
Discard temporal reflection history after a render-chain discontinuity.
在文件 ScreenSpaceReflection.h 第 54 行定义.
◆ operator=()
|
delete |
◆ setCamera()
| void eve::graphics::ScreenSpaceReflection::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) + near/far.
在文件 ScreenSpaceReflection.cpp 第 150 行定义.
引用了 eye, fovRad, eve::graphics::perspectiveVulkanRH_ZO(), proj, eve::graphics::Shader::sendFloat(), setInvViewProj(), targetX , 以及 view.
◆ setDepthPyramid()
|
inline |
Set the shared horizontally packed RG min/max depth hierarchy.
在文件 ScreenSpaceReflection.h 第 49 行定义.
◆ setEnabled()
| void eve::graphics::ScreenSpaceReflection::setEnabled | ( | bool | enabled | ) |
Enable/disable the pass. When disabled it emits transparent (0 hit).
在文件 ScreenSpaceReflection.cpp 第 182 行定义.
引用了 enabled , 以及 eve::graphics::Shader::sendFloat().
◆ setFloat()
| void eve::graphics::ScreenSpaceReflection::setFloat | ( | const std::string & | name, |
| float | value | ||
| ) |
Sets the float.
在文件 ScreenSpaceReflection.cpp 第 249 行定义.
引用了 eve::graphics::Shader::hasUniform(), name, eve::graphics::Shader::sendFloat() , 以及 value.
被这些函数引用 setMaxDistance(), setMaxRoughness(), setMaxSteps(), setStepLength(), setStrength() , 以及 setThickness().
◆ setInvViewProj()
| void eve::graphics::ScreenSpaceReflection::setInvViewProj | ( | const glm::mat4 & | invViewProj | ) |
Sets the inv view proj.
在文件 ScreenSpaceReflection.cpp 第 76 行定义.
引用了 c, invViewProj, r , 以及 eve::graphics::Shader::sendMatrix().
被这些函数引用 setCamera().
◆ setMaxDistance()
| void eve::graphics::ScreenSpaceReflection::setMaxDistance | ( | float | meters | ) |
◆ setMaxRoughness()
| void eve::graphics::ScreenSpaceReflection::setMaxRoughness | ( | float | roughness | ) |
Skip SSR above this material roughness and rely on reflection backup.
在文件 ScreenSpaceReflection.cpp 第 234 行定义.
引用了 setFloat() , 以及 v.
被这些函数引用 setQuality().
◆ setMaxSteps()
| void eve::graphics::ScreenSpaceReflection::setMaxSteps | ( | int | steps | ) |
Sets the max steps.
在文件 ScreenSpaceReflection.cpp 第 231 行定义.
引用了 setFloat() , 以及 v.
被这些函数引用 setQuality().
◆ setQuality()
| void eve::graphics::ScreenSpaceReflection::setQuality | ( | const std::string & | quality | ) |
Set "low", "medium", "high" or "ultra" SSR quality preset.
在文件 ScreenSpaceReflection.cpp 第 188 行定义.
引用了 setMaxRoughness(), setMaxSteps(), setResolutionScale(), setStepLength() , 以及 setThickness().
◆ setResolutionScale()
| void eve::graphics::ScreenSpaceReflection::setResolutionScale | ( | float | scale | ) |
Set internal SSR resolution scale in the range 0.25 to 1.0.
在文件 ScreenSpaceReflection.cpp 第 237 行定义.
引用了 scale.
被这些函数引用 setQuality().
◆ setStepLength()
| void eve::graphics::ScreenSpaceReflection::setStepLength | ( | float | meters | ) |
Sets the step length.
在文件 ScreenSpaceReflection.cpp 第 230 行定义.
引用了 setFloat() , 以及 v.
被这些函数引用 setQuality().
◆ setStrength()
| void eve::graphics::ScreenSpaceReflection::setStrength | ( | float | strength | ) |
◆ setTemporalMotionTexture()
|
inline |
Set packed linear-depth and motion texture used by temporal SSR resolve.
在文件 ScreenSpaceReflection.h 第 47 行定义.
◆ setThickness()
| void eve::graphics::ScreenSpaceReflection::setThickness | ( | float | meters | ) |
Sets the thickness.
在文件 ScreenSpaceReflection.cpp 第 232 行定义.
引用了 setFloat() , 以及 v.
被这些函数引用 setQuality().
该类的文档由以下文件生成:
- src/modules/graphics/ScreenSpaceReflection.h
- src/modules/graphics/ScreenSpaceReflection.cpp