Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by alvaromartinlop · Jan 05, 2016 at 08:29 AM · shader2d gamespriterenderer

Sprite Renderer Boundaries

Hi,

Unity newbie here.

I am trying to add a white outline to a sprite I have dragged and dropped to my scene.

I am using a shader for the outline.

When I increase the shader outline width property, The outline get's clipped because it doesn't go beyond the sprite renderer boundaries.

gif

How can I fix the issue so that the the outline is visible?

I don't know how to increase the bounds of the sprite and add padding to it so that the outline fits properly.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SojaBird · Jun 30, 2016 at 02:29 PM

Hey @alvaromartinlop,

I have the same issue and have not yet been able to find a solution. So far it seems to me that sprite renderers are limited to only draw anything inside the boundaries of the sprite. A solution (though not perfect) would be to add a padding to your sprite so that there is extra space in the renderer where the outline can exist. You can do this in any graphicsrogram (such as Photoshop or Gimp). Just load up the image and increase the canvas/field size. In case you are using a multiple-sprite Atlas, you can increase the bounding box of your sprite in the sprite-editor. Just increase the boundaries box of the sprite by dragging the sides or using the inspector.

An other option would be to, instead of an outset line, make it an inset line. This will change the look as it will sacrafice the outer pixels but you will be sure that it will all show.

Good luck, keep searching.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by tanoshimi · Jun 30, 2016 at 05:05 PM

It's not really a limitation of the sprite renderer - a sprite is a mesh just like any other object placed in your scene. When it looks like you're "expanding" the sprite with a white outline, all you're really doing is replacing some transparent pixels on the texture assigned to that mesh with some opaque pixels instead. But when this object is sent to the graphics card, it wont's affect pixels outside the boundary of the mesh.

To add more transparent pixels around the border of the sprite, try setting the sprite border on the texture importer; https://docs.unity3d.com/ScriptReference/TextureImporter-spriteBorder.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity 5.4 - Sprite Shadow 0 Answers

Outline set of tiled sprites 0 Answers

Real soft shadow vs "illusion" shadow 0 Answers

2D | Material Shader - How to adjust value of material by slider? 2 Answers

Can only the material set on a SpriteRenderer be affected by a unique 2D light ? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges