Jump to content

Triangle Hollow Shape affects angle of Path Cut ?


You are about to reply to a thread that has been inactive for 3153 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I didn't think I still could be surprised by a prim, but this was unexpected:

Start with a big Box prim.

Path Cut it to begin at 0.375 and end at 0.625. Nice little quarter-box, right? Cut faces make a nice right-angle corner with each other.

Hollow it out, oh, say 30%.

Now switch the Hollow Shape to Triangle and watch what happens to that nice right-angle corner.

With the Triangle hollow shape (only), the cut faces are perpendicular with path cuts closer to 0.370 / 0.630 instead of 0.375 / 0.625.

Is there some reason this makes sense? Has everybody else known about this all along? Is it documented somewhere?

 

Link to comment
Share on other sites

Oddly-enough, yes, the only time I have ever used a triangular hollow section in a cube is to make a chamfered piece, a bevelled-edge, and I found when butting pieces up that the previously-square cut faces were now slanted, and I had to tweak the path cuts.  I don't know why it's doing it, though, because the angle of the internal triangular face is 315 degrees, therefore the obtuse angle to the cut face ought to be 135 degrees, instead of the 130 that actually results. If it were a smaller amount than 5 degrees I would have suspected some sort of rounding error in the maths.

 

What *I* could never understand about the triangular hollow section was why they had chosen the particular alignment of the triangle, I wonder if that has a bearing on this?

 

Is this worth the pain of a JIRA?

Link to comment
Share on other sites


Is this worth the pain of a JIRA?

Thanks for the response. I'll leave this here for a day or so in case somebody with deep knowledge of prim history can 'splain it all to us. If not, I'll file a Jira just to get it documented somewhere -- without proposing anything be "fixed" now and break untold existing content.

Link to comment
Share on other sites

The cut parameter is a proportion of the perimeter of the profile, for both the outside and inside. This is not the same as that proportion of the 360 angle around the centre, except in the case of the circle. Presumably the reason for choosing perimeter rather than angle is that it avoids uneven stretching of textures (although that could theoretically have been corrrected with some complicated non-linear UV map calculations*). The result of that choice is that the angles are not generally the same for a given proportion of the perimeter when the outside and inside profiles are different shapes. Consequently the face bridging the cuts are not generally aligned along radii from the center.

In the picture below, there are circle, square and equilateral triangle with the same centre and with the point at 1,0 (right middle) coinciding. That is the zero point for the cut. The perimeters are subdivided into the same number (24 here) equal lengths, and the joining points are connected to the centre. You can see that in most cases the equivalent subdividing radii do not coincide between different shapes, so that the cut between these positions will be angled. There are exceptions, including the zero point. In particular, the radii to the corners and the middle of the sides of the square all coincide with equivalent radii of the circle, so that circle-square combinations always have nice "square" cut edges at these angles. In contrast, the triangle radii coincide only at the three corners and directly opposite the zero point, for the circle, and only at zero and exactly opposite for the square. So there are rather few few nice "square" cuts if either profile is a triangle.

I suppose the "reason" for the orientation of the triangle is simply the result of starting both profiles off at the same zero point.

holeinterpolation.png

*ETA: On reflection, I think this would only work approximately, as the correction has to be discontinuous. So it probably really is necessary for acceptable texturing of the inside of the hollow.

ETA2: At first sight, it looks as if there is another triangle-square coincidence at about +/- 100 degrees, but if you count the radii going round from the zero point, this is the sixth for the triangle and the seventh for the square. So in fact, this is nearly the most extremely non-squared off cut.

ETA3: oops. a minor correction... tri/circle coincidences mare than tri/square.

Link to comment
Share on other sites

Here's another way of looking at the cube with triangular hollow. The spinners in the edit dialog inworld increment the cut by 0.025 (1/40) per click. The lines on the sections in the first picture connect the points at each 0.025 step on the perimeter of the cube and the triangle, starting from the highlighted zero position. These are where the cuts appear at each step. The blue parts show the remaining solid with the beginning and ending cut parameters shown. These are all the four that would give nice square-cut quarter cubes if the hollow was square. (Actually, the bottom right one has to be two pieces, as the part remaining after the cut can't pass across zero.) The top left is the one from the original example in the thread.

trihole.png

The four cubes with these cut parameters are shown inworld in the next picture (the bottom right one is two prims). It is clear that they match exactly the sections above (which were constructed in Blender). None of them has nice cuts along radii from the centre.

trihole.jpg

Link to comment
Share on other sites

Here's one more picture. Some outside/inside combinations. Highlighted yellow cut lines are those that coincide with the cuts when both are the same shape. All lines at steps of 1/40 of the perimeter lemgths, corresponding to spinner clicks. I also checked in the source code that it does ideed linearly interpolate the perimiter.

holes3.png

Link to comment
Share on other sites

Thanks, Drongle, especially for the follow-up posts: before, I'd understood your "perimeter" reference to be the length of an enclosing line, rather than the area of the surrounding shape, so I'd managed to confuse myself pretty thoroughly.

