Wingnut goofin’ around with his boxify() function. It opens SOME potential for manually hacking the uvs.
There may be OTHER problems with manually-adjusting the uvs. For example, the upper left corner of the window hole… has ONE 2-value (x/y) UV. IF you change it so that the within-the-hole faces have good-looking texture-map, that will also affect the outside wall texture mapping. The uvs on that upper-left window point… are used for 2 purposes, right? Mapping the outside wall texture, AND mapping the inside-the-hole faces. (actually, 3 purposes. Outside wall, inside hole left face, and inside hole top face.)
SO… wallWithHoles would need… um… convertToFlatShadedMesh() call first… and then there would be 2-3 points (vertices) at that window corner… and thus 2-3 uvs to adjust.
https://playground.babylonjs.com/#FYR1JC#16 (convert done in line 91). After that call, the total number of verts… goes from 160 to 320, and total uvs goes from 160 to 336. The boxify() function doesn’t have a feature to show multiple points in same positions, so the box #316 at upper left window corner… might have another box or two under it. The convertToFlatShaded() call MUST add points… in order to accomplish flat-shading. It may have added points at our #316 box position (likely, it added 2 points for a total of 3 at window upper-left-outside point). (mistakes likely, I’m a noob)
IF there are multiple verts at #316 box position (probably 3), then… um… ONE of the points must have UVs set properly for outer-wall texture mapping, and another must have UVs proper for LEFT FACE of inside-the-hole texture mapping, and a third must have UVs set for TOP FACE of inside-the-hole texture mapping. Hard work (unless you are driving a modeling software package).
Alternatives? 8 small, textured planes (precisely positioned) would handle this issue, too (actually, 4 planes and 4 instances of those). Lamination. These 8 “fascia planes” would give full power texturing for the inside-the-hole faces… complete freedom to make the material be something different from the rest of the wall (like a white COLOR instead of wood texture). A bit more overhead, but < 1kb added, I’d guess, and no convertToFlatShaded() needed, so you might save performance in the long run.