Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | List of all members
castor3d::shader::ReflectionModel Class Reference

#include <GlslReflection.hpp>

Public Member Functions

C3D_API ReflectionModel (sdw::ShaderWriter &writer, Utils &utils, uint32_t &envMapBinding, uint32_t envMapSet, bool hasIblSupport, bool hasEnvMap=true)
 
C3D_API sdw::RetVec3 computeIncident (sdw::Vec3 const &wsPosition, sdw::Vec3 const &wsCamera) const
 
C3D_API DerivVec3 computeIncident (DerivVec3 const &wsPosition, sdw::Vec3 const &wsCamera) const
 
C3D_API void computeCombined (BlendComponents &components, LightSurface const &lightSurface, sdw::Vec3 const &position, BackgroundModel &background, sdw::CombinedImage2DRgba32 const &mippedScene, CameraData const &camera, sdw::Vec2 const &sceneUv, sdw::UInt const &envMapIndex, sdw::UInt const &hasReflection, sdw::UInt const &hasRefraction, sdw::Float const &refractionRatio, sdw::Vec3 &reflectedDiffuse, sdw::Vec3 &reflectedSpecular, sdw::Vec3 &refracted, sdw::Vec3 &coatReflected, sdw::Vec3 &sheenReflected, DebugOutputCategory &debugOutput)
 
C3D_API void computeCombined (BlendComponents &components, sdw::Vec3 const &wsNormal, sdw::Vec3 const &difF, sdw::Vec3 const &spcF, sdw::Vec3 const &V, sdw::Float const &NdotV, sdw::Vec3 const &position, BackgroundModel &background, sdw::CombinedImage2DRgba32 const &mippedScene, CameraData const &camera, sdw::Vec2 const &sceneUv, sdw::UInt const &envMapIndex, sdw::UInt const &hasReflection, sdw::UInt const &hasRefraction, sdw::Float const &refractionRatio, sdw::Vec3 &reflectedDiffuse, sdw::Vec3 &reflectedSpecular, sdw::Vec3 &refracted, sdw::Vec3 &coatReflected, sdw::Vec3 &sheenReflected, DebugOutputCategory &debugOutput)
 
C3D_API void computeCombined (BlendComponents &components, LightSurface const &lightSurface, BackgroundModel &background, sdw::UInt const &envMapIndex, sdw::UInt const &hasReflection, sdw::UInt const &hasRefraction, sdw::Float const &refractionRatio, sdw::Vec3 &reflectedDiffuse, sdw::Vec3 &reflectedSpecular, sdw::Vec3 &refracted, sdw::Vec3 &coatReflected, sdw::Vec3 &sheenReflected, DebugOutputCategory &debugOutput)
 
C3D_API void computeCombined (BlendComponents &pcomponents, sdw::Vec3 const &wsNormal, sdw::Vec3 const &difF, sdw::Vec3 const &spcF, sdw::Vec3 const &V, sdw::Float const &NdotV, BackgroundModel &background, sdw::UInt const &envMapIndex, sdw::UInt const &hasReflection, sdw::UInt const &hasRefraction, sdw::Float const &refractionRatio, sdw::Vec3 &reflectedDiffuse, sdw::Vec3 &reflectedSpecular, sdw::Vec3 &refracted, sdw::Vec3 &coatReflected, sdw::Vec3 &sheenReflected, DebugOutputCategory &debugOutput)
 
C3D_API void computeReflections (BlendComponents &components, LightSurface const &lightSurface, BackgroundModel &background, sdw::UInt envMapIndex, sdw::UInt const &reflection, sdw::Vec3 &reflectedDiffuse, sdw::Vec3 &reflectedSpecular, DebugOutputCategory &debugOutput)
 
