vault backup: 2024-03-14 20:26:25
This commit is contained in:
@@ -233,10 +233,9 @@ static TAutoConsoleVariable<int32> CVarMaterialEnableNewHLSLGenerator(
|
||||
TEXT("2 - Force all materials to use new generator\n"),
|
||||
ECVF_RenderThreadSafe | ECVF_ReadOnly);
|
||||
```
|
||||
这个和新版材质HLSL生成器有关,相关生成代码为**MaterialEmitHLSL()**=>调用**GenerateMaterialTemplateHLSL()**
|
||||
|
||||
bCompileForComputeShader = Material->IsLightFunction();
|
||||
|
||||
|
||||
GetPerInstanceCustomDataX分为Vertex与Pixel版本。
|
||||
|
||||
#### FMaterialAttributes
|
||||
@@ -340,51 +339,6 @@ bool FMaterialInstanceResource::GetParameterValue(EMaterialParameterType Type, c
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
MaterialEmitHLSL()=>
|
||||
```c++
|
||||
bool MaterialEmitHLSL(const FMaterialCompileTargetParameters& InCompilerTarget,
|
||||
const FStaticParameterSet& InStaticParameters,
|
||||
FMaterial& InOutMaterial,
|
||||
FMaterialCompilationOutput& OutCompilationOutput,
|
||||
TRefCountPtr<FSharedShaderCompilerEnvironment>& OutMaterialEnvironment)
|
||||
{
|
||||
...
|
||||
if (DerivativeIndex == 0)
|
||||
{
|
||||
const EMaterialDomain MaterialDomain = EmitContext.Material->GetMaterialDomain();
|
||||
if (MaterialDomain == MD_Volume || (MaterialDomain == MD_Surface && IsSubsurfaceShadingModel(EmitMaterialData.ShadingModelsFromCompilation)))
|
||||
{ const FMaterialParameterInfo SubsurfaceProfileParameterInfo(GetSubsurfaceProfileParameterName());
|
||||
const FMaterialParameterMetadata SubsurfaceProfileParameterMetadata(1.f);
|
||||
const Material::FExpressionParameter SubsurfaceProfileExpression(SubsurfaceProfileParameterInfo, SubsurfaceProfileParameterMetadata);
|
||||
|
||||
const FPreparedType SubsurfaceProfilePreparedType = EmitContext.PrepareExpression(&SubsurfaceProfileExpression, *EmitResultScope, EValueType::Float1);
|
||||
const FEmitShaderExpression* SubsurfaceProfileEmitExpression = SubsurfaceProfileExpression.GetValueShader(
|
||||
EmitContext,
|
||||
*EmitResultScope,
|
||||
EValueType::Float1,
|
||||
SubsurfaceProfilePreparedType,
|
||||
EValueType::Float1);
|
||||
check(SubsurfaceProfileEmitExpression && SubsurfaceProfileEmitExpression->Reference);
|
||||
SubsurfaceProfileShaderCode = SubsurfaceProfileEmitExpression->Reference;
|
||||
}
|
||||
}
|
||||
...
|
||||
|
||||
MaterialTemplateSource = GenerateMaterialTemplateHLSL(InCompilerTarget.ShaderPlatform,
|
||||
InOutMaterial,
|
||||
EmitContext,
|
||||
Declarations.ToString(),
|
||||
SharedCode.ToString(),
|
||||
VertexCode.ToString(),
|
||||
InputPixelCodePhase0,
|
||||
InputPixelCodePhase1,
|
||||
SubsurfaceProfileShaderCode,
|
||||
OutCompilationOutput);
|
||||
}
|
||||
```
|
||||
调用GenerateMaterialTemplateHLSL()
|
||||
|
||||
### 是否需要Toon
|
||||
在材质中:
|
||||
```c++
|
||||
@@ -459,8 +413,39 @@ bool FDeferredShadingSceneRenderer::ShouldRenderToonDataPass() const
|
||||
从3开始,0、1、2已被占用。
|
||||
- ?
|
||||
|
||||
## ToonData
|
||||
## ToonBufferData
|
||||
- ToonObjectID
|
||||
|
||||
```c++
|
||||
struct FSceneDataIntermediates
|
||||
{
|
||||
uint PrimitiveId;
|
||||
uint InstanceId;
|
||||
uint ViewIndex;
|
||||
uint CullingFlags;
|
||||
// Index from which we load the instance info, needed for the
|
||||
uint InstanceIdLoadIndex;
|
||||
FInstanceSceneData InstanceData;
|
||||
FPrimitiveSceneData Primitive;
|
||||
};
|
||||
|
||||
struct FVertexFactoryIntermediatesCommon
|
||||
{
|
||||
/** Cached primitive and instance data */
|
||||
FSceneDataIntermediates SceneData;
|
||||
#if USE_INSTANCING || USE_INSTANCE_CULLING
|
||||
FVertexFactoryInstanceInput InstanceInput;
|
||||
#endif
|
||||
#if USE_SPLINEDEFORM
|
||||
FSplineMeshShaderParams SplineMeshParams;
|
||||
#endif
|
||||
};
|
||||
|
||||
FPrimitiveSceneData GetPrimitiveData(FVertexFactoryIntermediatesCommon Intermediates)
|
||||
{
|
||||
return Intermediates.SceneData.Primitive;
|
||||
}
|
||||
```
|
||||
|
||||
## 高光
|
||||
- PBR高光(使用Roughness控制是否可行?是否需要传入GBuffer一个Mask贴图)
|
||||
|
Reference in New Issue
Block a user