Hey, I used the CreateTiledBox method created a tiled box,defined the faceColors property in the options,but if the tileSize was not equal to the size,the box render with errors and webgl report warnings on the console panel.
Here is the demo:
Hey, I used the CreateTiledBox method created a tiled box,defined the faceColors property in the options,but if the tileSize was not equal to the size,the box render with errors and webgl report warnings on the console panel.
Here is the demo:
Checking!
I have no error in the console
I can not repro either
Oh,I see what happend,I tested this demo on MacOS using Edge,and I changed the platform to Windows,eveything was normal
The WebGL error is caused by an issue in the part of the code which builds the vertex positions.
The mesh from the PG has 2400 / 3 = 800 vertices What?
Since the color buffer is built correctly with the correct size but the positions buffer is overpopulated the buffer sizes just donāt match up. MacOSās Metal is quite unforgiving on this thus you see the error. Windows just doesnāt give a f*ck about it.
Quick fix:
Omit faceColors
from the options. Since you set it to white itāll do no harm.
Permanent fix:
We have to check what is happening with the vertices, why are there so many of them.
@sebavan @Deltakosh Iāll take care of it.
Thanks for your help
I just wanna share my progress: It seems that sideOrientation: BABYLON.Mesh.DOUBLESIDE
not doubles but quadruples the number of faces.
Yes, I found the same problem when I changed this property in a previous test
I see something from the souce code when tiled box process the sideOreintation.At first it used CreateTiledPlaneVertexData method processed the sideOreintation already,and then at the end of the source code of the CreateTiledBoxVertexData it process the sideOrientation again,right?
I love you
Enough to share your Netflix pwd?
Man! I think we reached that point now! Iām ready!!
Netflix is basic. If you really loved me, youād hand over your Hulu account.
We are not yet there but keep courting me and maybe we can
Only a few hours in and youāre already acting like the long-suffering partner LOL
The problem is that after the whole tiled box is constructed using multiple calls to CreateTiledPlaneVertexData
this function is called VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs)
which as you can see takes into account the sideOrientation
parameter. If itās set to VertexData.DOUBLESIDE
it doubles the vertex positions once again.
Since we get everyting (positions, normals, uvs) prepared from the CreateTiledPlaneVertexData
function calls, I believe that extra call to _ComputeSides
can be safely removed.
I also optimized another part of the code and got rid of the awful map
and reduce
calls and rewrote that part of the code to be faster and much easier to understand.
Now there was another problem. Each side of the box can be subdivided into multiple faces (controlled by tileSize
, tileWidth
, tileHeight
). The original implementation didnāt take this into account. It treated the mesh as it had always only one face at a side. I fixed this issue as well. Iām curious for how long wasnāt this nasty bug discovered⦠Seems no one uses tiled boxes
PR on the way:
@Deltakosh I made several tests, seems to be OK. I hope I didnāt screw anything. However, as you already know Iāll be on vacation starting tomorrow so if I f*cked up something please be so kind and take care of it, honey When I come back Iāll cook you something yummy and maybe Iāll take you to the cinema as well
Wow,thanks,have a good vacation!