Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
4
Question by Joshua · Apr 12, 2011 at 02:07 AM · lightflare

Draw a flare from inside a solid object.

Is there a way to have a flare show up on your camera if that flare is send from a lightsource inside a gameobject, in my case a sphere.

I've tried setting the culling mask and read docs on lightsources, but I can't find anything on this. I understand this is not the way you're supposed to use flares but it would be a perfect fix for a problem I'm having.

Many thanks in advance!

Edit: Added a bounty because I think the answer might be very relevant to other users as well - even though it's not really important to me anymore atm. Please do only answer if you have an answer, and not just a guess hoping to get the points ;)

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

4 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by AngryOldMan · Apr 20, 2011 at 08:37 PM

You could parent the object emitting the lens flare to the sphere object at it's forward axis point and then script the sphere it lookAt the player. The lens flare would follow the player round the outside of the sphere, effectively.

Comment
Add comment · Show 1 · 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 Joshua · Apr 20, 2011 at 09:12 PM 0
Share

Whow, intelligent workaround! Thanks!

avatar image
3

Answer by Daniel 18 · Apr 19, 2011 at 07:14 AM

I might have a good enough answer for you. If the object you have the light within has no collider, the flare works. If you needed a collider on that object then I'm not so sure. This suggestion also works with lens flares attached directly to the object. Hope this helps.

Cheers,

Daniel

Comment
Add comment · Show 2 · 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 Daniel 18 · Apr 19, 2011 at 07:23 AM 0
Share

Incidentally, the flare is visible if you are within the collider area, or if the collider is not obscuring the flare.

avatar image Daniel 18 · Apr 19, 2011 at 07:25 AM 1
Share

Further, setting the geometry to the TransparentFX layer seems to do the trick. Works with colliders and everything. Again, hope this helps. Cheers, $$anonymous$$

avatar image
2

Answer by efge · Apr 19, 2011 at 07:21 AM

You could edit the builtin shader (Internal-Flare.shader) and adjust the rendering order with a queue tag and/or play with the ZTest and ZWrite settings. I will make a test and edit this "answer" and add the results.

I also noticed the "collider-effect" (see Daniel's answer) but for me it seems more like a bug?!

Comment
Add comment · Show 2 · 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 Joshua · Apr 20, 2011 at 10:23 AM 0
Share

Cool! Can't wait. :-)

avatar image synapsemassage · Apr 21, 2011 at 11:52 PM 0
Share

I don't think it's a bug. Actually, it makes sense. Terrain and buildings for example, usually have colliders and usually you want flares stopped by these, as sunlight is not passing through either.

avatar image
0

Answer by KGC · Nov 17, 2016 at 02:24 PM

You can add the flare component to an empty gameobject rather than a point light. Then you'll have access to a layer mask to control what layers block the flare. See the original answer here: http://answers.unity3d.com/answers/238164/view.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

2 People are following this question.

avatar image avatar image

Related Questions

Script flares onto lights? 1 Answer

Disabling lights collision 2 Answers

Display Flare from a large object (sun) 0 Answers

How to make Lights for a car? 1 Answer

Light with Flare not working 1 Answer


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