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 Ennaxor · Sep 25, 2018 at 01:28 PM · shadersspriteslinerenderermask

Mask intersection between Line Renderer and Sprite (Shaders)

Hi there!

I'm having an issue I'm not quite sure how to resolve, so I decided to post it over here.

I'm working with Line Renderers and Sprites (using tk2d), each one of them having their own materials and colliders. What I need is to find the way to hide the parts of the Line Renderer that aren't in contact with the Sprite, meaning that the Sprite has to stay just like it is and the LineRenderer must show its material only on the segments that are colliding with the Sprite (the remaining parts must have their alpha set to 0).

In the following images you'll see what kind of materials they currently have:

alt text Sprite alt text Line Renderer

My case applied in images: The red cone is the sprite that is a trigger and the line renderer is the gray spline that is created between the two green dots: https://gyazo.com/e597518757a0d6801f7f8a1e17db1599

The collider of the sprite occupies the entire red area that I show in the following image. The clearest blue on the line renderer is the segment that MUST have the desired material visible, while the darkest blue is the part which should be transparent: https://gyazo.com/80a1980b88350df8438e3bbb8eb96821

Just like this: https://gyazo.com/5fe3032229bfed54d6b6b5fa84fdcb30

I haven't found many answers to a situation like mine. I think it's likely that the solution is going to be Shaders, but I have almost no knowledge on them. I'm guessing I must have two different shaders, one of them acting as a mask but... How do I apply this with Line Renderers?

Thanks a lot for your help in advance! I hope I've explained enough my case.

compass.png (52.3 kB)
c8597a29a3c5245a137d4d42114af00e.png (48.7 kB)
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

0 Replies

· Add your reply
  • Sort: 

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

102 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sprite Masks not working in Build 0 Answers

How can I obscure a 3D object behind the AR marker with ARToolkit and Unity? 0 Answers

Help Turning Sprites into 3D Objects and Casting Shadows 1 Answer

Alpha masking multiple 2D Sprite GameObjects with 1 Sprite GameObject 0 Answers

Need some help with sprite-masking or similar solution 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