LDraw.org Discussion Forums
"Wrapping" Tool - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: Parts Author Tools (https://forums.ldraw.org/forum-24.html)
+--- Thread: "Wrapping" Tool (/thread-15436.html)

Pages: 1 2 3

"Wrapping" Tool - Gerald Lasser - 2015-02-04

Before I start my own rudimentary coding, I thingk I better ask.

I am looking for a tool that allows me to wrap Stickers around a certain shape, e.g. the Santa Fe front sticker, some Panels etc.
If those stickers are made from the scanned sheet itself some distortion will occur, proper rotation of the destination part will reduce these effects when using SlicerPro.

Howver with Stickers "around the corner", like the Santa Fe one, the result is too distorted. The output gets streched too much to be visually pleasing.

Now I though of doing a small script that "bends" the sticker along the edges that the parts provide. For the Santa Fe thsi would be the outer surface of the 6005.dat

The question is if somebody has already done such a tool or which tool can do this?



Re: "Wrapping" Tool - Michael Horvath - 2015-02-04

Have you tried removing the sticker from the part and then scanning it?

Also, if you plan on using POV-Ray, then a distorted image might actually be what you want. If you project the scanned image onto the 3D part, then the result may look like the real thing.

Re: "Wrapping" Tool - Max Martin Richter - 2015-02-04

he wants to do the other way around. Create a plain Sticker (from a Sticker Sheet) and add it to a bent surface. Actually it results in a heavy deformed pattern, when it is bent too much. So we need something that will bent the sticker automatically without stretching it.

My basic idea would be:
1. get the edge coordinates
2. move this edge 0.25 LDU to the outside (this must be calculated as a simple movement doesn't work here)
3. rotate the pattern until it is planar with the most outside edge
4. break the pattern at the line, where the edge line is bent for the first time
5. rotate the rest of the pattern until it is planar with the next edge
6. break the pattern at the line, where the edge from step 5. is bent.
7. redo steps 4, 5 and 6 until all areas of the pattern are bent correctly.
8. create the outside border of the sticker (90° to the pattern sides)
9. create the underside (maybe as a cutout of the part where the sticker should be applied)


Re: "Wrapping" Tool - Philippe Hurbain - 2015-02-04

No such tool exist AFAIK - and it would be useful. In the past I used the cut/rotate/move solution using simsplitter and MLCad, but it's tedious at best!

And if you are in the mood of heavy coding, think of the more general problem of patterned foldable canvas such as tepee!

Quote:For the Santa Fe thsi would be the outer surface of the 6005.dat
Don't forget sticker thickness Wink

Re: "Wrapping" Tool - Gerald Lasser - 2015-02-04

That are exactly the steps as I wrote them down :-)

Re: "Wrapping" Tool - Gerald Lasser - 2015-02-04

The problem with my mood for heavy coding is the output, it will be in VB... but I will try it. ...and look into something more efficient language in the future...

I won't forget the 0,25 LDU!

PS: that could be a feature for Nils' Part Editor :-)

Re: "Wrapping" Tool - Max Martin Richter - 2015-02-04

Adapting to C or C++ should be possible afterwards... ;-)

Re: "Wrapping" Tool - Ben Supnik - 2015-02-04

Gerald Lasser Wrote:Now I though of doing a small script that "bends" the sticker along the edges that the parts provide. For the Santa Fe thsi would be the outer surface of the 6005.datGerald

Here's the $10,000 question: what will your program do if the sticker cannot be placed on the part without a wrinkle or bend?

For the case where you'd want to apply a sticker (e.g. a rectangular sticker around a curved top surface or curved arch top) there exists a good 'wrap' to make this happen.

But what about a part like 86500.dat (Dome 4x4 Smooth)? A sticker on the top would in real life be a wrinkled mess; the planar sticker can't cover the top well.

Or what about the front of the Maersk engine? There is a sticker covering a series of cheese slopes. In real life it works pretty well, but a computer program might be fooled by the small vertical edge of the cheese slope which interrupts the implied smooth surface.

The problem with coding this (as I see it) is that LDraw does not provide -guarantees- about the connectivity of a mesh. Even for a case that can work right (e.g. 6192.dat Brick 2x4 with curved top) the file format does not guarantee that the top smooth surface can be identified as continuous without gaps. There may even be small caps that must be covered with rounding due to problems with part authoring and rounding in the matrices of the primitives.

If I had to code this I think I would (I suppose) look at something like this:


Least Conformal Squares is one of the common ways that 3-d programs provide texture maps to arbitrary surfaces. I -think- that if the surface is good for stickering (e.g our curved tops) the UV map should have no distortion. The nice thing about an algorithm like this is that, if the sticker can't lay perfectly flat, it gets it as close as it can, so you don't have to deal with total algorithm failures due to rounding errors.

Once you have a "UV" map (a 2-d mapping of the sticker's X and Y space) over the part, you can then, for each triangle in the 3-d mesh, locate its place over the sticker, cut out a series of sub-triangles in the sticker, and place them in 3-d space. Because each triangle in the real 3-d part is (by definition :-) planar, applying the set of planar sticker sub-triangles doesn't require anything complicated.

Uh, I hope this isn't too discouraging. Unfortunately wrapping planar labels around arbitrary 3-d surfaces is complicated. Perhaps there could be some way to simplify the problem, e.g. have the user specify the cross-section of the curved surface the sticker will be placed on, then apply it. This would let you work from mathematical input data that is much more suited for your purpose than "triangle soup".


Re: "Wrapping" Tool - Orion Pobursky - 2015-02-04

I'd just work on the simple case of planer surfaces, open the code, and either get back to the hard cases later or let someone else give it a whirl.

Re: "Wrapping" Tool - Gerald Lasser - 2015-02-04

Thanks for your thoughts! I really do not want to touch surfaces bent in two directions. Of all the LEGO stickers I have thought of and I check right now (e.g. Wedge 52031) that ight seem to be bent slightly in two directions are actuall not. These surfaces are planar.

I came across the problemfirst when projecting a circle onto a bent surface, e.g the new Artic Logo onto the Curved Slope 15068. The "normal" projection distorts the logo, however if you rotate the slope in a better porition the projection issue is not that apparent. Another thing is how LEGO prints them, positions them etc.

The real issue comes with something like the Santa Fe. But for this case the edge line of the front part is enough to do the job. And even if I have to extract it manually from multiple part as it is a STAMP case (as the MAERSK Engine)

I will try something along this path, "bending" a sticker along a given line. For sure there is manual work involved as well, but for a start I think I will be fine with this low-fi approach first.