修改 Ninja Ripper 2.13 的 3ds Max 导入工具,支持同时导入两套 UV。
- NR 导入工具路径:
C:\Program Files (x86)\Ninja Ripper 2.13\importers\3dsmax\ - 截帧游戏:
SpeedGame-Win64-Shipping.exe(UE 引擎) - 截帧数据路径:
c:\Users\Administrator\AppData\Roaming\Ninja Ripper\2026.03.19_00.56.36_SpeedGame-Win64-Shipping.exe_56044\frame_0\
所有大型 mesh 文件布局一致(14 个属性):
| NR索引 | SemIdx | Shader输入 | 类型 | 分量 | 用途 |
|---|---|---|---|---|---|
| [0] | 0 | _input0 | Float | 3 | Position |
| [1] | 1 | _input1 | Float | 4 | Normal |
| [2] | 2 | _input2 | Float | 4 | Tangent |
| [3] | 5 | _input5 | Float | 4 | UV1(xy) + UV2(zw) |
| [4] | 7 | _input7 | Float | 2 | 非UV(负值) |
| [5] | 6 | _input6 | Float | 2 | 非UV(与[4]相同) |
| [6] | 8 | _input8 | Uint16 | 4 | Bone Indices |
| [7] | 13 | _input13 | Float | 4 | Vertex Color |
| [8] | 14 | _input14 | Uint8 | 4 | ... |
| [9] | 3 | _input3 | Uint8 | 4 | ... |
| [10] | 15 | _input15 | Float | 4 | ... |
| [11] | 4 | _input4 | Float | 4 | ... |
| [12] | 12 | _input12 | Float | 3 | ... |
| [13] | 11 | _input11 | Float | 3 | ... |
- NR 属性索引按顶点缓冲区物理顺序编号,不等于 Shader 的
_inputN编号 _input5(SemIdx=5)实际在 NR 索引 [3],不是 [5]- 两套 UV 打包在同一个 4 分量属性中:UV1 = comp 0,1;UV2 = comp 2,3
- [4] 和 [5] 虽然是 2 分量 Float,但数据为负值且相同,不是 UV
TexcoordLoadMode新增DualComp = 5TexCoords类新增u2AttrComp/v2AttrComp字段存储第二组 UV- 更新
TexcoordLoadModeToStr和TexCoords.__str__支持新模式
- 新增
_createTexCoordDualComp()函数,同时创建两组TexCoordAttrComp(UV1 和 UV2) createTexCoordList()中添加对DualComp模式的分发
- 新增
TexcoordLoadDualUV控件类,提供 4 行设置:- UV1: U-Attr/Comp(默认 3/0)
- UV1: V-Attr/Comp(默认 3/1)
- UV2: U-Attr/Comp(默认 3/2)
- UV2: V-Attr/Comp(默认 3/3)
PostVsImportGui和PreVsImportGui的 Texcoord 下拉框都新增第 6 项 "Dual UV (Attr/Comp)"- 两个
texcoordLoadComboChangeSlot都添加了elif 5 == idx分支
修复 pymxs 版 Importer_pymxs._createTexCoords 的 bug:
原始代码问题:对非默认 UV 通道(UV2、UV3...)只调用了 setMapVert,缺少:
meshop.setNumMapVerts— 未分配 map 顶点缓冲区meshop.setMapFace— 未设置 map 面索引
修复方案:在 setMapSupport 之后,对每个 UV 通道都完整执行:
meshop.setNumMapVerts → meshop.setMapVert → meshop.setMapFace
注:MaxPlus 版本不受影响,它对每个通道都正确调用了
SetNumTextureVertices+SetTextureVertex+SetTextureFace
- 重启 3ds Max(必须,Python 模块有内存缓存,不重启不生效)
- 运行
import_local.ms - Texcoord Load 下拉选 "Dual UV (Attr/Comp)"
- 默认值已预设好,直接点 Import
- 导入后 Map Channel 1 = UV1,Map Channel 2 = UV2
- 在 Unwrap UVW 修改器中切换 Map Channel 可查看不同 UV
| 设置项 | Attr | Comp | 对应数据 |
|---|---|---|---|
| UV1: U-Attr/Comp | 3 | 0 | _input5.x |
| UV1: V-Attr/Comp | 3 | 1 | _input5.y |
| UV2: U-Attr/Comp | 3 | 2 | _input5.z |
| UV2: V-Attr/Comp | 3 | 3 | _input5.w |
如果其他游戏的 UV 在两个独立属性中(各 2 分量),改为:
- UV1: Attr=X, Comp=0/1
- UV2: Attr=Y, Comp=0/1