Well not much progress on resolving the tangent space basis. Unweighted vertex normal calculations still show differences from CA's .mesh values. I've found several algorithms for doing weighted vertex normals but they all seem to have little effect on the bad vertices, and make some of the good vertices worse. Here's what I see if I just do unweighted vertex normal computations:
Code:
Original RGB Computed RGB Ref. Original tangent space vector Computed tangent space vector
z y x z y x count mag z y x mag z y x Angle
188 119 15 189 120 16 [ 6] +1.00407 ( +0.47451, -0.06667, -0.88235 ) +1.00000 ( +0.48075, -0.06093, -0.87474 ) 0.00000
197 84 29 197 85 30 [ 7] +1.00517 ( +0.54510, -0.34118, -0.77255 ) +1.00000 ( +0.54769, -0.33427, -0.76701 ) 0.00000
246 82 127 234 88 69 [ 2] +0.99558 ( +0.92941, -0.35686, -0.00392 ) +1.00000 ( +0.83236, -0.31026, -0.45926 ) 27.61001
132 137 0 132 137 0 [ 7] +1.00339 ( +0.03529, +0.07451, -1.00000 ) +1.00000 ( +0.03723, +0.07653, -0.99637 ) 0.00000
167 113 7 168 113 7 [ 8] +1.00106 ( +0.30980, -0.11373, -0.94510 ) +1.00000 ( +0.31579, -0.11333, -0.94203 ) 0.00000
209 118 30 209 118 30 [ 7] +0.99946 ( +0.63922, -0.07451, -0.76471 ) +1.00000 ( +0.64171, -0.07339, -0.76343 ) 1.88787
238 121 65 239 121 66 [ 7] +0.99700 ( +0.86667, -0.05098, -0.49020 ) +1.00000 ( +0.87373, -0.04966, -0.48388 ) 4.47212
210 139 30 210 139 31 [ 6] +1.00578 ( +0.64706, +0.09020, -0.76471 ) +1.00000 ( +0.64708, +0.09066, -0.75701 ) 0.00000
72 130 12 73 131 12 [ 6] +1.00523 ( -0.43529, +0.01961, -0.90588 ) +1.00000 ( -0.42872, +0.02385, -0.90312 ) 0.00000
67 157 19 67 157 19 [ 5] +1.00143 ( -0.47451, +0.23137, -0.85098 ) +1.00000 ( -0.47331, +0.23332, -0.84943 ) 0.00000
21 125 56 21 126 57 [ 8] +1.00627 ( -0.83529, -0.01961, -0.56078 ) +1.00000 ( -0.83194, -0.01543, -0.55465 ) 0.00000
79 127 9 79 128 10 [ 6] +1.00425 ( -0.38039, -0.00392, -0.92941 ) +1.00000 ( -0.37902, +0.00296, -0.92538 ) 0.00000
142 241 72 143 241 72 [ 6] +0.99743 ( +0.11373, +0.89020, -0.43529 ) +1.00000 ( +0.12088, +0.89312, -0.43327 ) 4.13269
168 205 35 169 205 35 [ 5] +0.99835 ( +0.31765, +0.60784, -0.72549 ) +1.00000 ( +0.32366, +0.60825, -0.72475 ) 3.30577
192 164 24 192 165 24 [ 7] +0.99841 ( +0.50588, +0.28627, -0.81176 ) +1.00000 ( +0.50739, +0.29189, -0.81078 ) 3.24299
116 205 27 117 206 28 [ 6] +0.99946 ( -0.09020, +0.60784, -0.78824 ) +1.00000 ( -0.08546, +0.61458, -0.78421 ) 1.95207
130 160 4 130 161 4 [ 6] +1.00180 ( +0.01961, +0.25490, -0.96863 ) +1.00000 ( +0.02185, +0.26097, -0.96510 ) 0.00000
137 133 0 138 134 1 [ 7] +1.00370 ( +0.07451, +0.04314, -1.00000 ) +1.00000 ( +0.08135, +0.04980, -0.99544 ) 0.00000
99 232 61 100 233 61 [ 7] +0.99687 ( -0.22353, +0.81961, -0.52157 ) +1.00000 ( -0.21910, +0.82662, -0.51835 ) 4.55719
73 202 39 74 203 40 [ 5] +1.00296 ( -0.42745, +0.58431, -0.69412 ) +1.00000 ( -0.42043, +0.59120, -0.68827 ) 0.00000
69 165 20 69 165 21 [ 6] +1.00394 ( -0.45882, +0.29412, -0.84314 ) +1.00000 ( -0.45738, +0.29634, -0.83844 ) 0.00000
79 237 84 79 237 85 [ 5] +0.99934 ( -0.38039, +0.85882, -0.34118 ) +1.00000 ( -0.38033, +0.86202, -0.33506 ) 2.12102
47 206 67 47 206 68 [ 6] +1.00143 ( -0.63137, +0.61569, -0.47451 ) +1.00000 ( -0.63105, +0.61812, -0.46873 ) 0.00000
26 169 61 27 169 61 [ 6] +1.00584 ( -0.79608, +0.32549, -0.52157 ) +1.00000 ( -0.79021, +0.32606, -0.51890 ) 0.00000
247 85 127 213 98 38 [ 3] +0.99477 ( +0.93725, -0.33333, -0.00392 ) +1.00000 ( +0.67328, -0.23465, -0.70117 ) 44.60200
The RGB values of the vertex normals are shown CA first then my computed values, then translated into float via the inverse cube normalization, again CA first then my computed values. The float normals have their magnitudes shown before the vectors just to verify they are unit normals. The Figure Of Merit is the last column, this is the angle in degrees between CA's original number and what I'm getting just from geometry. (These are for the mailed_knights_lod0.mesh, got tired of looking at the feudal_knights.) The two bad normals are shown in red. The tangents for the first twenty-five vertices are next:
Code:
239 127 188 239 128 189 [ 6] +0.99496 ( +0.87451, -0.00392, +0.47451 ) +1.00000 ( +0.87642, +0.00192, +0.48154 ) 5.77339
228 116 204 228 116 205 [ 7] +0.99471 ( +0.78824, -0.09020, +0.60000 ) +1.00000 ( +0.79155, -0.09001, +0.60444 ) 5.89615
127 127 255 183 109 241 [ 2] +1.00002 ( -0.00392, -0.00392, +1.00000 ) +1.00000 ( +0.43474, -0.14849, +0.88823 ) 27.48816
254 130 132 255 131 133 [ 7] +0.99298 ( +0.99216, +0.01961, +0.03529 ) +1.00000 ( +0.99888, +0.02624, +0.03934 ) 6.80755
248 130 167 248 130 168 [ 8] +0.99477 ( +0.94510, +0.01961, +0.30980 ) +1.00000 ( +0.94870, +0.02128, +0.31547 ) 5.86652
225 133 209 225 133 209 [ 7] +0.99761 ( +0.76471, +0.04314, +0.63922 ) +1.00000 ( +0.76685, +0.04576, +0.64019 ) 3.96203
189 128 239 189 129 239 [ 7] +0.99872 ( +0.48235, +0.00392, +0.87451 ) +1.00000 ( +0.48482, +0.00840, +0.87457 ) 2.91006
223 136 210 224 136 211 [ 6] +0.99205 ( +0.74902, +0.06667, +0.64706 ) +1.00000 ( +0.75444, +0.06709, +0.65293 ) 7.23046
242 134 73 243 135 73 [ 6] +0.99589 ( +0.89804, +0.05098, -0.42745 ) +1.00000 ( +0.90249, +0.05707, -0.42692 ) 5.21208
239 128 65 239 129 66 [ 5] +1.00253 ( +0.87451, +0.00392, -0.49020 ) +1.00000 ( +0.87478, +0.01106, -0.48439 ) 0.00000
198 131 21 198 132 21 [ 8] +1.00210 ( +0.55294, +0.02745, -0.83529 ) +1.00000 ( +0.55394, +0.03452, -0.83184 ) 0.00000
245 136 79 245 136 79 [ 6] +0.99922 ( +0.92157, +0.06667, -0.38039 ) +1.00000 ( +0.92321, +0.06987, -0.37790 ) 2.28326
233 146 196 233 147 196 [ 6] +0.99718 ( +0.82745, +0.14510, +0.53725 ) +1.00000 ( +0.82806, +0.14999, +0.54020 ) 4.31214
238 140 188 239 141 188 [ 5] +0.99292 ( +0.86667, +0.09804, +0.47451 ) +1.00000 ( +0.87271, +0.10401, +0.47703 ) 6.83072
233 136 197 234 137 197 [ 7] +0.99310 ( +0.82745, +0.06667, +0.54510 ) +1.00000 ( +0.83349, +0.07262, +0.54775 ) 6.74132
254 141 124 254 141 125 [ 6] +0.99817 ( +0.99216, +0.10588, -0.02745 ) +1.00000 ( +0.99374, +0.10938, -0.02257 ) 3.48514
254 134 132 255 135 132 [ 6] +0.99409 ( +0.99216, +0.05098, +0.03529 ) +1.00000 ( +0.99753, +0.05876, +0.03847 ) 6.24797
254 128 137 255 128 138 [ 7] +0.99496 ( +0.99216, +0.00392, +0.07451 ) +1.00000 ( +0.99665, +0.00455, +0.08168 ) 5.76905
250 141 98 251 142 98 [ 7] +0.99391 ( +0.96078, +0.10588, -0.23137 ) +1.00000 ( +0.96661, +0.11154, -0.23071 ) 6.33577
239 137 67 239 137 67 [ 5] +0.99774 ( +0.87451, +0.07451, -0.47451 ) +1.00000 ( +0.87842, +0.07529, -0.47191 ) 3.86301
240 136 69 240 136 69 [ 6] +0.99675 ( +0.88235, +0.06667, -0.45882 ) +1.00000 ( +0.88585, +0.06924, -0.45877 ) 4.62367
213 128 33 213 129 33 [ 5] +0.99952 ( +0.67059, +0.00392, -0.74118 ) +1.00000 ( +0.67444, +0.01062, -0.73825 ) 1.83152
206 132 27 206 132 28 [ 6] +1.00081 ( +0.61569, +0.03529, -0.78824 ) +1.00000 ( +0.61931, +0.03756, -0.78425 ) 0.00000
199 134 22 199 135 22 [ 6] +1.00088 ( +0.56078, +0.05098, -0.82745 ) +1.00000 ( +0.56412, +0.05617, -0.82378 ) 0.00000
140 164 248 220 128 216 [ 3] +0.99236 ( +0.09804, +0.28627, +0.94510 ) +1.00000 ( +0.72236, +0.00644, +0.69148 ) 43.43275
Again, the problem vertices are in red. Since the tangents are orthogonalized via Gram-Schmidt to the normals, anything wrong in the normals gets transferred to the tangents. Finally, here's the first twenty-five binormals:
Code:
131 254 120 131 255 121 [ 6] +0.99428 ( +0.02745, +0.99216, -0.05882 ) +1.00000 ( +0.02766, +0.99814, -0.05432 ) 6.13844
162 247 100 162 247 100 [ 7] +0.99909 ( +0.27059, +0.93725, -0.21569 ) +1.00000 ( +0.27108, +0.93817, -0.21529 ) 2.44175
172 246 127 171 247 126 [ 2] +0.99279 ( +0.34902, +0.92941, -0.00392 ) +1.00000 ( +0.34378, +0.93898, -0.01128 ) 6.91230
123 254 137 124 255 137 [ 7] +0.99558 ( -0.03529, +0.99216, +0.07451 ) +1.00000 ( -0.02916, +0.99672, +0.07547 ) 5.40326
129 254 112 130 254 113 [ 8] +0.99965 ( +0.01176, +0.99216, -0.12157 ) +1.00000 ( +0.01571, +0.99333, -0.11424 ) 1.59825
129 254 116 129 255 117 [ 7] +0.99632 ( +0.01176, +0.99216, -0.09020 ) +1.00000 ( +0.01205, +0.99625, -0.08565 ) 4.92648
132 254 123 133 255 123 [ 7] +0.99341 ( +0.03529, +0.99216, -0.03529 ) +1.00000 ( +0.03936, +0.99873, -0.03142 ) 6.58847
113 254 130 113 254 131 [ 6] +0.99885 ( -0.11373, +0.99216, +0.01961 ) +1.00000 ( -0.10998, +0.99362, +0.02499 ) 2.77893
122 254 133 122 255 133 [ 6] +0.99403 ( -0.04314, +0.99216, +0.04314 ) +1.00000 ( -0.04136, +0.99809, +0.04600 ) 6.26637
140 251 154 141 251 154 [ 5] +0.99551 ( +0.09804, +0.96863, +0.20784 ) +1.00000 ( +0.10362, +0.97234, +0.20934 ) 5.43685
123 254 130 123 255 130 [ 8] +0.99298 ( -0.03529, +0.99216, +0.01961 ) +1.00000 ( -0.03198, +0.99929, +0.02017 ) 6.79705
119 254 131 119 255 131 [ 6] +0.99477 ( -0.06667, +0.99216, +0.02745 ) +1.00000 ( -0.06354, +0.99755, +0.02921 ) 5.86489
57 181 219 58 182 219 [ 6] +0.99841 ( -0.55294, +0.41961, +0.71765 ) +1.00000 ( -0.54745, +0.42407, +0.72143 ) 3.25792
80 227 190 81 228 191 [ 5] +0.99403 ( -0.37255, +0.78039, +0.49020 ) +1.00000 ( -0.36554, +0.78690, +0.49717 ) 6.29087
99 249 153 100 249 154 [ 7] +0.99903 ( -0.22353, +0.95294, +0.20000 ) +1.00000 ( -0.21876, +0.95369, +0.20644 ) 2.56410
118 227 206 118 227 207 [ 6] +0.99681 ( -0.07451, +0.78039, +0.61569 ) +1.00000 ( -0.07191, +0.78123, +0.62009 ) 4.58260
118 250 160 119 250 161 [ 6] +0.99681 ( -0.07451, +0.96078, +0.25490 ) +1.00000 ( -0.06675, +0.96356, +0.25904 ) 4.60343
126 254 133 126 255 134 [ 7] +0.99316 ( -0.01176, +0.99216, +0.04314 ) +1.00000 ( -0.00860, +0.99875, +0.04926 ) 6.71420
144 197 232 144 198 232 [ 7] +0.99279 ( +0.12941, +0.54510, +0.81961 ) +1.00000 ( +0.13290, +0.55159, +0.82346 ) 6.88748
156 229 197 156 230 198 [ 5] +0.99037 ( +0.22353, +0.79608, +0.54510 ) +1.00000 ( +0.22718, +0.80300, +0.55098 ) 7.95746
137 248 165 137 249 165 [ 6] +0.99261 ( +0.07451, +0.94510, +0.29412 ) +1.00000 ( +0.07790, +0.95257, +0.29418 ) 6.97467
208 192 202 208 192 202 [ 5] +0.99798 ( +0.63137, +0.50588, +0.58431 ) +1.00000 ( +0.63283, +0.50676, +0.58542 ) 3.63939
187 227 179 187 228 179 [ 6] +0.99496 ( +0.46667, +0.78039, +0.40392 ) +1.00000 ( +0.46715, +0.78519, +0.40651 ) 5.75704
158 247 156 158 248 157 [ 6] +0.99279 ( +0.23922, +0.93725, +0.22353 ) +1.00000 ( +0.23946, +0.94368, +0.22832 ) 6.88633
167 242 88 148 251 105 [ 3] +0.99922 ( +0.30980, +0.89804, -0.30980 ) +1.00000 ( +0.15774, +0.97206, -0.17384 ) 12.66437
Oddly, even though I've outlined the two problem vertices in red, it's not
really that much of a problem for the binormals, indicating that the
discrepancy is a rotation about the binormal axis, whatever that means.
What does this mean in-game? I don't know, here's a picture of the mailed
knights in custom battle (unimaginative, but the lod0's again are the ones
with the broken lances):
They look ok but I'm not sure what I'm looking for. I should mention that
the tangents and binormals for CA's original data contain runs of the RGB
triples 127, 127, 127, which when inverse cube normalized become the zero
vector meaning they have a degenerate tangent space basis. What this
implies for lighting/texturing I have no idea. Since all the higher lods don't
have these bases vectors it probably isn't important.
All I've got for now.
KE
Bookmarks