Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CShadowMapRP Class Reference

Shadow mapping pipeline for generating depth maps. More...

#include <RenderPipeline/CShadowMapRP.h>

Inheritance diagram for Skylicht::CShadowMapRP:
Skylicht::CBaseRP Skylicht::IEventProcessor Skylicht::IRenderPipeline Skylicht::CShadowBakeRP Skylicht::CPointLightShadowBakeRP Skylicht::CShadowMapBakeRP

Public Types

enum  EShadowMapType { CascadedShadow = 0 , ShadowMapping }
enum  ERenderShadowState { DirectionLight = 0 , PointLight , AreaLight }
Public Types inherited from Skylicht::IRenderPipeline
enum  ERenderPipelineType { Forwarder , Deferred , ShadowMap , Mix }

Public Member Functions

void release ()
void setShadowCascade (int numCascade, int shadowMapSize=2048, float farValue=300.0f)
void setNoShadowCascade (int shadowMapSize=2048, float farValue=50.0f)
void setShadowMapping (EShadowMapType type)
virtual void initRender (int w, int h)
virtual void resize (int w, int h)
virtual void render (ITexture *target, CCamera *camera, CEntityManager *entityManager, const core::recti &viewport, int cubeFaceId=-1, IRenderPipeline *lastRP=NULL)
virtual bool canRenderMaterial (CMaterial *m)
virtual bool canRenderShader (CShader *s)
virtual void drawMeshBuffer (CMesh *mesh, int bufferID, CEntityManager *entity, int entityID, bool skinnedMesh)
virtual void drawInstancingMeshBuffer (CMesh *mesh, int bufferID, CShader *instancingShader, CEntityManager *entityMgr, int entityID, bool skinnedMesh)
virtual bool OnProcessEvent (const SEvent &event)
virtual void updateShaderResource (CShader *shader, CEntityManager *entity, int entityID, video::SMaterial &irrMaterial)
virtual const core::aabbox3dfgetFrustumBox ()
ITexturegetDepthTexture ()
virtual float * getShadowDistance ()
virtual float * getShadowMatrices ()
ERenderShadowState getRenderShadowState ()
Public Member Functions inherited from Skylicht::CBaseRP
virtual void setCamera (CCamera *camera)
virtual void setNextPipeLine (IRenderPipeline *next)
virtual void onNext (ITexture *target, CCamera *camera, CEntityManager *entity, const core::recti &vp, int cubeFaceId)
virtual void updateTextureResource (CMesh *mesh, int bufferID, CEntityManager *entity, int entityID, bool skinnedMesh)
void beginRender2D (float w, float h)
void renderBufferToTarget (float sx, float sy, float sw, float sh, SMaterial &material, bool flipY=true, bool flipX=false)
void renderBufferToTarget (float dx, float dy, float dw, float dh, float sx, float sy, float sw, float sh, SMaterial &material, bool flipY=true, bool flipX=false)
void renderEnvironment (CCamera *camera, CEntityManager *entityMgr, const core::vector3df &position, ITexture *texture[], int *face, int numFace, bool allPipeline)
void renderCubeEnvironment (CCamera *camera, CEntityManager *entityMgr, const core::vector3df &position, ITexture *texture, int *face, int numFace, bool allPipeline)
void unbindRTT ()
Public Member Functions inherited from Skylicht::IRenderPipeline
virtual ERenderPipelineType getType ()
virtual void render (ITexture *target, CCamera *camera, CEntityManager *entity, const core::recti &viewport, int cubeFaceId=-1, IRenderPipeline *lastRP=NULL)=0
virtual void onNext (ITexture *target, CCamera *camera, CEntityManager *entity, const core::recti &viewport, int cubeFaceId)=0
Public Member Functions inherited from Skylicht::IEventProcessor
virtual bool OnProcessEvent (const SEvent &event)=0

Protected Member Functions

CCascadedShadowMapsgetCSM ()
Protected Member Functions inherited from Skylicht::CBaseRP
void disableTextureBilinear (SMaterial &m, int slot)
void enableTextureBilinear (SMaterial &m, int slot)
void setTarget (ITexture *target, int faceId)
void drawSceneToTexture (ITexture *target, CCamera *camera, CEntityManager *entityMgr, bool allPipeline)
void drawSceneToCubeTexture (ITexture *target, CCamera *camera, video::E_CUBEMAP_FACE faceID, CEntityManager *entityMgr, bool allPipeline)

Protected Attributes