C3D_API void computeReflections (BlendComponents &components, sdw::Vec3 const &wsNormal, sdw::Vec3 const &difF, sdw::Vec3 const &spcF, sdw::Vec3 const &V, sdw::Float const &NdotV, BackgroundModel &background, sdw::UInt envMapIndex, sdw::UInt const &reflection, sdw::Vec3 &reflectedDiffuse, sdw::Vec3 &reflectedSpecular, DebugOutputCategory &debugOutput)
 
C3D_API sdw::Vec3 computeRefractions (BlendComponents &components, LightSurface const &lightSurface, BackgroundModel &background, sdw::UInt envMapIndex, sdw::UInt const &refraction, sdw::Float const &refractionRatio, DebugOutputCategory &debugOutput)
 
C3D_API sdw::Vec3 computeRefractions (BlendComponents &components, sdw::Vec3 const &wsNormal, sdw::Vec3 const &V, BackgroundModel &background, sdw::UInt envMapIndex, sdw::Float const &refractionRatio, DebugOutputCategory &debugOutput)
 
C3D_API sdw::Vec4 computeScreenSpace (CameraData const &cameraData, sdw::Vec3 const &viewPosition, sdw::Vec3 const &worldNormal, sdw::Vec2 const &texcoord, sdw::Vec4 const &ssrSettings, sdw::CombinedImage2DR32 const &depthMap, sdw::CombinedImage2DRgba32 const &normalMap, sdw::CombinedImage2DRgba32 const &colourMap, DebugOutputCategory &debugOutput)
 
C3D_API sdw::RetVec4 computeScreenSpace (CameraData const &cameraData, sdw::Vec3 const &viewPosition, sdw::Vec3 const &worldNormal, sdw::Vec2 const &texcoord, sdw::Vec4 const &ssrSettings, sdw::CombinedImage2DRgba32 const &depthObjMap, sdw::CombinedImage2DRgba32 const &normalMap, sdw::CombinedImage2DRgba32 const &colourMap, DebugOutputCategory &debugOutput)
 
C3D_API sdw::RetBoolean traceScreenSpace (sdw::Vec3 csOrigin, sdw::Vec3 csDirection, sdw::Mat4 projectToPixelMatrix, sdw::CombinedImage2DR32 csZBuffer, sdw::Vec2 csZBufferSize, sdw::Float csZThickness, sdw::Boolean csZBufferIsHyperbolic, sdw::Vec3 clipInfo, sdw::Float nearPlaneZ, sdw::Float stride, sdw::Float jitterFraction, sdw::Float maxSteps, sdw::Float maxRayTraceDistance, sdw::Vec2 &hitPixel, sdw::Vec3 &csHitPoint)
 
UtilsgetUtils () const
 

Constructor & Destructor Documentation

◆ ReflectionModel()

C3D_API castor3d::shader::ReflectionModel::ReflectionModel ( sdw::ShaderWriter & writer,
Utils & utils,
uint32_t & envMapBinding,
uint32_t envMapSet,
bool hasIblSupport,
bool hasEnvMap = true )

Member Function Documentation

◆ computeCombined() [1/4]

C3D_API void castor3d::shader::ReflectionModel::computeCombined ( BlendComponents & components,
LightSurface const & lightSurface,
BackgroundModel & background,
sdw::UInt const & envMapIndex,
sdw::UInt const & hasReflection,
sdw::UInt const & hasRefraction,
sdw::Float const & refractionRatio,
sdw::Vec3 & reflectedDiffuse,
sdw::Vec3 & reflectedSpecular,
sdw::Vec3 & refracted,
sdw::Vec3 & coatReflected,
sdw::Vec3 & sheenReflected,
DebugOutputCategory & debugOutput )

◆ computeCombined() [2/4]

