# Conflicts:
#	docs/RENDERING-REPAIR-PLAN.md
This commit is contained in:
shen
2026-09-08 16:25:54 +08:00
45 changed files with 1532 additions and 162 deletions
+14 -10
View File
@@ -564,12 +564,6 @@ void Metin2Model::_load_hair() {
hair_parts = mtgodot::build_parts(hfi);
// hair 贴图:同名 .ddsalpha-scissor 镂空
Ref<StandardMaterial3D> hm;
hm.instantiate();
hm->set_roughness(1.0f);
hm->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA_SCISSOR);
hm->set_alpha_scissor_threshold(0.5f);
hm->set_cull_mode(StandardMaterial3D::CULL_DISABLED);
// SourceSkin (gr2 sibling .dds) -> TargetSkin override (§2.4)
String hdds = hair_skin.is_empty() ? (hair_gr2.get_basename() + ".dds") : hair_skin;
Ref<ImageTexture> ht = _load_dds(hdds);
@@ -577,10 +571,20 @@ void Metin2Model::_load_hair() {
UtilityFunctions::push_warning(String("[Metin2Model] hair_skin not found: ") + hair_skin);
ht = _load_dds(hair_gr2.get_basename() + ".dds"); // fall back to SourceSkin
}
if (ht.is_valid())
hm->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, ht);
else
hm->set_albedo(Color(0.18f, 0.12f, 0.08f));
// R2-02: the same forward material the body/weapon surfaces use, not a
// StandardMaterial3D. The old one ran Godot's PBR specular at roughness 1.0
// and washed the fringe out into flat cream patches (bisection: roughness 0
// or unshaded clean, alpha/cull/metallic changes not). make_material's
// shaders are `specular_disabled`, so the hair now lights like the body.
// CPU path: skinning already happened on the CPU, so skinned = false.
mtgodot::MaterialDesc hd;
hd.albedo = ht;
hd.blend = mtgodot::BlendMode::AlphaTest; // discard < 0.5, still depth-opaque
hd.alpha_scissor = 0.5f;
hd.two_sided = true; // hair cards are single-sided geometry
Ref<ShaderMaterial> hm = mtgodot::make_material(hd);
if (ht.is_null()) // keep the untextured fallback colour (make_material's is pale grey)
hm->set_shader_parameter("modulate", Color(0.18f, 0.12f, 0.08f, 1.0f));
hair_mat = hm;
hair_tex = ht; // reused by the GPU-skin path (§2.2)