IVSmoke 1.0
Loading...
Searching...
No Matches
IVSmokeVSMProcessor.h
1// Copyright (c) 2026, Team SDB. All rights reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "RenderGraphBuilder.h"
7#include "RenderGraphResources.h"
8
9class FRDGBuilder;
11
12/**
13 * Variance Shadow Map processor.
14 * Converts depth maps to variance shadow maps and applies blur.
15 *
16 * VSM stores (depth, depth²) which enables soft shadow filtering
17 * without the shadow acne artifacts of PCF.
18 */
19class IVSMOKE_API FIVSmokeVSMProcessor
20{
21public:
24
25 /**
26 * Process a depth texture into a VSM texture.
27 * Performs depth → variance conversion and separable Gaussian blur.
28 *
29 * @param GraphBuilder RDG builder.
30 * @param DepthTexture Input depth texture (R32F).
31 * @param VSMTexture Output VSM texture (RG32F).
32 * @param BlurRadius Blur kernel radius (0 = no blur).
33 */
34 void Process(
35 FRDGBuilder& GraphBuilder,
36 FRDGTextureRef DepthTexture,
37 FRDGTextureRef VSMTexture,
38 int32 BlurRadius
39 );
40
41 /**
42 * Process all cascades' depth textures into VSM textures.
43 *
44 * @param GraphBuilder RDG builder.
45 * @param Cascades Array of cascade data.
46 * @param BlurRadius Blur kernel radius.
47 */
48 void ProcessCascades(
49 FRDGBuilder& GraphBuilder,
50 TArray<FIVSmokeCascadeData>& Cascades,
51 int32 BlurRadius
52 );
53
54private:
55 /**
56 * Convert depth to variance (depth, depth²).
57 *
58 * @param GraphBuilder RDG builder.
59 * @param DepthTexture Input depth texture.
60 * @param VSMTexture Output VSM texture.
61 */
62 void AddDepthToVariancePass(
63 FRDGBuilder& GraphBuilder,
64 FRDGTextureRef DepthTexture,
65 FRDGTextureRef VSMTexture
66 );
67
68 /**
69 * Apply separable Gaussian blur (horizontal pass).
70 *
71 * @param GraphBuilder RDG builder.
72 * @param SourceTexture Input texture.
73 * @param DestTexture Output texture.
74 * @param BlurRadius Blur kernel radius.
75 */
76 void AddHorizontalBlurPass(
77 FRDGBuilder& GraphBuilder,
78 FRDGTextureRef SourceTexture,
79 FRDGTextureRef DestTexture,
80 int32 BlurRadius
81 );
82
83 /**
84 * Apply separable Gaussian blur (vertical pass).
85 *
86 * @param GraphBuilder RDG builder.
87 * @param SourceTexture Input texture.
88 * @param DestTexture Output texture.
89 * @param BlurRadius Blur kernel radius.
90 */
91 void AddVerticalBlurPass(
92 FRDGBuilder& GraphBuilder,
93 FRDGTextureRef SourceTexture,
94 FRDGTextureRef DestTexture,
95 int32 BlurRadius
96 );
97};