- Home /
A way to "fold" a texture on a mesh?
I want to create an effect of inserting a texture on a mesh, like if you were sticking a stamp on a cube.
Please note that this is not a texture projection: in a projection the texture is scaled to fit the projection area, in my case I can't change the texture area. This is a projection:
See how the smiley is being stretched in the right side of the cube? This is not what I need.
What I need is to "fold" the smile texture. The only way I thought of doing this is having a mesh with the smiley and somehow frame (mold) it on the cube, like a cloth. How do I do it? Is there an easier way?
Update:
One important thing I forgot to mention. A simple solution would be to copy one texture into the cube's texture by using GetPixel
and SetPixel
. Unfortunately this doesn't work in my case, since the cube UV mapping has each face pointing to a different part of a texture atlas. So, when I use this technique I end up with half smiley in the right face and the other half somewhere else.
Answer by Broheim · May 29, 2013 at 04:25 PM
maybe you should consider using a second UV-set. you will have to write a shader to blend the smiley with the second uv.
[EDIT] here i created an image with my awesome photoshop skills. it's just to elaborate, not sure if this is what you need. left one might be any uv set, right uv-set allows folding of a picture on the side of a cube
[1]: /storage/temp/11542-smileycube.jpg
If I understood what you propose, I think I still would have the problem: if the uv mapping were to a texture where every face is connected (an ordinary un-wrap of the cube), the problem would still happen in the edge of the textures, that is, even then not all faces are connected. Is that what you thought?