• 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 SomeRandomGuy · Jul 16, 2013 at 09:03 AM · shaderglow

Glow map shader for Unity basic?

Hi,

So I was wondering, is it possible to create a shader that takes a glow map, much like the self illumination shaders take, but create an effect a bit closer to something like this? (see the webGL demo, playign around with the settings a bit can create a really nice glow effect.)

I'm looking for something like this for a character with a lot of glowing symbols/runes. It'd be nice to use UV coord's for the glow effect.

Is there any way to achieve this in Unity basic?

Thanks in advance,

Nick

Comment
Add comment · Show 2
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 Benproductions1 · Jul 16, 2013 at 11:04 AM 0
Share

Yes you can do it. And yes you can do it in Unity free. The shader language is technically Turing-complete, so you could write your entire game in it. But no, it's not easy and no, unless someone has already released this exact shader for free, it's very unlikely anyone will do it for you (for free)

avatar image SomeRandomGuy · Jul 16, 2013 at 07:21 PM 0
Share

Feared as much, guess I'm off to shader land! x.x

1 Reply

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

Answer by Professor Snake · Jul 16, 2013 at 12:38 PM

In its most simple form, the effect can be achieved with a basic shader, with an added emission map property. Any additional blur effects you might need are not included:

 Shader "Custom/EmissionShader" {
     Properties {
         _MainTex ("Base (RGB)", 2D) = "white" {}
         _EmissionTex ("Emission Map (RGB)", 2D) = "white" {}
         _Bump ("Bump", 2D) = "bump" {}
     }
     SubShader {
         Tags { "RenderType"="Opaque" }
         LOD 200
  
         CGPROGRAM
         #pragma surface surf Lambert
  
         sampler2D _MainTex;
         sampler2D _EmissionTex;
         sampler2D _Bump;
  
         struct Input {
             float2 uv_MainTex;
             float2 uv_EmissionTex;
             float2 uv_Bump;
         };
  
         void surf (Input IN, inout SurfaceOutput o) {
             half4 c = tex2D (_MainTex, IN.uv_MainTex);
             half4 em = tex2D (_EmissionTex, IN.uv_EmissionTex);
             o.Normal = UnpackNormal(tex2D(_Bump, IN.uv_Bump));
  
             o.Albedo = c.rgb;
             o.Alpha = c.a;
             o.Emission=em.rgb;
         }
         ENDCG
     }
     FallBack "Diffuse"
 }

This is the produced effect

alt text alt text And this is the produced effect in a more dark environment.

alt text

You can either do the rest of the work in the textures, or play around with the shader code to create the effect you want.

Comment
Add comment · Show 6 · 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 SomeRandomGuy · Jul 16, 2013 at 07:20 PM 0
Share

Thanks for the answer! I'll have a good look at that code, since I'll need to do some research on shaders anyway. I've got barely any knowledge of shaders, so this'll be fun...I hope o-o'

After I get some more knowledge on that, I'll have a go at following that step-by-step guide on the page I linked.

Anyways, thanks again!

avatar image Professor Snake · Jul 17, 2013 at 03:19 AM 0
Share

http://unitygems.com seems to have some great tutorials on shaders.

avatar image SomeRandomGuy · Jul 17, 2013 at 11:27 AM 0
Share

I just finished reading those! I believe I've got a bit more of a grasp on how this stuff works, but I'm probably still pretty far away from actually creating what I want...xD

avatar image SomeRandomGuy · Jul 17, 2013 at 12:53 PM 0
Share

I found this, I believe I can now just make a few glow objects using this shader, while the actual glowing objects will just use something similar to the emission shader you posted. I might want to change it a bit so that it emits actual light in the color that shader uses, but I'm not sure that's something I should do with a shader.

avatar image Professor Snake · Jul 17, 2013 at 01:18 PM 0
Share

I don't think you can emit actual light via shaders. I'd assume however that you could convert uv coordinates into world space coordinates, which you would then pass into a script that would handle creating the lights for you.

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

Shader Replacement example project upside down with AA 0 Answers

Glowing column of light 1 Answer

Glow Effect 3 Answers

Glow & other post processing - iPhone / OpenGL ES1.1 and ES2.0 performance / work arounds? 1 Answer

How to make line renderer glow like any other 3d object using custom shader? 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