You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using r68. In case of lightmap, if two sets of uvs are defined in json, uvs = [ [primary uv set], [ secondary uv set] ]. The engine either renders weird geometry or generates webgl errors.
The cause is found by faulty increase of face index.
for(i=0;i<nUvLayers;i++){//loop over uv setsuvLayer=json.uvs[i];//assign the json uv set data from json parsergeometry.faceVertexUvs[i][fi]=[];//make array for indices lookupfor(j=0;j<3;j++){//loop over the 3 vertices (or 4 for quad case)uvIndex=faces[offset++];//get faces index.
in a one face case, the last line becomes on first iteration, offset = 0,1,2, on second iteration offset becomes 3,4,5, while the secondary set should still point at 0,1,2.
using r68. In case of lightmap, if two sets of uvs are defined in json, uvs = [ [primary uv set], [ secondary uv set] ]. The engine either renders weird geometry or generates webgl errors.
The cause is found by faulty increase of face index.
in a one face case, the last line becomes on first iteration, offset = 0,1,2, on second iteration offset becomes 3,4,5, while the secondary set should still point at 0,1,2.
fix:
add on top "parseModel" method:
the quad loop becomes:
the 3 vertices case becomes:
Now the engine renders models using 2 sets of uv's with lightmap as expected.
The text was updated successfully, but these errors were encountered: