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 Justinger · Jan 08, 2018 at 07:43 PM · shaderglowbloom

Glow/Bloom replacement shader alpha problem

I wish to add some object specific glow/bloom effects to my game for things like energy beams, special items and health pickups. I have created a heart (health pickup) that utilizes vertex displacement to give it a neat dynamic rippling effect as well as an overall heartbeat.

I then have a replacement shader that looks for tag "glowable" for items to render. This leads to ALL other render types not rendering, and my glow appearing "through walls".

alt text


This really leaves me with two problems.

1. Glows appear on top of everything, of course.

2. My override shader is going to try to make every "glowable" object beat like a heart, rather than obeying each item's unique vertex animations.


Does anyone know if there is a way to directly inherit deformed vertices inside a replacement shader? I am able to access property values and textures, but for the life of me I can't find a way to say "please inherit my source shader's vertices." Also, I'm considering trying a #if defined(IS_HEART) in my replacement shader to attempt to distinguish between object types, but I'm afraid this will be inefficient.


Is there perhaps just a better way to approach this? Thanks very much for any insight you may have.


In case it helps, I was starting from the method from this video: https://www.youtube.com/watch?v=SMLbbi8oaO8

Update: I've made some progress. I found that rather than adding a new keyword of "glowable" I should instead give it a custom rendertype like "RenderType" = "GlowableHeart" or "GlowablePowerup" or just "Glowable". Then, in my replacement shader I make a new subshader for each of these new rendertypes I have made up. The subshaders allow distinct shader code for each type (like the heart should beat, but a powerup would have no vertex animation, for example). Then I made a subshader of "opaque" that just renders black. This lets other geometry cover up the glow effect. Almost there!


This lead me to another problem. My main shader is a surface shader. When I created my replacment shader, I made it a simple frag shader. When animating the vertex displacement inside the v2f vert function resulted in inverted displacement, as well as it being SLIGHTLY incorrect. I inverted the movement, and ignored the slight displacement discrepancy because it is going to be blurred.

However, something is wrong with the depth pass now. When the vertex animation contracts, it causes an error and puts pieces of the heart in FRONT of other geometry it shouldn't be. As though it is poking through, when in reality it is several feet behind the geometry. My assumption is that this is a depth pass error. I have tried adding "addshadow" to the vert pragma. I have also tried making my own entry into Internal-DepthNormalsTexture, but no luck. Does anyone know what I am doing wrong? Clearly when I move vertices inside of a frag shader I am missing a step leading to errors.


I did find a workaround. I redid my replacement shader as a surface shader, recreated the same vertex animation from my main shader, and now there are no depth problems AND the profile seems to match perfectly. I imagine this isn't as streamlined as doing a simple frag shader, but it definitely works. I would still love to know how to properly do vertex animated fragmentation shaders.

glow-problem.png (173.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

73 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

Related Questions

Unity 5 2D Bloom Effect? 2 Answers

Glow Effect 3 Answers

Glow/bloom in Mobile Unity? 0 Answers

Glow and Bloom Effects on iPhone 3 Answers

2D Glow/Bloom effect 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