Giter Club home page Giter Club logo

sprite-glow's Introduction

Installation

Use UPM to install the package via the following git URL: https://github.com/elringus/sprite-glow.git#package or download and import SpriteGlow.unitypackage manually.

Description

The glow effect is achieved using sprite outline in HDR colors (applied via shader) and bloom post-processing.

Glow Intensity Glow Color

For the bloom effect Unity Post Processing Stack (PPS) is used. You can replace it with similar 3rd-party solutions.

The effect is compatible with the Universal Render Pipeline (URP, aka LWRP). Bloom should be configured via URP's own post-processing solution; don't forget to enable HDR in the pipeline asset settings.

Character sprite by Mikhail Pigichka.

FAQ

Can I use the effect with components other than SpriteRenderer (UI Image, Tilemap, etc)?

Not directly (after all, this is SpriteGlow), but it's possible if the component is using a shader similar to sprites (e.g UI objects, tilemaps and other "2D" stuff). For this you will have to create a material based on the Sprites/Outline shader and manually apply it to the component. You can then control all the glow parameters using the material editor. In the project you can find scenes with the examples for applying the effect to UI Button and a tilemap.

Why doesn't the glow appear?

Make sure:

  • A bloom post-processing effect is enabled (you can use any, eg the one from Unity's PPS). Be aware, that universal render pipeline (URP/LWRP) only supports built-in post-processing, third-party solutions (including PPS) won't work with it.

  • HDR is enabled for target platform and tier (Edit > Project Settings > Graphics):

  • Camera 'Allow HDR' is enabled:

  • You've set 'Glow Brightness' high enough:

Why does the glow appear on the whole image?

Make sure 'Threshold' value of the bloom image effect is set high enough. It's usually 1 to 1.5, depending on the bloom solution.

Why do I get a NullReferenceException in build?

Most likely the outline shader is not included to the build (it happens when none of the included assets reference SpriteGlow component directly). You can force-include the shader by assigning it to the "Always Included Shaders" in Edit -> Project Settings -> Graphics.

It's still not working!

Make sure you're using a compatible Unity version; supported versions per release are available on the releases page.

Download (clone) this repository and examine the example scenes, comparing them with your setup. Chances are, you've misconfigured something.

In case nothing of the above helps, check the active issues or open a new one. Don't forget to include the full error log, detailed information about your system, Unity version, package version and steps required to reproduce the issue.

sprite-glow's People

Contributors

elringus avatar mishterkirby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sprite-glow's Issues

Change GlowColor from script

How can I do this without resetting the brightness, I tried doing color * Mathf.LinearToGammaSpace (emission);

Android Issue : sprite pink

I tried for many hours to find a solution but i'm out of ideas !

I'm working on Unity 2018, SpriteGlow 1.6 (and it's the same with 1.7).

I have the processing stack enabled on my project, and a sprite with a glow effect.

It's ok in my editor and in play mode and it's ok when I build for Windows, I can see the glow effect.

But when I build for Android and try the .apk on Android Studio, the sprite with the SpriteGlowEffect script is pink.

I manually added the shader Sprite/Outline in Graphics settings but no effect.

Do you have an idea ? Tthanks !

Feature Request: Support Child Sprites

If we have multiple sprites the glows generated will overlay one another. See center of RHS image
Desired effect would be a combined sprite so that a single outline is created. See center of LHS of image.

image

Even better - would be to enable placing these glows on separate layers? THough This may be far too complex?

2019.3 Support

It seems to no longer work on 2019.3. Is there something else I need to configure for the URP?

Not working

The glow is not working even after following all the steps.
I dont know how to fix it.

Screenshot (11)

HDR not showing up at all

I have tried several different things but for some reason the "HDR" is not actually showing up within the HDR color picker. The HDR picker is being shown but I don't see the "HDR" text within the color picker and there is no glow on my sprite. I copied all the files into my project and set everything up just as the sample project but no luck.

