- Home /
2D Sprite round corners
Hi all,
I am trying to create a tiled sprite with round corners with a dynamic width. See image attached.
The challenge here is the fact that the tiling goes on until the corner itself. Here's the thoughts I have so far:
1 - Mask shader http://wiki.unity3d.com/index.php/TextureMask . But this doesn't work because I want to stretch my image. Somehow I'd like to 9-slice the shader... If that were possible.
2 - Round-corner shader. I'm no shader expert but I guess I could draw/not draw pixels based on the y-coordinate, using a sine-function to make it round. That's what I'll try to figure out now.
3 - Create separate sprites&materials for the corners, making them masked and automatically updating the sides based on the width of the centre sprite (anchoring). I could update the material offset based on the width of the sprite, so it would connect to the middle piece smoothly.
Cheers
Answer by DESTRUKTORR · Aug 14, 2014 at 12:44 AM
The best method I could think of for this would need to be a GUITexture with the top and side borders (at least) set to the radius of the curve.
Your answer
Follow this Question
Related Questions
Sprite masking 3 Answers
Create a shader using mask for sprite 1 Answer
Multiple sprite mask 0 Answers
Why is my picture distorted? 0 Answers
Sprite Renderer Interaction Between Two Sprite Masks? 0 Answers