Files
netease-modsdk-wiki/docs/wiki/visuals/glowing-texture.md
2025-03-20 11:52:46 +08:00

2.6 KiB
Raw Permalink Blame History

title, category, mentions
title category mentions
发光实体纹理 巧思案例
LeGend077
MedicalJewel105

发光实体纹理

在本教程中,你将学习如何通过材质和纹理为实体创建发光效果,类似末影人眼睛的发光特性。

纹理处理

要让实体纹理发光需要使用高级图像编辑器这里以Blockbench为例对像素透明度进行半擦除处理。

  • 打开实体纹理文件

忽略奇怪的骨骼旋转Mojang通过动画实现了正确的模型渲染。

  • 找到 橡皮擦工具 并将不透明度/alpha值设置为较低数值如71或23

  • 擦除需要发光的纹理区域。像素可见度越低发光效果越强但需确保不完全擦除100%透明)

示例猪纹理:

材质设置

修改目标生物的RP/entity/my_entity.entity.json文件。定位到"materials":{}并设置为"entity_emissive_alpha"(需确认纹理正确定义)。

::: code-group

"materials": {
    "default": "entity_emissive_alpha"
}

:::

::: code-group

{
	"format_version": "1.10.0",
	"minecraft:client_entity": {
		"description": {
			"identifier": "minecraft:pig",
			"min_engine_version": "1.8.0",
			"materials": {
				"default": "entity_emissive_alpha" // 将"pig"替换为"entity_emissive_alpha"
			},
			"textures": {
				"default": "textures/entity/pig/pig",
				"saddled": "textures/entity/pig/pig_saddle"
			},
			"geometry": {
				"default": "geometry.pig.v1.8"
			},
			"animations": {
				"setup": "animation.pig.setup",
				"walk": "animation.quadruped.walk",
				"look_at_target": "animation.common.look_at_target",
				"baby_transform": "animation.pig.baby_transform"
			},
			"scripts": {
				"animate": [
					"setup",
					{
						"walk": "q.modified_move_speed"
					},
					"look_at_target",
					{
						"baby_transform": "q.is_baby"
					}
				]
			},
			"render_controllers": ["controller.render.pig"],
			"spawn_egg": {
				"texture": "spawn_egg",
				"texture_index": 2
			}
		}
	}
}

:::

效果测试

加载Minecraft并启用此资源包将时间设为_午夜_或寻找洞穴环境进行测试。实体应呈现预期的发光效果。