- Home /
[C#] put an image in the center of a mesh (no repetition)
Hi everyone, I'm searching for a tips for a project : I want to put a PNG in the center of a mesh, with no repetition. I manage to implant the PNG but as a texture, the png is repeted again and again...
For now i've this mesh, and I want to put inside the blue part, a pictogramme (PNG format), just like the next illustration
Thank you for your help :)
Thalitus.
Answer by NoseKills · May 01, 2014 at 09:23 PM
Set the texture (the png in project view) to "Wrap Mode: Clamp". This prevents the repetition.
Then in the Material that uses the texture and is assigned to your object, use the "Tiling" and "Offset" variables to set the right size and position.
I'm sorry, but I didn't manage to do it. I tried so much values of Tiling and Offset.. Is there a better way to do it? Or maybe a tool to do that?
I joined a screen shot so you can see what is my mesh...
The "natural" way of doing this would be to make the whole thing in a 3D modeling program like Blender or 3D $$anonymous$$ax and have the texture put in place there. 3D modeling programs use the same values to match the texture but of course the workflow in them is much more user friendly.
I should have mentioned that the Offset values act as percentages of texture width so if you just tried different integers you probably can't make it match. You should try values from 0 to 1.
If you have a lot of textures you have to match to models you should definitely do the whole thing properly with i.e. Blender...
If you just need to match this one texture, it might help if you made another texture with the same size but more detail than just the single icon (make it have a gradient and stripes for example) and see how it moves when you adjust the values. That might give you a better understanding of how the values affect things.
Your answer
Follow this Question
Related Questions
Add texture with script in edit mode 0 Answers
How can I resize an image and save it to disk ? 6 Answers
Image Sequence Loop 0 Answers
Applying UV to plane mesh is pixel imperfect. 0 Answers
Apply texture on prefab 1 Answer