修自发光回归:glTF 导入端写 emissiveFactor(EMISSIVE_COLOR,贴图无 factor 时设白);Emissive 兜底纹理黑→白(黑兜底会把 factor/strength 一起乘没)
This commit is contained in:
@@ -29,7 +29,12 @@ namespace Engine
|
|||||||
return Texture::CreateSolidColor(device, allocator,
|
return Texture::CreateSolidColor(device, allocator,
|
||||||
0, 128, 0, false);
|
0, 128, 0, false);
|
||||||
case Material::Emissive:
|
case Material::Emissive:
|
||||||
return Texture::CreateSolidColor(device, allocator, 0, 0, 0);
|
// 兜底白(非黑):emissive = 贴图 × factor × strength——黑
|
||||||
|
// 兜底会把无贴图材质的 factor/strength 一起乘没(调了恒黑
|
||||||
|
// 的困惑源);白兜底 = 无贴图时 factor 即发光色,有贴图时
|
||||||
|
// glTF 语义不变(factor 黑的普通模型依旧不发光)
|
||||||
|
return Texture::CreateSolidColor(device, allocator,
|
||||||
|
255, 255, 255);
|
||||||
case Material::Ao:
|
case Material::Ao:
|
||||||
return Texture::CreateSolidColor(device, allocator,
|
return Texture::CreateSolidColor(device, allocator,
|
||||||
255, 0, 0, false);
|
255, 0, 0, false);
|
||||||
|
|||||||
@@ -899,6 +899,23 @@ ParsedMesh Model::ProcessMesh(const aiMesh* mesh, const aiScene* scene,
|
|||||||
static_cast<f32>(emissiveStrength),
|
static_cast<f32>(emissiveStrength),
|
||||||
static_cast<f32>(thickness));
|
static_cast<f32>(thickness));
|
||||||
|
|
||||||
|
// glTF emissiveFactor → assimp EMISSION_COLOR。非黑直接写;
|
||||||
|
// 有 emissive 贴图但 factor 黑的导出器(factor 缺省不写)按
|
||||||
|
// glTF 惯例设白——贴图语义就是"贴图即发光强度分布",乘 0
|
||||||
|
// 会把本来正常的自发光整个吃掉
|
||||||
|
aiColor3D emissiveColor(0.0f, 0.0f, 0.0f);
|
||||||
|
material->Get(AI_MATKEY_COLOR_EMISSIVE, emissiveColor);
|
||||||
|
if (emissiveColor.r > 0.0f || emissiveColor.g > 0.0f ||
|
||||||
|
emissiveColor.b > 0.0f) {
|
||||||
|
params.emissiveFactor = glm::vec4(
|
||||||
|
static_cast<f32>(emissiveColor.r),
|
||||||
|
static_cast<f32>(emissiveColor.g),
|
||||||
|
static_cast<f32>(emissiveColor.b), 0.0f);
|
||||||
|
}
|
||||||
|
else if (!texPaths[Material::Emissive].empty()) {
|
||||||
|
params.emissiveFactor = glm::vec4(1.0f, 1.0f, 1.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
// transmission > 0 的材质必须走透明队列:物理透射表面要采样
|
// transmission > 0 的材质必须走透明队列:物理透射表面要采样
|
||||||
// 不透明场景副本做折射。Khronos 新式玻璃写法是 alphaMode=OPAQUE
|
// 不透明场景副本做折射。Khronos 新式玻璃写法是 alphaMode=OPAQUE
|
||||||
// + transmission=1(透明度语义全在 transmission,alpha 恒 1)——
|
// + transmission=1(透明度语义全在 transmission,alpha 恒 1)——
|
||||||
|
|||||||
Reference in New Issue
Block a user