• Create Account

## How to emboss mesh surface with text (or create raised text on a surface ) by programming?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

121
Like
1Likes
Like

Posted 10 July 2014 - 08:52 AM

Hi Greetings,

I'm not sure whether I post this question on correct forum, if not, please forgive me.

I'm a newbie on graphics or modeling domain, now I'm doing some research on embossing any mesh based surface with Text, like the picture shown: (Which is created by Windows 8.1 APP: 3D Builder )

So the requirement is to implement similar 3D text on a model surface in an application that is developed by Javascript/WebGL. What we have are the triangle based surface, and the 2D text contours. The surface might be a cylindrical or sphere or torus surface.

Since I'm new to both solid modeling and 3D graphics programming, even I have spent several days on this, however, I couldn't find a good algorithm or solution yet. So, I'm posting the question to the great community, I wonder whether someone has the experience to solve similar problem ever, or someone would kindly offer some useful hints, such as any related papers, or related algorithms, or other forums which I post to, etc.  Thanks very much.

(Actually, I've post my questions on stackoverflow, however, no any replies yet. Maybe my question is not properly described or implementing such a 3D text requirement is too difficult.)

Edited by madeing, 10 July 2014 - 08:54 AM.

### #2Ohforf sake  Members

2048
Like
2Likes
Like

Posted 10 July 2014 - 12:36 PM

Well, if I had to implement this, my first approach would be to put the text into a volumetric decal which perturbs the normals, maybe even does some parallax mapping. IIRC, the bullet holes in Fear 1 were done this way and looked really nice. It is fast, easy to implement, but the text can't extend really far.

My second go to would be an implicit surface: Generate an implicit surface for the cylinder, generate one for the (warped and extruded) text, combine both surfaces in their implicit form, and then run marching cubes on top of it. That would produce a crap ton of polygons, no sharp edges, but would be moderately easy to implement.

Only my last option would be to run a full CSG algorithm on polygon data, simply because it seems to be a real pain to get that right. But something tells my that you were asking about the last approach.

What exactly do you need? What quality, does the mesh have to be 2 manifold, etc...

121
Like
1Likes
Like

Posted 10 July 2014 - 08:57 PM

Thanks Ohforf for the hints.

Hmm, yes, what I have are just polygon data, so the last option might be the way I have to go.

Actually, I have a STL file which describes the model as the input, it might have any type of face, might be a planar face, cylindrical surface, or free-form surface.  Then I will create 2D text contours, then I would create a 3D labeling on the surface with some thickness, like a Emboss.    Regarding the quality, it should keep the quality same with the target surface.  The mesh have to be manifold.

### #4Ohforf sake  Members

2048
Like
1Likes
Like

Posted 11 July 2014 - 03:21 AM

For the mesh based approach, there is an article in Game Programming Gems 4 called "Carving Static Shadows into Geometry", that might be a good starting point. Essentially, they cut a mesh into shadowed and non shadowed parts, and darken the color of the former. In your case, you would use the text as the "shadow caster", the base mesh as the "shadow reciever", but instead of just darkening the shadowed area, you extrude it along it's normals. You will however have to find a good projection for the light/text, but that depends on your precise use case.

That said, I would not discard implicit surfaces right away. While being problematic with hard edges, they are probably easier to implement and more flexible.

121
Like
1Likes
Like

Posted 13 July 2014 - 09:43 PM

For the mesh based approach, there is an article in Game Programming Gems 4 called "Carving Static Shadows into Geometry", that might be a good starting point. Essentially, they cut a mesh into shadowed and non shadowed parts, and darken the color of the former. In your case, you would use the text as the "shadow caster", the base mesh as the "shadow reciever", but instead of just darkening the shadowed area, you extrude it along it's normals. You will however have to find a good projection for the light/text, but that depends on your precise use case.

That said, I would not discard implicit surfaces right away. While being problematic with hard edges, they are probably easier to implement and more flexible.

Thanks.  I'll try to find the article and read it.  For implicit surfaces solution,  it should be a candidate. Honestly, since I'm new to graphics, I have to learn some knowledge before I investigate it more.

### #6noisecrime  Members

812
Like
2Likes
Like

Posted 17 July 2014 - 08:49 PM

Do you need the emboss text to actually be part of the input mesh? In other words will you be trying to do something like 3D printing with this afterwards?

If not then the simplest answer would be to simply make the text as a separate mesh and allow it to penetrate the original mesh. This would be the easiest method to implement as it does not involve re-triangulating the original mesh in any way.

If you need a complete solid object, then the other suggests are a good starting point. Just be aware that you're original mesh is going to have to be heavily triangulated to get a decent resolution for the text.

121
Like
1Likes
Like

Posted 30 July 2014 - 09:47 PM

Do you need the emboss text to actually be part of the input mesh? In other words will you be trying to do something like 3D printing with this afterwards?

If not then the simplest answer would be to simply make the text as a separate mesh and allow it to penetrate the original mesh. This would be the easiest method to implement as it does not involve re-triangulating the original mesh in any way.

If you need a complete solid object, then the other suggests are a good starting point. Just be aware that you're original mesh is going to have to be heavily triangulated to get a decent resolution for the text.

Yes, I'm trying to 3D print this mesh afterwards.  Thanks for the suggestion.

After some day's research and prototype, I got a one solution, actually it works:

1. According to the bounding box of 2D text contour, find an area on the original surface which the text will be projected on, name this area as sub-surface.
2. Offset the sub-surface opposite the camera direction by the given thickness which is input by user, and seam a solid by these two surface.
3. Extrude the 2D text contour to a quite large thickness along one direction (usually perpendicular to the face which the text is on, or say along the camera direction) to make sure it will intersect with solid generated in step 2.
4. Do a CSG intersect of solid generated in step 2 & 3, you will get the extrude text part only.
5. a. Do a second CSG union  between the extrude text generated in 4 and the sub-surface in step 1.
Or b. remove those triangles that we produced in step 4  (Because we know that those unwanted triangles have opposite direction against the direction of sub-surface) .

6. Combine the result in step 5 with the original mesh.

The key is CSG boolean operations.  And one remaining issue is CSG performance which is not so good right now, and I'm still working on it.

### #8NagD  Members

112
Like
-1Likes
Like

Posted 28 March 2016 - 11:16 PM

HI Madeing ! I am also working on same functionality.can you please provide more details.

I have to develop using C++,Qt,Opengl on win7.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.