Am I missing something here?
Thanks!

Spine 2D Glow

Working fine with all Mesh and Sprites but nothing happen with Spine 2D.... No Outline appear. can you please make this support for Spine2D skeleton and provide upgrade for this

Changing GlowColor in script without messing up brightness.

I have a simple sprite (square of white color) and I am setting a random color to its sprite renderer in code. I want to use the same color as GlowColor which works fine for once but when I change GlowColor a couple of times it loses its color brightness resulting in lose of glow.

Here is the code I am using:

public void Init (Color color) 
{
    sprite = GetComponent<SpriteRenderer>();
    sprite.color = color;
    SpriteGlow.SpriteGlow glow = GetComponent<SpriteGlow.SpriteGlow>();
    glow.GlowColor = color;
}

Init method is called multiple times, how can I set glow color so it is visible every time?

PS: Currently Bloom effect is applied on all the materials. How can I remove the effect from some of materials?

Cheers

disable bloom

Hello! It is possible to somehow disconnect bloom on Particles?

Workflow

I want to implement this to the 2D game I'm developing. I'm kinda new to this. If you could elaborate on the workflow a bit. I'm confused about the material that I've to create, you've mentioned it in the Description. Any help is appreciated.

NullReferenceException

NullReferenceException
UnityEngine.Material..ctor (UnityEngine.Shader shader) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:259)
SpriteGlow.SpriteGlowMaterial..ctor (UnityEngine.Texture spriteTexture, Boolean drawOutside, Boolean instancingEnabled) (at Assets/SpriteGlow/SpriteGlowMaterial.cs:21)
SpriteGlow.SpriteGlowMaterial.GetSharedFor (SpriteGlow.SpriteGlow spriteGlow) (at Assets/SpriteGlow/SpriteGlowMaterial.cs:37)
SpriteGlow.SpriteGlow.SetMaterialProperties () (at Assets/SpriteGlow/SpriteGlow.cs:144)
SpriteGlow.SpriteGlow.OnValidate () (at Assets/SpriteGlow/SpriteGlow.cs:131)

no effect for square

Hello,

I creat a default square in unity and drag the two files to it,but nothing happened.
What did I forget to do?

Behaves Like Any Other Sprite

I read the replies to some of the other issues, but none seems to solve it.

When I add the Sprite Glow component to the sprite, it creates an outline outside of it:
1

But modifying the Bloom effect using the Unity PostProccessing stack doesn't have any effect on the sprite I want to glow, instead it has the same effect on every Sprite:
2

Unable to get the SpriteGlow component in C#

Can't find the namespace that has been used for the script and thus unable to get the component. I want to edit the glow parameters from my C# script.

Edit:

using SpriteGlow;

SpriteGlowEffect glow = GetComponent<SpriteGlowEffect>();

Is not work in Mobile device!

I build a apk work with this asset and I run this on my mobile and it's not work and also weird thing happen but Unity editor it's perfectly work! if you can fix that it's awesome

Copied all resources from example project, still not working

I've copied every single parameter, object, asset, and project setting I could find in the example project. Still, I can get no more than this punny outline around the character's head:

GlowHelp

It's my first time attempting this post processing wizardry, and I would be very thankful if it could be just a rookie mistake.

Can't import package

Hi, the plugin look great, but I can't import to Unity with following error:

