我有一个gltf,我在其中应用png纹理在矩形网格上。我有一个矩形png和圆圈png。矩形节点的z = 0.01,圆圈的z = 0.0。用于材料的alpha模式是BLEND。材料是双面的。
GLTF
{
"scenes" : [
{
"nodes" : [
0
]
}
],
"nodes" : [
{
"name" : "Node_0",
"children" : [
1,
3
]
},
{
"name" : "Symbol 2",
"children" : [
2
],
"translation" : [
240.25,
-126.300003,
0
]
},
{
"name" : "Node_2",
"mesh" : 0,
"scale" : [
0.656657,
0.656657,
1
]
},
{
"name" : "Symbol 1",
"children" : [
4
],
"translation" : [
170,
-89.050003,
0
]
},
{
"name" : "Node_4",
"mesh" : 1,
"translation" : [
0,
0,
-0.01
],
"scale" : [
2.059968,
1.399979,
1
]
}
],
"meshes" : [
{
"primitives" : [
{
"attributes" : {
"POSITION" : 1,
"TEXCOORD_0" : 2
},
"indices" : 0,
"material" : 0
}
]
},
{
"primitives" : [
{
"attributes" : {
"POSITION" : 1,
"TEXCOORD_0" : 2
},
"indices" : 0,
"material" : 1
}
]
}
],
"buffers" : [
{
"uri" : "data:application/octet-stream;base64,AQAAAAAAAAADAAAAAwAAAAIAAAABAAAAAAAAAAAAAIAAAAAAAAAAAAAAyMIAAAAAAADIQgAAyMIAAAAAAADIQgAAAIAAAAAAAAAAAAAAAAAAAAAAAACAPwAAgD8AAIA/AACAPwAAAAAAAAAAq6oqPacaKD+nGig/AACAP6caKD+nGig/AACAPwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAACAAACAPwAAAACrqio9AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AAAAAABAcEOamfzCAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIA/AAAAAKuqKj2G1gNAfzKzPwAAgD+G1gNAfzKzPwAAgD8AAAAAAAAAAAAAAIAK1yO8AAAAAAAAAAAAAAAAAAAAgAAAgD8AAAAAq6oqPQAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAAAAAACpDmhmywgAAAAAAAAAAAAAAAAAAAAAAAACAAACAPw==",
"byteLength" : 376
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteOffset" : 0,
"byteLength" : 24,
"target" : 34963
},
{
"buffer" : 0,
"byteOffset" : 24,
"byteLength" : 48,
"target" : 34962
},
{
"buffer" : 0,
"byteOffset" : 72,
"byteLength" : 32,
"target" : 34962
}
],
"accessors" : [
{
"name" : "accessor_0",
"bufferView" : 0,
"byteOffset" : 0,
"componentType" : 5125,
"count" : 6,
"type" : "SCALAR",
"max" : [
3
],
"min" : [
0
]
},
{
"name" : "accessor_1",
"bufferView" : 1,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 4,
"type" : "VEC3",
"max" : [
100,
0,
0
],
"min" : [
0,
-100,
0
]
},
{
"name" : "accessor_2",
"bufferView" : 2,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 4,
"type" : "VEC2",
"max" : [
1,
1
],
"min" : [
0,
0
]
}
],
"materials" : [
{
"pbrMetallicRoughness" : {
"baseColorTexture" : {
"index" : 0
}
},
"alphaMode" : "BLEND",
"doubleSided" : true
},
{
"pbrMetallicRoughness" : {
"baseColorTexture" : {
"index" : 1
}
},
"alphaMode" : "BLEND",
"doubleSided" : true
}
],
"samplers" : [
{
"magFilter" : 9729,
"minFilter" : 9987,
"wrapS" : 33071,
"wrapT" : 33071
}
],
"textures" : [
{
"sampler" : 0,
"source" : 0
},
{
"sampler" : 0,
"source" : 1
}
],
"images" : [
{
"uri" : "Image0.png"
},
{
"uri" : "Image1.png"
}
],
"asset" : {
"version" : "2.0"
}
}
我使用的是ThreeJs gltf viewer。 https://gltf-viewer.donmccurdy.com/ 混合在某些角度可以正常工作但是当我绕某些角度旋转时,混合不起作用。截图
有人可以向我解释这种行为吗?如何在各个角度实现正确的混合。
答案 0 :(得分:1)
如果这些是三个独立的节点,并且它们都位于paper2=BA002
,则可能存在排序问题。 GLTF是可读的,但我不熟悉规范来说明发生了什么。文件中提到的没有翻译字段的节点可能都位于0,0,0
无论哪种方式,如果你想继续排序,这样的补救措施就是分配不同的0,0,0
。因此,对于这些元素,您可以设置1,2,3,4 ...并控制何时希望它们绘制/告诉排序考虑这些权重。