C3D_API void castor3d::shader::ReflectionModel::computeCombined ( BlendComponents & components,
LightSurface const & lightSurface,
sdw::Vec3 const & position,
BackgroundModel & background,
sdw::CombinedImage2DRgba32 const & mippedScene,
CameraData const & camera,
sdw::Vec2 const & sceneUv,
sdw::UInt const & envMapIndex,
sdw::UInt const & hasReflection,
sdw::UInt const & hasRefraction,
sdw::Float const & refractionRatio,
sdw::Vec3 & reflectedDiffuse,
sdw::Vec3 & reflectedSpecular,
sdw::Vec3 & refracted,
sdw::Vec3 & coatReflected,
sdw::Vec3 & sheenReflected,
DebugOutputCategory & debugOutput )

◆ computeCombined() [3/4]

C3D_API void castor3d::shader::ReflectionModel::computeCombined ( BlendComponents & components,
sdw::Vec3 const & wsNormal,
sdw::Vec3 const & difF,
sdw::Vec3 const & spcF,
sdw::Vec3 const & V,
sdw::Float const & NdotV,
sdw::Vec3 const & position,
BackgroundModel & background,
sdw::CombinedImage2DRgba32 const & mippedScene,
CameraData const & camera,
sdw::Vec2 const & sceneUv,
sdw::UInt const & envMapIndex,
sdw::UInt const & hasReflection,
sdw::UInt const & hasRefraction,
sdw::Float const & refractionRatio,
sdw::Vec3 & reflectedDiffuse,
sdw::Vec3 & reflectedSpecular,
sdw::Vec3 & refracted,
sdw::Vec3 & coatReflected,
sdw::Vec3 & sheenReflected,
DebugOutputCategory & debugOutput )

◆ computeCombined() [4/4]

C3D_API void castor3d::shader::ReflectionModel::computeCombined ( BlendComponents & pcomponents,
sdw::Vec3 const & wsNormal,
sdw::Vec3 const & difF,
sdw::Vec3 const & spcF,
sdw::Vec3 const & V,
sdw::Float const & NdotV,
BackgroundModel & background,
sdw::UInt const & envMapIndex,
sdw::UInt const & hasReflection,
sdw::UInt const & hasRefraction,
sdw::Float const & refractionRatio,
sdw::Vec3 & reflectedDiffuse,
sdw::Vec3 & reflectedSpecular,
sdw::Vec3 & refracted,
sdw::Vec3 & coatReflected,
sdw::Vec3 & sheenReflected,
DebugOutputCategory & debugOutput )

◆ computeIncident() [1/2]

C3D_API DerivVec3 castor3d::shader::ReflectionModel::computeIncident ( DerivVec3 const & wsPosition,
sdw::Vec3 const & wsCamera ) const

◆ computeIncident() [2/2]

C3D_API sdw::RetVec3 castor3d::shader::ReflectionModel::computeIncident ( sdw::Vec3 const & wsPosition,
sdw::Vec3 const & wsCamera ) const

◆ computeReflections() [1/2]

C3D_API void castor3d::shader::ReflectionModel::computeReflections ( BlendComponents & components,
LightSurface const & lightSurface,
BackgroundModel & background,
sdw::UInt envMapIndex,
sdw::UInt const & reflection,
sdw::Vec3 & reflectedDiffuse,
sdw::Vec3 & reflectedSpecular,
DebugOutputCategory & debugOutput )

◆ computeReflections() [2/2]

C3D_API void castor3d::shader::ReflectionModel::computeReflections ( BlendComponents & components,
sdw::Vec3 const & wsNormal,
sdw::Vec3 const & difF,
sdw::Vec3 const & spcF,
sdw::Vec3 const & V,
sdw::Float const & NdotV,
BackgroundModel & background,
sdw::UInt envMapIndex,
sdw::UInt const & reflection,
sdw::Vec3 & reflectedDiffuse,
sdw::Vec3 & reflectedSpecular,
DebugOutputCategory & debugOutput )

◆ computeRefractions() [1/2]

C3D_API sdw::Vec3 castor3d::shader::ReflectionModel::computeRefractions ( BlendComponents & components,
LightSurface const & lightSurface,
BackgroundModel & background,
sdw::UInt envMapIndex,
sdw::UInt const & refraction,
sdw::Float const & refractionRatio,
DebugOutputCategory & debugOutput )