Cannot perform upm operation: Unable to add package [https://github.com/Elringus/SpriteGlow.git#package]:
  No 'git' executable was found. Please install Git on your system then restart Unity and Unity Hub [NotFound]
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Error adding package: .
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

Do you have other method to suggest to import the package?

Thanks a lot

Glow not working

I dont really know why the script isn't working, i'm using Unity 2018.2.13f1:

The sprite:
image

Configurations on inspector:
image

HDR in graphics is checked:
image

Camera also have checked Allow HDR:
image

I can't add the ScriptGlow script to a Tilemap

The system is great and I'm very satisfied, but I noticed I can't use it on tilemaps.

Unity displays the LogError message: "Can't add component 'SpriteRenderer' to Tilemap because it conflicts with the existing "TilemapRenderer" derived component!", which makes it pretty obvious that the problem is with the TilemapRenderer.

I'm still new in Unity and slowing learning all the small bits, so please forgive me if this is a silly question, but is there a workaround to apply this System on a Tilemap? Thanks!

Unity performance slows down to 25 fps after adding glow effect.

Hi. It took a while, but I managed to add the glow effect you provided to a sprite in my 2D game after installing the package, setting the post-processing volume/layers and assigning the sprite outline. It seems to have a use for what I'm looking for and runs well.

However, this game was meant to run at 60 frames per second, and it was running very well at the beginning. With this whole glowing effect added however, the game now runs between 20 to 30 frames, which is unbearable to watch. I'm leading to believe this has to do with the addition of the bloom effect, as I have not implemented lighting effects yet. Furthermore, the game seems to only cause this slowdown of performance when operating under the Unity Editor. I tested building the game into an executable file and it thankfully started working at the 60 fps I expected. Regardless, I want to continue testing the game in the editor without this setback of performance rate, as it would take too long to test each update in a new build.

My overall questions are, was this sprite glow addition meant to function in a lower frame rate? Are there methods I can consider to reduce the performance issues in result of this add-on shader? Any advice on how to keep projects running smoothly after applying the bloom effect would be very helpful. Thank you.

Mobile devices.

Hi , firstly thanks for creating great assets.
Is "SpriteGlow" also usable for mobile devices ?
Asking for performance.

Unity Post-Processing Stack v2 support/guide

With the newer Post-Processing Stack introduced in 2018.1, it seems that either this package doesn't support it, or there's a different setup required - I couldn't seem to figure it out and get it working, but I'm a little bit of a novice when it comes to the fine intricacies of the PPS.

Maybe some clarification in the help/troubleshooting/support area for v2?

In the meantime, the legacy PPS works awesome!

Shader Problem

When I add the Sprite Glow Effect (Script)
I get this error:
Shader error in 'Sprites/Outline': not enough actual parameters for macro 'UNITY_ACCESS_INSTANCED_PROP' undeclared identifier 'UNITY_ACCESS_INSTANCED_PROP' at line 222 (on d3d11)

Compiling Vertex program
Platform defines: UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME

Thanks!

About the Line Renderer

Can we apply this to line renderer for 2d? When I add the Sprite Glow script, it automatically adds the new material to the sprite renderer (Sprites/Outline), can we create this material instead of adding with the script so that we can add this material to the line renderer?

Couldn't add in SpriteGlowMaterial.

So far I can add in the SpriteGlowEffect into my sprite. But I couldn't add in SpriteGlowMaterial, it says the script needs to derive from MonoBehaviour. I tried changing the word Material from the public class into MonoBehaviour, but most lines have errors. Is there anyway to solve this?

image

Cant get UIExample to work in SpriteGlow-1.8 or 1.7

Hi, cool product, thank you! I am trying to get this working on my UI (buttons etc) for Built-In rendering, but having some issues on Unity 2019.4.7:

In SpriteGlow-1.8, in the UIExample scene, the LegacyCamera does not show the glow effect. I took these steps:

  1. I disabled URPCamera and enabled LegacyCamera
  2. I ticked Post Processing on the LegacyCamera
  3. I set the Render Camera of the Canvas to LegacyCamera

See screenshot SpriteGlow_1_8_Issue
The example scenes work fine apart from UIExample. Am I missing something?

Just for reference, I also tried a previous version, but in SpriteGlow-1.7, none of the example scenes work.
See screenshot SpriteGlow_1_7_Issue

Thanks for your help.

Works in scene view but not through camera.

Hi there, is there any reason why the effect could be seen in scene view but not through the camera?

Is it because a 2d renderer is use?
I am trying to include it in a urp project that use a 2d renderer data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.