vault backup: 2024-03-07 16:58:42
This commit is contained in:
parent
410c9ab8e8
commit
4f3c7f05de
56
.obsidian/plugins/various-complements/data.json
vendored
56
.obsidian/plugins/various-complements/data.json
vendored
@ -47,54 +47,6 @@
|
|||||||
},
|
},
|
||||||
"showLogAboutPerformanceInConsole": false,
|
"showLogAboutPerformanceInConsole": false,
|
||||||
"selectionHistoryTree": {
|
"selectionHistoryTree": {
|
||||||
"FRDGViewableResource、FRDGTexture、FRDGTextureSRV、FRDGTextureUAV": {
|
|
||||||
"FRDGViewableResource、FRDGTexture、FRDGTextureSRV、FRDGTextureUAV": {
|
|
||||||
"currentFile": {
|
|
||||||
"count": 1,
|
|
||||||
"lastUpdated": 1707118005164
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"FRDGViewableResource、FRDGTexture、FRDGTextureSRV、": {
|
|
||||||
"FRDGViewableResource、FRDGTexture、FRDGTextureSRV、": {
|
|
||||||
"currentFile": {
|
|
||||||
"count": 1,
|
|
||||||
"lastUpdated": 1707118021634
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"FRDGView": {
|
|
||||||
"FRDGView": {
|
|
||||||
"currentFile": {
|
|
||||||
"count": 1,
|
|
||||||
"lastUpdated": 1707118039401
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"FRDGViewableResource、FRDGTexture": {
|
|
||||||
"FRDGViewableResource、FRDGTexture": {
|
|
||||||
"currentFile": {
|
|
||||||
"count": 1,
|
|
||||||
"lastUpdated": 1707118633071
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"RDG对象注册表": {
|
|
||||||
"RDG对象注册表": {
|
|
||||||
"currentFile": {
|
|
||||||
"count": 1,
|
|
||||||
"lastUpdated": 1707121888833
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"FRDGResource": {
|
|
||||||
"FRDGResource": {
|
|
||||||
"currentFile": {
|
|
||||||
"count": 1,
|
|
||||||
"lastUpdated": 1707140527615
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"VertexBufferSRV": {
|
"VertexBufferSRV": {
|
||||||
"VertexBufferSRV": {
|
"VertexBufferSRV": {
|
||||||
"currentFile": {
|
"currentFile": {
|
||||||
@ -174,6 +126,14 @@
|
|||||||
"lastUpdated": 1709717543852
|
"lastUpdated": 1709717543852
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"GBUFFER_HAS_VELOCITY": {
|
||||||
|
"GBUFFER_HAS_VELOCITY": {
|
||||||
|
"currentFile": {
|
||||||
|
"count": 1,
|
||||||
|
"lastUpdated": 1709798435896
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -40,40 +40,30 @@ GBuffer相关信息(精度、顺序)可以参考FetchLegacyGBufferInfo()。
|
|||||||
- 不存在Velocity与Tangent:
|
- 不存在Velocity与Tangent:
|
||||||
- OutGBufferD(MRT4)
|
- OutGBufferD(MRT4)
|
||||||
- OutGBufferD(MRT5)
|
- OutGBufferD(MRT5)
|
||||||
- ~~TargetSeparatedMainDirLight(MRT6)~~
|
- TargetSeparatedMainDirLight(MRT6)
|
||||||
- 存在Velocity:
|
- 存在Velocity:
|
||||||
- TargetVelocity(MRT4)
|
- TargetVelocity(MRT4)
|
||||||
- OutGBufferD(MRT5)
|
- OutGBufferD(MRT5)
|
||||||
- OutGBufferE(MRT6)
|
- OutGBufferE(MRT6)
|
||||||
- ~~TargetSeparatedMainDirLight(MRT7)~~
|
- TargetSeparatedMainDirLight(MRT7)
|
||||||
- 存在Tangent:
|
- 存在Tangent:
|
||||||
- OutGBufferF(MRT4)
|
- OutGBufferF(MRT4)
|
||||||
- OutGBufferD(MRT5)
|
- OutGBufferD(MRT5)
|
||||||
- OutGBufferE(MRT6)
|
- OutGBufferE(MRT6)
|
||||||
- ~~TargetSeparatedMainDirLight(MRT7)~~
|
- TargetSeparatedMainDirLight(MRT7)
|
||||||
|
|
||||||
几个动态MRT的存在条件与Shader判断宏:
|
几个动态MRT的存在条件与Shader判断宏:
|
||||||
***查找IsUsingBasePassVelocity()*** 被使用过的地方。
|
***查找IsUsingBasePassVelocity()*** 被使用过的地方。
|
||||||
class RPGGAMEPLAYABILITY_API USDHCommonSettings : public UDeveloperSettings
|
|
||||||
|
|
||||||
|
|
||||||
UCLASS(config=Engine, defaultconfig, meta=(DisplayName="Rendering"), MinimalAPI)
|
|
||||||
class URendererSettings : public UDeveloperSettings
|
|
||||||
|
|
||||||
UPROPERTY(config, EditAnywhere, Category = VirtualTextures, meta = (
|
|
||||||
ConsoleVariable = "r.VirtualTextures", DisplayName = "Enable virtual texture support",
|
|
||||||
ToolTip = "When enabled, Textures can be streamed using the virtual texture system. Changing this setting requires restarting the editor.",
|
|
||||||
ConfigRestartRequired = true))
|
|
||||||
uint32 bVirtualTextures : 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- OutGBufferE(PrecomputedShadowFactors):r.AllowStaticLighting = 1
|
- OutGBufferE(PrecomputedShadowFactors):r.AllowStaticLighting = 1
|
||||||
-
|
- GBUFFER_HAS_PRECSHADOWFACTOR
|
||||||
|
- WRITES_PRECSHADOWFACTOR_ZERO
|
||||||
|
- WRITES_PRECSHADOWFACTOR_TO_GBUFFER
|
||||||
- TargetVelocity:(IsUsingBasePassVelocity(Platform) || Layout == GBL_ForceVelocity) ? 1 : 0;//r.VelocityOutputPass = 1
|
- TargetVelocity:(IsUsingBasePassVelocity(Platform) || Layout == GBL_ForceVelocity) ? 1 : 0;//r.VelocityOutputPass = 1
|
||||||
-
|
- GBUFFER_HAS_VELOCITY
|
||||||
|
- WRITES_VELOCITY_TO_GBUFFER
|
||||||
- Tangent:false,目前单独使用另一组MRT来存储。
|
- Tangent:false,目前单独使用另一组MRT来存储。
|
||||||
-
|
- ~~GBUFFER_HAS_TANGENT~`
|
||||||
|
|
||||||
### ToonGBuffer修改&数据存储
|
### ToonGBuffer修改&数据存储
|
||||||
```c#
|
```c#
|
||||||
@ -94,6 +84,102 @@ TargetVelocity / OutGBufferF = velocity / tangent //目前先不考虑输出Velo
|
|||||||
蓝色协议的方案
|
蓝色协议的方案
|
||||||
![[蓝色协议的方案#GBuffer]]
|
![[蓝色协议的方案#GBuffer]]
|
||||||
|
|
||||||
|
***额外添加相关宏(逻辑位于ShaderCompiler.cpp)***
|
||||||
|
- **GBUFFER_HAS_TOONDATA**
|
||||||
|
|
||||||
|
### 修改GBuffer格式
|
||||||
|
- [[#ShaderMaterialDerivedHelpers.cpp中的CalculateDerivedMaterialParameters()]]控制在BasePassPixelShader.usf中的MRT宏是否为true。
|
||||||
|
- [[#BasePassRendering.cpp中ModifyBasePassCSPSCompilationEnvironment()]]控制Velocity与SingleLayerWater相关的RT精度。
|
||||||
|
- [[#GBufferInfo.cpp中的FetchLegacyGBufferInfo()]]控制GBuffer精度以及数据打包情况。
|
||||||
|
|
||||||
|
#### BasePassRendering.cpp中ModifyBasePassCSPSCompilationEnvironment()
|
||||||
|
```c++
|
||||||
|
void ModifyBasePassCSPSCompilationEnvironment()
|
||||||
|
{
|
||||||
|
...
|
||||||
|
const bool bOutputVelocity = (GBufferLayout == GBL_ForceVelocity) ||
|
||||||
|
FVelocityRendering::BasePassCanOutputVelocity(Parameters.Platform);
|
||||||
|
if (bOutputVelocity)
|
||||||
|
{
|
||||||
|
// As defined in BasePassPixelShader.usf. Also account for Strata setting velocity in slot 1 as described in FetchLegacyGBufferInfo.
|
||||||
|
const int32 VelocityIndex = Strata::IsStrataEnabled() ? 1 : (IsForwardShadingEnabled(Parameters.Platform) ? 1 : 4);
|
||||||
|
OutEnvironment.SetRenderTargetOutputFormat(VelocityIndex, PF_G16R16);
|
||||||
|
}
|
||||||
|
...
|
||||||
|
const bool bNeedsSeparateMainDirLightTexture = IsWaterDistanceFieldShadowEnabled(Parameters.Platform) || IsWaterVirtualShadowMapFilteringEnabled(Parameters.Platform);
|
||||||
|
if (bIsSingleLayerWater && bNeedsSeparateMainDirLightTexture)
|
||||||
|
{
|
||||||
|
// See FShaderCompileUtilities::FetchGBufferParamsRuntime for the details
|
||||||
|
const bool bHasTangent = false;
|
||||||
|
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AllowStaticLighting"));
|
||||||
|
bool bHasPrecShadowFactor = (CVar ? (CVar->GetValueOnAnyThread() != 0) : 1);
|
||||||
|
|
||||||
|
uint32 TargetSeparatedMainDirLight = 5;
|
||||||
|
if (bOutputVelocity == false && bHasTangent == false)
|
||||||
|
{
|
||||||
|
TargetSeparatedMainDirLight = 5;
|
||||||
|
if (bHasPrecShadowFactor)
|
||||||
|
{
|
||||||
|
TargetSeparatedMainDirLight = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bOutputVelocity)
|
||||||
|
{
|
||||||
|
TargetSeparatedMainDirLight = 6;
|
||||||
|
if (bHasPrecShadowFactor)
|
||||||
|
{
|
||||||
|
TargetSeparatedMainDirLight = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bHasTangent)
|
||||||
|
{
|
||||||
|
TargetSeparatedMainDirLight = 6;
|
||||||
|
if (bHasPrecShadowFactor)
|
||||||
|
{
|
||||||
|
TargetSeparatedMainDirLight = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutEnvironment.SetRenderTargetOutputFormat(TargetSeparatedMainDirLight, PF_FloatR11G11B10);
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### GBufferInfo.cpp中的FetchLegacyGBufferInfo()
|
||||||
|
控制GBuffer精度以及数据打包情况。
|
||||||
|
|
||||||
|
#### ShaderMaterialDerivedHelpers.cpp中的CalculateDerivedMaterialParameters()
|
||||||
|
```c++
|
||||||
|
else if (Mat.IS_BASE_PASS)
|
||||||
|
{
|
||||||
|
Dst.PIXELSHADEROUTPUT_BASEPASS = 1;
|
||||||
|
if (Dst.USES_GBUFFER)
|
||||||
|
{
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT0 = (!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || Dst.NEEDS_BASEPASS_VERTEX_FOGGING || Mat.USES_EMISSIVE_COLOR || SrcGlobal.ALLOW_STATIC_LIGHTING || Mat.MATERIAL_SHADINGMODEL_SINGLELAYERWATER);
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT1 = ((!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || !Mat.MATERIAL_SHADINGMODEL_UNLIT));
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT2 = ((!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || !Mat.MATERIAL_SHADINGMODEL_UNLIT));
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT3 = ((!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || !Mat.MATERIAL_SHADINGMODEL_UNLIT));
|
||||||
|
if (SrcGlobal.GBUFFER_HAS_VELOCITY || SrcGlobal.GBUFFER_HAS_TANGENT)
|
||||||
|
{
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT4 = Dst.WRITES_VELOCITY_TO_GBUFFER || SrcGlobal.GBUFFER_HAS_TANGENT;
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT5 = (!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || Dst.WRITES_CUSTOMDATA_TO_GBUFFER);
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT6 = (Dst.GBUFFER_HAS_PRECSHADOWFACTOR && (!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || (Dst.WRITES_PRECSHADOWFACTOR_TO_GBUFFER && !Mat.MATERIAL_SHADINGMODEL_UNLIT)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT4 = (!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || Dst.WRITES_CUSTOMDATA_TO_GBUFFER);
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT5 = (Dst.GBUFFER_HAS_PRECSHADOWFACTOR && (!SrcGlobal.SELECTIVE_BASEPASS_OUTPUTS || (Dst.WRITES_PRECSHADOWFACTOR_TO_GBUFFER && !Mat.MATERIAL_SHADINGMODEL_UNLIT)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT0 = true;
|
||||||
|
// we also need MRT for thin translucency due to dual blending if we are not on the fallback path
|
||||||
|
Dst.PIXELSHADEROUTPUT_MRT1 = (Dst.WRITES_VELOCITY_TO_GBUFFER || (Mat.DUAL_SOURCE_COLOR_BLENDING_ENABLED && Dst.MATERIAL_WORKS_WITH_DUAL_SOURCE_COLOR_BLENDING));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### 是否需要Toon
|
### 是否需要Toon
|
||||||
在材质中:
|
在材质中:
|
||||||
```c++
|
```c++
|
||||||
@ -113,6 +199,36 @@ FMaterialRelevance UMaterialInterface::GetRelevance_Internal(const UMaterial* Ma
|
|||||||
|
|
||||||
在渲染管线中:
|
在渲染管线中:
|
||||||
```c++
|
```c++
|
||||||
|
//RenderUtils.cpp
|
||||||
|
bool IsUsingToonRendering(const FStaticShaderPlatform Platform)
|
||||||
|
{
|
||||||
|
static FShaderPlatformCachedIniValue<int32> PerPlatformCVar(TEXT("r.ToonRendering.Enable"));
|
||||||
|
if (IsMobilePlatform(Platform) || IsForwardShadingEnabled(Platform))//目前不考虑VR与移动端
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (PerPlatformCVar.Get(Platform) == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsUsingToonOutline(const FStaticShaderPlatform Platform)
|
||||||
|
{
|
||||||
|
static FShaderPlatformCachedIniValue<int32> PerPlatformCVar(TEXT("r.ToonRendering.ToonOutline"));
|
||||||
|
return (PerPlatformCVar.Get(Platform) == 1) && IsUsingToonRendering(Platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsUsingToonRimLighting(const FStaticShaderPlatform Platform)
|
||||||
|
{
|
||||||
|
static FShaderPlatformCachedIniValue<int32> PerPlatformCVar(TEXT("r.ToonRendering.ToonRimLighting"));
|
||||||
|
return (PerPlatformCVar.Get(Platform) == 1) && IsUsingToonRendering(Platform);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
李兄的ToonBuffer判断逻辑:
|
||||||
|
```c++
|
||||||
bool FDeferredShadingSceneRenderer::ShouldRenderToonDataPass() const
|
bool FDeferredShadingSceneRenderer::ShouldRenderToonDataPass() const
|
||||||
{
|
{
|
||||||
if (!SupportsToonDataMaterials(FeatureLevel, ShaderPlatform))
|
if (!SupportsToonDataMaterials(FeatureLevel, ShaderPlatform))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user