vault backup: 2024-03-13 17:48:15

This commit is contained in:
BlueRose 2024-03-13 17:48:15 +08:00
parent ce8ba3b378
commit 9e7c5342df

View File

@ -287,6 +287,59 @@ LazyPrintf.PushParam(!bEnableExecutionFlow ? *GenerateFunctionCode(MP_CustomData
- `for (uint32 CustomUVIndex = 0; CustomUVIndex < NumUserTexCoords; CustomUVIndex++)`
- `for (UMaterialExpressionVertexInterpolator* Interpolator : CustomVertexInterpolators`
### 添加ToonDataAssetID 与 ToonOutlineDataAssetID笔记
1. FMaterialRenderProxy::UpdateDeferredCachedUniformExpressions()
2. FMaterialRenderProxy::EvaluateUniformExpressions()
3. FUniformExpressionSet::FillUniformBuffer()
4. EvaluatePreshader()
5. EvaluateParameter()
6. Context.MaterialRenderProxy->GetParameterValue()
可以看得出关键数据在UniformExpressionSet中这里的ParameterIndex则通过`EvaluateParameter(Stack, UniformExpressionSet, ReadPreshaderValue<uint16>(Data), Context);`进行计算。
```c++
const FMaterialNumericParameterInfo& Parameter = UniformExpressionSet->GetNumericParameter(ParameterIndex);
bool bFoundParameter = false;
// First allow proxy the chance to override parameter
if (Context.MaterialRenderProxy)
{
FMaterialParameterValue ParameterValue;
if (Context.MaterialRenderProxy->GetParameterValue(Parameter.ParameterType, Parameter.ParameterInfo, ParameterValue, Context))
{
Stack.PushValue(ParameterValue.AsShaderValue());
bFoundParameter = true;
}
}
bool FMaterialInstanceResource::GetParameterValue(EMaterialParameterType Type, const FHashedMaterialParameterInfo& ParameterInfo, FMaterialParameterValue& OutValue, const FMaterialRenderContext& Context) const
{
checkSlow(IsInParallelRenderingThread());
bool bResult = false;
// Check for hard-coded parameters
if (Type == EMaterialParameterType::Scalar && ParameterInfo.Name == GetSubsurfaceProfileParameterName())
{
check(ParameterInfo.Association == EMaterialParameterAssociation::GlobalParameter);
const USubsurfaceProfile* MySubsurfaceProfileRT = GetSubsurfaceProfileRT();
OutValue = GetSubsurfaceProfileId(MySubsurfaceProfileRT);
bResult = true;
}
else if (Type == EMaterialParameterType::Scalar && NumSpecularProfileRT() > 0)
{
for (uint32 It=0,Count=NumSpecularProfileRT();It<Count;++It)
{
if (ParameterInfo.Name == SpecularProfileAtlas::GetSpecularProfileParameterName(GetSpecularProfileRT(It)))
{
check(ParameterInfo.Association == EMaterialParameterAssociation::GlobalParameter);
OutValue = SpecularProfileAtlas::GetSpecularProfileId(GetSpecularProfileRT(It));
bResult = true;
break;
}
}
}
```
### 是否需要Toon
在材质中:
```c++