vault backup: 2025-04-10 10:03:39
This commit is contained in:
parent
85298cf495
commit
a03748f1fa
113
03-UnrealEngine/Rendering/Material/ShaderWorld Debug笔记.md
Normal file
113
03-UnrealEngine/Rendering/Material/ShaderWorld Debug笔记.md
Normal file
@ -0,0 +1,113 @@
|
||||
---
|
||||
title: 未命名
|
||||
date: 2025-04-10 09:14:41
|
||||
excerpt:
|
||||
tags:
|
||||
rating: ⭐
|
||||
---
|
||||
# 错误日志
|
||||
```c++
|
||||
UATHelper: Packaging (Android (ASTC)): LogInit: Display: LogShaderCompilers: Warning: Failed to compile Material /ShaderWorld/Material/MSPresets/MS_Foliage_Material/MasterMaterials/MA_Impostor.MA_Impostor (MI:/ShaderWorld/Spawnables/BlackAlder/Materials/Impostor/MAI_Impostor_BlackAlder.MAI_Impostor_BlackAlder) for platform SF_VULKAN_ES31_ANDROID, Default Material will be used in game.
|
||||
UATHelper: Packaging (Android (ASTC)): /Engine/Generated/Material.ush:3672:27: error: no matching function for call to 'transpose'
|
||||
UATHelper: Packaging (Android (ASTC)): return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
UATHelper: Packaging (Android (ASTC)): ^~~~~~~~~
|
||||
UATHelper: Packaging (Android (ASTC)): /Engine/Generated/Material.ush:3672:27: note: candidate function not viable: no known conversion from 'FDFMatrix' to 'matrix<float, 1, 1>' for 1st argument
|
||||
UATHelper: Packaging (Android (ASTC)): return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
UATHelper: Packaging (Android (ASTC)): ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
UATHelper: Packaging (Android (ASTC)): /Engine/Generated/Material.ush:3701:37: error: no matching function for call to 'transpose'
|
||||
UATHelper: Packaging (Android (ASTC)): return mul(InWorldVector, (float3x3)transpose(Parameters.InstanceLocalToWorld)) / (temp*temp);
|
||||
UATHelper: Packaging (Android (ASTC)): ^~~~~~~~~
|
||||
UATHelper: Packaging (Android (ASTC)): /Engine/Generated/Material.ush:3701:37: note: candidate function not viable: no known conversion from 'FDFMatrix' to 'matrix<float, 1, 1>' for 1st argument
|
||||
UATHelper: Packaging (Android (ASTC)): return mul(InWorldVector, (float3x3)transpose(Parameters.InstanceLocalToWorld)) / (temp*temp);
|
||||
UATHelper: Packaging (Android (ASTC)): ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
UATHelper: Packaging (Android (ASTC)): /Engine/Generated/Material.ush:3722:27: error: no matching function for call to 'transpose'
|
||||
UATHelper: Packaging (Android (ASTC)): return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
UATHelper: Packaging (Android (ASTC)): ^~~~~~~~~
|
||||
UATHelper: Packaging (Android (ASTC)): /Engine/Generated/Material.ush:3722:27: note: candidate function not viable: no known conversion from 'FDFMatrix' to 'matrix<float, 1, 1>' for 1st argument
|
||||
UATHelper: Packaging (Android (ASTC)): return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
UATHelper: Packaging (Android (ASTC)): ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
```
|
||||
|
||||
|
||||
搜索结果大致是:
|
||||
```c++
|
||||
MaterialFloat3 CustomExpression1(FMaterialVertexParameters Parameters,float3 InWorldVector, FWSVector3 LWCInWorldVector)
|
||||
{
|
||||
#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
|
||||
return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
#else
|
||||
return mul(InWorldVector, (MaterialFloat3x3)LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
|
||||
#endif
|
||||
}
|
||||
|
||||
MaterialFloat3 CustomExpression4(FMaterialVertexParameters Parameters,MaterialFloat3 InWorldVector)
|
||||
{
|
||||
#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
|
||||
float3 temp;
|
||||
temp.x = length(TransformLocalVectorToWorld(Parameters, float3(1,0,0)));
|
||||
temp.y = length(TransformLocalVectorToWorld(Parameters, float3(0,1,0)));
|
||||
temp.z = length(TransformLocalVectorToWorld(Parameters, float3(0,0,1)));
|
||||
return mul(InWorldVector, (MaterialFloat3x3)transpose(Parameters.InstanceLocalToWorld)) / (temp*temp);
|
||||
#else
|
||||
return mul(InWorldVector, (MaterialFloat3x3)LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
|
||||
#endif
|
||||
}
|
||||
|
||||
MaterialFloat3 CustomExpression6(FMaterialVertexParameters Parameters,MaterialFloat3 InWorldVector)
|
||||
{
|
||||
#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
|
||||
return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
#else
|
||||
return mul(InWorldVector, (MaterialFloat3x3)LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
|
||||
#endif
|
||||
}
|
||||
|
||||
MaterialFloat3 CustomExpression6(FMaterialVertexParameters Parameters,MaterialFloat3 InWorldVector)
|
||||
{
|
||||
#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
|
||||
return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
#else
|
||||
return mul(InWorldVector, (MaterialFloat3x3)LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
|
||||
#endif
|
||||
}
|
||||
|
||||
MaterialFloat3 CustomExpression9(FMaterialVertexParameters Parameters,float3 InWorldVector, FWSVector3 LWCInWorldVector)
|
||||
{
|
||||
#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
|
||||
return mul(InWorldVector, transpose(Parameters.InstanceLocalToWorld));
|
||||
#else
|
||||
return mul(InWorldVector, (MaterialFloat3x3)LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
|
||||
#endif
|
||||
}
|
||||
|
||||
MaterialFloat3 CustomExpression12(FMaterialVertexParameters Parameters,MaterialFloat3 InWorldVector)
|
||||
{
|
||||
#if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
|
||||
float3 temp;
|
||||
temp.x = length(TransformLocalVectorToWorld(Parameters, float3(1,0,0)));
|
||||
temp.y = length(TransformLocalVectorToWorld(Parameters, float3(0,1,0)));
|
||||
temp.z = length(TransformLocalVectorToWorld(Parameters, float3(0,0,1)));
|
||||
return mul(InWorldVector, (MaterialFloat3x3)transpose(Parameters.InstanceLocalToWorld)) / (temp*temp);
|
||||
#else
|
||||
return mul(InWorldVector, (MaterialFloat3x3)LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal));
|
||||
#endif
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
##
|
||||
```c++
|
||||
#if USE_INSTANCING || USE_INSTANCE_CULLING
|
||||
float3x3 LocalToWorld = DFToFloat3x3(Parameters.InstanceLocalToWorld);
|
||||
float3 LocalPosition = Parameters.InstanceLocalPosition;
|
||||
|
||||
// skip if this instance is hidden
|
||||
if (Parameters.PerInstanceParams.y < 1.f)
|
||||
{
|
||||
return float3(0,0,0);
|
||||
}
|
||||
#else
|
||||
float3x3 LocalToWorld = DFToFloat3x3(GetPrimitiveData(Parameters).LocalToWorld);
|
||||
float3 LocalPosition = WSMultiplyDemote(GetWorldPosition(Parameters), Parameters.LWCData.WorldToLocal);
|
||||
#endif
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user