EShadowMapType m_shadowMapType
ERenderShadowState m_renderShadowState
ITexturem_depthTexture
float m_shadowFar
int m_shadowMapSize
int m_numCascade
int m_screenWidth
int m_screenHeight
SMaterial m_writeDepthMaterial
core::vector3df m_lightDirection
CBoundShadowMapsm_lsm
CShadowMapsm_sm
CCascadedShadowMapsm_csm
int m_currentCSM
int m_texColorShader
int m_skinShader
int m_depthWriteShader
int m_depthWriteSkinMeshShader
int m_distanceWriteShader
int m_distanceWriteSkinMeshShader
int m_depthWriteSkinnedInstancing
bool m_saveDebug
bool m_saveDebugPL
Protected Attributes inherited from Skylicht::CBaseRP
IRenderPipeline * m_next
CMeshBuffer< video::S3DVertex2TCoords > * m_drawBuffer
IVertexBufferm_verticesImage
IIndexBufferm_indicesImage
float m_viewport2DW
float m_viewport2DH
SMaterial m_unbindMaterial
int m_textureColorShaderID
Protected Attributes inherited from Skylicht::IRenderPipeline
ERenderPipelineType m_type

Additional Inherited Members

Static Public Member Functions inherited from Skylicht::CBaseRP
static void saveFBOToFile (ITexture *texture, const char *output)
static void setBakeMode (bool b)
static void setBakeLightmapMode (bool b)
static void setBakeLightingMapBounce (u32 i)
static void setClearColor (const SColor &c)
static void setMaxLight (u32 maxLights)
Public Attributes inherited from Skylicht::IRenderPipeline
std::function< void(IRenderPipeline *)> OnFinish
Static Protected Attributes inherited from Skylicht::CBaseRP
static bool s_bakeMode
static bool s_bakeLMMode
static u32 s_bakeBounce
static u32 s_maxLight
static SColor s_clearColor

Detailed Description

Shadow mapping pipeline for generating depth maps.

Shadow mapping is a technique used to create shadows. It generates a depth map from the light's perspective. For directional light, Cascaded Shadow Mapping (CSM) is often used to maintain shadow quality over large areas.

  • With Cascaded, the shadow is drawn in a more complex way by rendering depth three times at different distances. However, the advantage is that the shadow is rendered more clearly.
  • And with NoCascaded, the shadow depth draw call is performed only once. It's faster in terms of performance, but the shadow's effective distance is limited

The Shadow RP will automatically replace the shader with one that writes depth.

However, in some cases, you can use a custom shader for writing depth. You can replace the writeDepth shader option for your material by adding the shadowDepth property to the Shader's .xml file.

<shaderConfig name="SkinToonVATInstancing2" baseShader="SOLID" shadowDepth="SDWSkinVATInstancing2">
See also
CDeferredRP, CForwardRP

Member Function Documentation

◆ canRenderMaterial()

virtual bool Skylicht::CShadowMapRP::canRenderMaterial ( CMaterial * m)
virtual

Reimplemented from Skylicht::CBaseRP.

◆ canRenderShader()

virtual bool Skylicht::CShadowMapRP::canRenderShader ( CShader * s)
virtual

Reimplemented from Skylicht::CBaseRP.

◆ drawInstancingMeshBuffer()

virtual void Skylicht::CShadowMapRP::drawInstancingMeshBuffer ( CMesh * mesh,
int bufferID,
CShader * instancingShader,
CEntityManager * entityMgr,
int entityID,
bool skinnedMesh )
virtual

Reimplemented from Skylicht::CBaseRP.

◆ drawMeshBuffer()

virtual void Skylicht::CShadowMapRP::drawMeshBuffer ( CMesh * mesh,
int bufferID,
CEntityManager * entity,
int entityID,
bool skinnedMesh )
virtual

Reimplemented from Skylicht::CBaseRP.

◆ initRender()

virtual void Skylicht::CShadowMapRP::initRender ( int w,
int h )
virtual

◆ render()

virtual void Skylicht::CShadowMapRP::render ( ITexture * target,
CCamera * camera,
CEntityManager * entityManager,
const core::recti & viewport,
int cubeFaceId = -1,
IRenderPipeline * lastRP = NULL )
virtual

Implements Skylicht::CBaseRP.

◆ resize()

virtual void Skylicht::CShadowMapRP::resize ( int w,
int h )
virtual

◆ updateShaderResource()

virtual void Skylicht::CShadowMapRP::updateShaderResource ( CShader * shader,
CEntityManager * entity,
int entityID,
video::SMaterial & irrMaterial )
virtual

Reimplemented from Skylicht::CBaseRP.


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