◆ computeRefractions() [2/2]

C3D_API sdw::Vec3 castor3d::shader::ReflectionModel::computeRefractions ( BlendComponents & components,
sdw::Vec3 const & wsNormal,
sdw::Vec3 const & V,
BackgroundModel & background,
sdw::UInt envMapIndex,
sdw::Float const & refractionRatio,
DebugOutputCategory & debugOutput )

◆ computeScreenSpace() [1/2]

C3D_API sdw::Vec4 castor3d::shader::ReflectionModel::computeScreenSpace ( CameraData const & cameraData,
sdw::Vec3 const & viewPosition,
sdw::Vec3 const & worldNormal,
sdw::Vec2 const & texcoord,
sdw::Vec4 const & ssrSettings,
sdw::CombinedImage2DR32 const & depthMap,
sdw::CombinedImage2DRgba32 const & normalMap,
sdw::CombinedImage2DRgba32 const & colourMap,
DebugOutputCategory & debugOutput )

◆ computeScreenSpace() [2/2]

C3D_API sdw::RetVec4 castor3d::shader::ReflectionModel::computeScreenSpace ( CameraData const & cameraData,
sdw::Vec3 const & viewPosition,
sdw::Vec3 const & worldNormal,
sdw::Vec2 const & texcoord,
sdw::Vec4 const & ssrSettings,
sdw::CombinedImage2DRgba32 const & depthObjMap,
sdw::CombinedImage2DRgba32 const & normalMap,
sdw::CombinedImage2DRgba32 const & colourMap,
DebugOutputCategory & debugOutput )

◆ getUtils()

Utils & castor3d::shader::ReflectionModel::getUtils ( ) const
inline

◆ traceScreenSpace()

C3D_API sdw::RetBoolean castor3d::shader::ReflectionModel::traceScreenSpace ( sdw::Vec3 csOrigin,
sdw::Vec3 csDirection,
sdw::Mat4 projectToPixelMatrix,
sdw::CombinedImage2DR32 csZBuffer,
sdw::Vec2 csZBufferSize,
sdw::Float csZThickness,
sdw::Boolean csZBufferIsHyperbolic,
sdw::Vec3 clipInfo,
sdw::Float nearPlaneZ,
sdw::Float stride,
sdw::Float jitterFraction,
sdw::Float maxSteps,
sdw::Float maxRayTraceDistance,
sdw::Vec2 & hitPixel,
sdw::Vec3 & csHitPoint )
Parameters
csOriginCamera-space ray origin, which must be within the view volume and must have z < -0.01 and project within the valid screen rectangle.
csDirectionUnit length camera-space ray direction.
projectToPixelMatrixA projection matrix that maps to pixel coordinates (not [-1, +1] normalized device coordinates).
csZBufferThe depth or camera-space Z buffer, depending on the value of csZBufferIsHyperbolic.
csZBufferSizeDimensions of csZBuffer.
csZThicknessCamera space thickness to ascribe to each pixel in the depth buffer.
csZBufferIsHyperbolicTrue if csZBuffer is an OpenGL depth buffer, false (faster) if csZBuffer contains (negative) "linear" camera space z values. Const so that the compiler can evaluate the branch based on it at compile time.
clipInfoSee G3D::Camera documentation.
nearPlaneZNegative number.
strideStep in horizontal or vertical pixels between samples. This is a float because integer math is slow on GPUs, but should be set to an integer >= 1.
jitterFractionNumber between 0 and 1 for how far to bump the ray in stride units to conceal banding artifacts.
maxStepsMaximum number of iterations. Higher gives better images but may be slow.
maxRayTraceDistanceMaximum camera-space distance to trace before returning a miss.
hitPixelPixel coordinates of the first intersection with the scene.
csHitPointCamera space location of the ray hit.

The documentation for this class was generated from the following file: