How can i Create Neon Lighting effect in unity 3d ,enter image description here

enter image description here

enter image description here

so i have 2d scene and i want the rect to glow like neon

  • \$\begingroup\$ @AlexandreVaillancourt i tried to follow some video tutorials but they are so complex, hope you can help me \$\endgroup\$ – Kartik Dec 7 '17 at 2:42
  • \$\begingroup\$ Then you want us to write a tutorial tailored for your needs? \$\endgroup\$ – Vaillancourt Dec 7 '17 at 2:45
  • \$\begingroup\$ @AlexandreVaillancourt maybe but you can give me some hints or suggest any tools for this \$\endgroup\$ – Kartik Dec 7 '17 at 2:47
  • 3
    \$\begingroup\$ I suggest you take a look at the help center. Asking good questions is hard, but it's worth it. Questions containing only 10 words rarely make good questions. We expect you'll put as much effort into your issue (and more) and writing the question than we'll put effort into writing an answer. \$\endgroup\$ – Vaillancourt Dec 7 '17 at 2:54
  • 1
    \$\begingroup\$ The pictures are a great step, mainly we just need to know what part of neon lights isn't working for you. The answer to the question would be very different if your neon lights aren't working because they're not glowy enough vs they aren't working because they aren't colored or don't cast shadows. If you can get some screenshots of how your current attempt at neon lights looks as well, people will be able to give you even better answers :) \$\endgroup\$ – Lunin Dec 7 '17 at 3:09

You could achieve the neon light effect in two different ways, depending on your lighting. If in your game you use static baking with lightmaps you could use an "emissive shader", if you want to use realtime lighting with realtime shadows, you can use an emissive shader or an unlit one, and with pointlights or a spotlight. If you dont want to do everything by yourself there is also this package

| improve this answer | |
  • \$\begingroup\$ so there is no way to do with scripts and shaders \$\endgroup\$ – Kartik Dec 7 '17 at 17:13
  • \$\begingroup\$ Yes, you can use shaders. Otherwise you could use post processing effects like Unity's post processing stack. \$\endgroup\$ – user100681 Dec 7 '17 at 17:18

A simple way to perform a glow, particularly in 2D, is to make a blurred copy of your image and then blend it with the original image. You can use either a normal blend with a 50/50 mix between the original image and the blurred image, or you can use an additive blend. It can be helpful to threshold the original image before blurring it if you want only the brightest parts to glow. You can also give it a color cast before the glow if you want the glow to be a particular color.

| improve this answer | |

Here I'm answering my question.

  1. copy the following shader and create a new Shader ;

    Shader "Glow" {
        Properties {
            _MainTex ("Texture", 2D) = "white" {}
            _Color ("Color", Color) = (1,1,1,1)
            _Glow ("Intensity", Range(0, 3)) = 1
        SubShader {
            Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
            LOD 100
            Cull Off
            ZWrite On
            Blend SrcAlpha OneMinusSrcAlpha
            Pass {
                    #pragma vertex vert
                    #pragma fragment frag
                    sampler2D _MainTex;
                    half4 _MainTex_ST;
                    fixed4 _Color;
                    half _Glow;
                    struct vertIn {
                        float4 pos : POSITION;
                        half2 tex : TEXCOORD0;
                    struct v2f {
                        float4 pos : SV_POSITION;
                        half2 tex : TEXCOORD0;
                    v2f vert (vertIn v) {
                        v2f o;
                        o.pos = mul(UNITY_MATRIX_MVP, v.pos);
                        o.tex = v.tex * _MainTex_ST.xy + _MainTex_ST.zw;
                        return o;
                    fixed4 frag (v2f f) : SV_Target {
                        fixed4 col = tex2D(_MainTex, f.tex);
                        col *= _Color;
                        col *= _Glow;
                        return col;
  2. create new material now select that shader from shader dropdown;

  3. apply on your 3d object (not tested in 2d );
  4. import post-processing from asset store;
  5. create new post-processing profile in project;
  6. now select camera type post-pro and you get that script drag and drop your profile in it;
  7. select bloom in profile and bam you are all done.
| improve this answer | |
  • 4
    \$\begingroup\$ You should paste an image of the result. \$\endgroup\$ – Vaillancourt Dec 8 '17 at 0:43
  • \$\begingroup\$ "not tested in 2d" - Didn't you specifically ask for a 2D solution? In your question, you said: "i have 2d scene and i want the rect to glow like neon". \$\endgroup\$ – user1118321 Dec 8 '17 at 3:35
  • \$\begingroup\$ @user1118321 yea i tested now and its working there too \$\endgroup\$ – Kartik Dec 8 '17 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.