Search Unity

Glow 11 - for desktop and mobile

Discussion in 'Assets and Asset Store' started by SRH, May 1, 2013.

  1. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    I can only think about two reasons why this could be happening:

    1. Unity messed something up... delete glow11 from the project and add it again
    2. The shaders are missing in the build, this can happen if there is no object with the shaders is in the scene. This can be solved by copying/moving the shaders in Gloww11/shaders into a ressources folder or adding them them to the "Always include shaders" array in the GraphicsSettings ("Edit/Project Settings/Graphics").

    If both doesn't solve your issue, please send me a minimal scene with that issue so I can take a look at it.
     
  2. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    Copying the shaders to the resource folder did the trick. Thank you.
     
  3. nerik

    nerik

    Joined:
    Nov 8, 2011
    Posts:
    22
    Hi Sven,

    Thanks for the amazing asset and support.

    Just another quick question : is there any way to enable the glow only outside the element? Of making a non glowed copy of the object on top could be a solution, but it's a bit dirty and erh.. It kinda doesn't work.

    The object is a custom curved plane.

    Thanks
    Erik
     
  4. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    At the moment this isn't possible and I don't see any general solution for this.

    Rendering the object on top (with another camera) is the easiest solution. The only other solution I can think of would require using the stencilbufffer in a rendertexture.

    If you want to test the stencilbuffer solution you can try the following
    THIS IS UNTESTED, I'm not at a computer running unity atm, so I can't test if it actually works:

    1. make sure the downsample blend mode is set to max (this way it should work with the current glow 11 version)
    2. modify the shader (or a copy of the shader) you use for the object. Add the following after "Pass {"

    Code (csharp):
    1.  
    2.         Stencil {
    3.             Ref 1
    4.             Comp always
    5.             Pass replace
    6.         }
    7.  
    3. Modify Glow11/_internal/Resources/PostShaders/Glow11Compose.shader

    after each "Pass {" add
    Code (csharp):
    1.  
    2.         Stencil {
    3.             Ref 1
    4.             Comp NotEqual
    5.         }
    6.  
     
  5. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    How can I reduce the memory footprint of Glow11? I got a number of objects in the scene using a glow shader, which seem to increase the used memory by more than 1 gig until the game crashes.
     
  6. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    What Platform (Mac/Win) and which Unity version are you using?

    I don't see any memory issues here, when I make a build with the testscene the player uses about 67MB memory and the usage is stable.
     
  7. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    I am using Win8.1 and the latest Unity version. Thing is, I managed to greatly reduce the used memory on other parts and now it works just as expected and without too much memory consumption going on. I guess Unity played a trick on me or goes crazy when memory consumption is close to the limits.

    Sorry for the false alarm.
     
  8. E-McNeill

    E-McNeill

    Joined:
    Aug 13, 2013
    Posts:
    12
    Hi Sven,

    I'm happily using Glow 11 for the Oculus Rift. I'm using the latest Rift version and got the AA hotfix, but I still get an inverted glow effect when using anti-aliasing. Is there any fix for this that's compatible with the Rift?
     
  9. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
  10. E-McNeill

    E-McNeill

    Joined:
    Aug 13, 2013
    Posts:
    12
    That worked, thanks!
     
  11. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Excuse me, i managed to make Image Effects for Unity Free! If you want proof it works, go search "epic radial," and pick the first result! I Even got a working DoF implementation! (although my bloom isn't particularly good...) If you like, you can make an IndieEffects port of this glow effect so that indie users can take advantage of this. (But on the other hand, this looks like HDR...)
     
    Last edited: Feb 27, 2014
  12. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    Sure, you can use ReadPixels to get a texture, but I refuse to use it as it's a performance nightmare. It may be OK for some simple stuff that doesn't require multiple rendering passes, but for a good looking blur you need several passes.
     
  13. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @SRH: maybe, but my scripts run fast. trust me, take a look and see! i do agree with the performance issues for 20-pass shaders though. (something my package doesn't properly support yet...)
     
  14. MarkHenderson

    MarkHenderson

    Joined:
    Oct 28, 2013
    Posts:
    16

    I just downloaded this patch, and it worked to fix the location of the glow effects.

    However, I'm now getting an error spamming during play:
    doesn't seem to actually be breaking anything, but I've never seen that error before downloading that patch, and I'd prefer to keep my debug log clean.

    Unity doesn't report any kind of stack for that error, just the one line.
     
  15. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    That's a unity bug...nothing I can do about it :sad:
    See:
    http://forum.unity3d.com/threads/210374-Unity-4-3-error-rect-2-rt-gt-GetGLWidth%28%29-amp-amp-rect-3-rt-gt-GetGLHeight%28%29
    The issue has already reported to unity... http://issuetracker.unity3d.com/issues/camera-with-depth-only-or-dont-clear-throws-error-when-image-effects-are-applied

    It's an editor only bug and it only seems to happen on certain aspect ratios.
     
  16. MarkHenderson

    MarkHenderson

    Joined:
    Oct 28, 2013
    Posts:
    16
    Ah, now I feel like a jackass for not searching the error before posting it. Sorry about that, this shader has worked great aside from having to search this thread for the oculus fixes. You might want to post a link to the multi camera fix under the oculus patches in the OP.

    Thanks for the quick reply!
     
  17. MarkHenderson

    MarkHenderson

    Joined:
    Oct 28, 2013
    Posts:
    16
    Sorry to post twice in a row, but I've noticed another problem that I'm not sure how to resolve.

    Ever since applying the multiple resolution patched .dll, glow 11 only works when using the oculus. When I switch my game back to normal rendering using a single camera, glow 11 doesn't cause any glow.

    As well, the settings for the glow 11 shaders seem to have mostly disappeared.

    I've attached two screenshots. The first is using my standard camera, and no glow appears on the light. The second I'm forcing the oculus cameras to be active (It doesn't distort the image because there's no oculus plugged in).

    In the second screenshot, I have the light in question selected, and you can see that the shader only has two options: Glow Source and Glow Multiplier. I remember that when I first started using Glow 11, there were a bunch of different settings for most shaders, but now every shader has only those settings.
    $non-oculus.PNG
    $oculus.PNG
     
  18. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    We're about to add glow to our project, but we've had universally bad experiences with assetstore plugins that include DLLs instead of full source. Can you expand on what exactly is part of your DLL and why?
     
  19. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    For having glow on 'normal' cameras when using the Oculus Patch, download http://www.i-gamedev.com/glow11/patches/Glow11Camera.csand add this script to the camera too.

    You've just hidden the material settings. Click on the material and they should appear.
     
  20. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    It's a DLL mostly for maintainability, if you require the source you can request it from me and I'll send it to you.
     
  21. simone007

    simone007

    Joined:
    Oct 30, 2008
    Posts:
    221
    Hello, I just bought this component and I find it great.

    I have a problem: on the iPad my fps drop from 60 to 20. And I have not a single object with a gloom shader. Just attaching the Gloom11 script to the camera makes a big performance hit.

    Can you please help me find a solution or better settings?

    Best,
    Simone
     
  22. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Excellent - thank you. After purchase I'll send you my assetstore invoice.
     
  23. apoth3osis

    apoth3osis

    Joined:
    Sep 30, 2013
    Posts:
    1
    Hi,

    I am using Glow 11 in a 2D game on iOS. What kind of shader should I use for unity 2D sprite? I am currently using: Glow 11/Unity/Particles/Alpha Blended but it seems to hurt performance(with the script enabled, the frame rate drops from 60 to around 30 on iPhone 5).
     
  24. MarkHenderson

    MarkHenderson

    Joined:
    Oct 28, 2013
    Posts:
    16
    Thanks! This fixed the problem.


    Doh! that was indeed the problem. I hadn't even realized you could hide those.

    Thanks for your help!
     
  25. omgeric

    omgeric

    Joined:
    Aug 18, 2013
    Posts:
    18
    The standard Unity Pro component for glow uses alpha channels for coverage, which breaks a whole lot of assets that use alpha channels for other things. Am I correct in assuming this asset is implemented differently and allows for only selective objects to glow? Thanks.
     
  26. TobiasW

    TobiasW

    Joined:
    Jun 18, 2011
    Posts:
    91
    I'm wondering about this too, and have been refreshing this thread every day now waiting for an answer. I wonder what happened to SRH...
     
  27. misterPantoni

    misterPantoni

    Joined:
    Feb 7, 2013
    Posts:
    44
    Hi there, first of all: Thanks for this great asset, we really needed some selective and performant glow in Unity!

    Second i've got a question: I am using some very special Shaders in a project, and tried to make them glow with Glow11 - which is somehow working (as described in the documentation), but i would like to have my Color-output of the shader to glow, not the input texture or any other of the given options (glow texture ,vertex color)... so i have a vertex-shader which fades some textures and i want the result to be "glowy". And idea how to do this, or any chance to get the output of the shader as a glow source?

    Thanks in advance!
     
  28. E-McNeill

    E-McNeill

    Joined:
    Aug 13, 2013
    Posts:
    12
    I have a performance question too:

    Based on the Unity Profiler, it looks like using Glow11 (oculus version) approximately doubles the CPU time required for rendering. (That's true even if I disable the Glow11 scripts on the cameras; I need to remove the glow11.RenderGlow call from OVRCamera.cs to truly turn off the effect and get the performance back.)

    I had previously imagined that the performance cost would scale up with the number of objects glowing or the number of pixels being processed. Am I doing something wrong, or should I expect halved rendering performance in general for Glow11?
     
  29. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    For sprite support you can use the shader in this package: http://www.i-gamedev.com/glow11/patches/glow11_spritesupport.unitypackage

    Yes, the glow is selective (based on the material).

    Nothing happened, I was busy and the forum wasn't sending me a mail telling me there were new replies to the thread...
     
  30. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    It is possible. Here is how to do it:

    1. change the rendertype of your something unique
    2. create a new subshader in Glow11GlowObjects.shader (don't just copy and paste one of the existing ones, you don't need the whole multi_compile stuff)
    3. use the same rendertype as in step 1 for that subshader
    4. render the glow in that shader (the fragment shader needs to output the color of the glow).

    If you have any issues implementing it, send a email to glow11@i-gamedev.com with your shader and I'll take a look at it.
     
  31. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    Performance shouldn't halve when using the glow. In general there is a fixed cost depending on the number of pixels + some additional cost for each object (doesn't matter of the objects glow or not, unless you use the "reuse depth buffer" option)

    Without knowing what kind of hardware you have and what you're doing in the scene it's hard to tell why it's half. I assume the CPU is mostly waiting for the GPU and there could be 2 reasons for this.
    You either have a nearly empty scene, so instead of doing nearly 'nothing' when rendering you do a full screen effect which obviously needs more performance. Another possiblity would be that your GPU can't keep up, probably hitting the fillrate limit (that should only happen if you're making heavy use of alphablending OR you have some pretty old/slow GPU).
     
  32. Hanana

    Hanana

    Joined:
    Apr 3, 2014
    Posts:
    1
  33. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    You can either use a textmesh and use this shader -> http://www.i-gamedev.com/glow11/patches/Glow11Font.shader
    OR
    if you want to use something else to render the text you could use one of the existing shaders, but that could fail depending on how the font rendering is done. If it doesn't work it shouldn't be hard to fix it (I would have to take a look at the shader used to render the font and make a version that supports the glow)
     
  34. E-McNeill

    E-McNeill

    Joined:
    Aug 13, 2013
    Posts:
    12
    Thanks for the reply. I'll try to give more detail. Here's a screenshot of my Profiler while rendering the scene; it looks similar for the GPU as well. This is where I'm getting the "approximately double" thing; out of 17.7ms for rendering, the image effect is taking 8.16ms, and that goes away if I remove the RenderGlow call in the script.

    I'm working on a fairly beefy desktop gaming PC (760 GTX, i7-4770K), so I didn't expect to see this kind of performance problem. There's a lot of blending in this view, and a lot of small objects (~5000), but I don't imagine it ought to be straining the system to this extent.

    The really weird thing is that I'm getting this result with barely any glow materials in view at all! Take a look at the left half of this screenshot; everything except the purple thing at the bottom is not meant to glow, and their shaders make no reference to Glow11 at all (the glow on the blue hexes is just a blurred texture).

    Another really weird thing: In that screenshot, I disabled the Glow11 script on the right camera, and for some reason that seems to cause everything to be rendered with a glow. What's going on?
     
  35. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    That is the explanation right there. You're rendering a lot of objects, for the glow all of the objects have to be rendered again (as every object could occlude the glowing object). While there is a very simple shader used to render all the objects it seems unity is 'wasting' a lot of time to send all the objects to the GPU.
     
  36. E-McNeill

    E-McNeill

    Joined:
    Aug 13, 2013
    Posts:
    12
    Ah, I see. These objects don't write to or read from the depth buffer, so I thought that would allow them to skip that step entirely. Is the basic idea that every object in view is "drawn" in some sense to a texture, then blurred to produce the glow? Is there any way to exclude objects that are known not to occlude any glows?

    In most cases, I can fake a glow effect with textures, but I wish there were a way to include just a few glowing objects without affecting the rest.
     
  37. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    If the objects don't need to affect the glow you can change the rendertype in the shader for these objects (just use something that isn't one of the normal rendertypes defined by unity), this way they will be ignored.
     
  38. E-McNeill

    E-McNeill

    Joined:
    Aug 13, 2013
    Posts:
    12
    Good to know, thanks! I'll try it out.
     
  39. MaxxRafen

    MaxxRafen

    Joined:
    Apr 7, 2014
    Posts:
    31
    When I switch the unity platform to iOS or Android, the Glow 11 (Script) becomes unchecked (disabled).

    I can't seem to enable it so Glow 11 isn't working for me on any mobile platforms in Unity.
    What do I need to do to use Glow 11 on mobile devices?

    I have Unity Pro, but only the base version.
     
    Last edited: Apr 7, 2014
  40. SRH

    SRH

    Joined:
    Feb 28, 2011
    Posts:
    160
    I'm guessing you meant to say that you don't have iOS Pro and Android Pro. In this case it won't work (and there should be a message in the console telling you that it isn't supported), the glow needs renertextures which are only available in the Pro versions.
     
  41. MaxxRafen

    MaxxRafen

    Joined:
    Apr 7, 2014
    Posts:
    31
    Thank you for the quick reply.
     
  42. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    I set glow11 transparency material in my objects. When I set the main color's alpha to 0, the glow remains in the scene.

    Furthermore, objects glow behind other solid objects, this occurs when I use "reuse depth" or not.
    What is the best way to remove glow when objects are completely transparent? Also what is the best way to make objects not to glow behind other objects?

    I am using deferred rendering, and linear colourspace, marmoset Skyshop shaders for environmental objects (terrains, pillars, etc)
     
    Last edited: Apr 17, 2014
  43. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Hi,
    can you please fix this issue,

    Forward render with anti-aliasing on (AA with or 4 or 8 Multi sampling) and also multi camera.

    I read all forum post there is many patch. i'try with many but can't help it.

    Best Wishes,
    play_edu
     
  44. eric_kog

    eric_kog

    Joined:
    Mar 6, 2013
    Posts:
    11
    Hi SRH,

    I was wondering if your glow package was flash compatible, I noticed a couple of DLLs. One looked to be editor tools, but is the other one required at run time?

    Cheers,
    Eric
     
  45. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    I often get the following message;

    "Cleaning up leaked objects in scene since no game object, component or manager is referencing them
    Material Hidden/Glow 11/BlurEffectConeTap has been leaked 1 times.
    Material Hidden/Glow 11/Compose has been leaked 1 times."


    Every time I saved my scene with Glow11. Is this normal?
     
  46. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    SRH- I'm using Glow 11 in my new iOS game "Unpossible." I have it working great on the iPhone 5, 5C and 5S, but I can't get it to be fast enough on any of the iPads to keep my game running at 60fps. I'd like to adjust the renderer, base downsample resolutions to something less than quarter to try that. I'd also love to be able to adjust those settings in code at runtime.

    Is it possible to set 1/8 or 1/16 resolution for all the settings on the shader?

    Thanks!
     
  47. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    Hey everybody. I haven't heard back from SRH in a couple weeks I need to get an update out. Has anyone found a way to boost performance on the retina iPads? Even the iPad Air isn't enough for me to use the lowest resolution setting of Glow 11 and still get 60fps in my game. I'd love to get more devices with the glow turned on.

    Thanks!
     
  48. IridiumStudios

    IridiumStudios

    Joined:
    Apr 15, 2013
    Posts:
    21
    I appreciate the Oculus patches, but is it possible to update the code so that it works with the Oculus 3.0.1 SDK? Gives a few errors when I try the 2.4 patch on the latest stuff.
     
  49. Capn_Andy

    Capn_Andy

    Joined:
    Nov 20, 2013
    Posts:
    80
    I'm seeing inverted glows on certain platforms (only SOME of my windows boxes), so that's still an issue.

    Also seems to be broken on my Mac in Unity 4.5. Glows are offset slightly down and to the left.
     
  50. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    Thanks for sharing that. I'm going to wait on upgrading to Unity 4.5 for now.

    @SRH - Any fix for 4.5 coming soon?