I must admit, however, that I'm still confused by the virtue of this approach, and specifically how it affects texturing. You made a couple references to it:


Drongle McMahon wrote:

Presumably the reason for choosing perimeter rather than angle is that it avoids uneven stretching of textures (although that could theoretically have been corrrected with some complicated non-linear UV map calculations*). [...]

*ETA: On reflection, I think this would only work approximately, as the correction has to be discontinuous. So it probably really is necessary for acceptable texturing of the inside of the hollow.

Surely I'm just confusing myself again, but I can't figure out what this means. Possibly it refers to something deep inside the rendering process that mere mortals can't expect to understand, but to the laity, this isn't intuitive. I mean, I'd expect the same texture appearance could be obtained whether the Path Cut parameters were interpreted as swept angle or "perimeter" profile area, if those numbers were manually tweaked to result in the same shape. So I'm still missing something.

Again, thanks for all the effort explaining this.

Link to comment
Share on other sites

Yes. it's tricky, and I may not be right. As you change the pathcut ends, a texture applied to the inside of the hollow doesn't shift at all. However, if you look in wireframe mode, the mesh (at high LOD) always has 5x3 faces on each of the sides of the triangle or square. These get smaller as you increase the cut, but are aways equally spaced. So it must be recalculating the U-dimension ends of the UV map so that the texture doesn't move, then dividing it in three. So the question of what happens if it uses angle division instead of perimeter division in that context. From the UV maps below, you can see that, except for the perimeter subdivision,  the segments of the map have to be different across these inside faces for the texture to appear flat. In fact, even with these maps there would be some distortion because the variation of stretch is continuous, while the use of UV map approximates that with a series of discrete segments within each of which the stretch is constant. The distortion would be more severe with only the three segments of the inworld prim's mesh, even though the ends have been recalculated. There would also be a jump when it switched to lower LODs (with less segments). So I think it is necessary to use the perimeter subdivision in order to keep even stretching of the texture at all, and probably even more so to avoid it shifting with changing pathcut. That is in addition to avoiding the complicated calculations that would be needed to adjust the UV endpoints when the fitting to the texture space is variable across those inside faces. (Actually, that all applies equally to outside faces, where I don't think we would expect anything other than even stretching of texture along the perimeter, would we?)

For good measure, here are three alternative models. These have 40 segments around inside and outside, many more than the prim meshes (12 for rectangle, 9 for triangle)m which makes the potential for distortion more evident, I think. First the models: all have the zero point of the perimeter on the right. The middle one uses equal subdivisions of both triangle and square perimeters. On the left, the square is still equally divided, but the triangle has divisions radially aligned with the divisions of the square. On the right both are divided at equal intervals around a bounding circle.

holes5.png

Here are the natural UV maps - segment widths proportional to the face widths in the model, to achieve closest approximation to even stretching of the texture over the surface. A seam, becoming the left and right edges in the map, is at the zero point. At the bottom is the inside of the middle model, with even divisions around the triangle perimeter. The highlighted edges are the extra ones where the corner of the triangle doesn't coincide with a 40th of the perimeter.  Next above is the triangle from the right hand model, subdivision at equal angles. At the top is the equally divided square, which is the same in the first two models, and below it is the square with subdivision at equal angles.

holes4.png

However, since the UV maps are generated after the cut end points are calculated, and the are always equal divisions of the perimeter, like the mesh. then the texture will always be evenly stretched. So there won't be a distortion problem. The only problem would be converting the cut angle into the right point in the perimeter/UV space, which would be a bit complicated because the relationship is non-linear, but not impossible.

Link to comment
Share on other sites

Thanks again for the further clarification. I must admit that until your "for good measure" models, I still misunderstood what "perimeter" meant. I got that now. I also see that there might be considerable efficiency win from a straightforward linear transform from the path-cut parameter numbers to the UV extent to be displayed (as opposed to what I suppose would involve at least some trigonometry to project cut angles onto the UV map).

So, yeah, interesting, and thanks again. One remaining question: Is there someplace where this sort of thing is documented, sort of like the scripting part of the wiki but for builders?

Link to comment
Share on other sites

Sorry about perimeter. I should perhaps have said Profile, as that's what it's called in the code and the edit thingy. The usage is a bit inconsistent though. Prims are supposed to be a profile swept along a path, but the distinction can get ambiguous, especially for the cube prim. I'm not aware of any documentation. However, I did find this, which has some interesting things I didn't expect (holes aren't really holes!). It appears the author is an original designer of prims. So if anyone can answer definitively.....

Link to comment
Share on other sites

Drongle,

thankyou for the research, I don't think I would have seen the connection with perimeter. I've been playing with a prim textured with an alignment mesh and managed to see for myself what you've explained. It's also made me realise there must be a derivable formula for calculating the repeats and offsets for each different hollow figure to get a perfect alignment around the hollow texture, whereas in the past I've simply clicked the spinners or tweaked the figures until I got the look I needed.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3153 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...