Search Unity

2D Mesh Based Volumetric Lights

Discussion in 'Assets and Asset Store' started by reveriejake, Jul 5, 2012.

  1. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Quick Update:

    New Shaders: Shader guy says the new shaders will not need to make use of the 2DVLS Diffuse or Cutout shaders which should mean that the lighting system will be good to go with any shader you throw at it. Of course I have not gotten my hands on the demo or code so we shall see! But high hopes guys!

    Optimizations: I just finished some major modifications to the mesh generation code. I posted a pic below of the progress! This optimization reduces the mesh vertex count down to a minimum of 5 when no objects are inside of the light and it increases the amount of verts as needed. So this should help out majorly with Mobile developers and increase your FPS in general. I am still working on this optimization before I can release it to the asset store. All I need to do is re-implement the "Cone Angle" and "Cone Start" variables and we should be good to go live.

    Lines represent the edges of triangles. So where there is no line, there is a triangle face!
    $VertReduction.png

    Showing "Cone Angle" in action!
    $VertReduction2.png

    And finally, showing the actual wire-frame
    $VertReduction3.png

    Hope to share more update soon!

    Jake
     
    Last edited: Jun 9, 2013
  2. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    WOW! That's exciting! Can't wait to try it out!!!

    Thank you so much for keeping pushing this already awesome plugin forward!
     
  3. Mythalore

    Mythalore

    Joined:
    Jan 27, 2013
    Posts:
    1
    Hey guys, I've just purchased the pack and I'm liking it so far but I have absolutely no idea how to use events, A tutorial would be very helpful.
    Thanks, Sam.
     
  4. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    Do you know if the new lighting shaders will cause any pitfalls for mobile development like increased draw calls?

    Thanks for the awesome updates!
     
  5. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    @throthmaster: I have not gotten many details about it. Just a quick note on what I had mentioned above. I will let you know as soon as I find out!

    @Mythalore: Check out the events sample scene and specifically look at the "EventSample_VLS" script. Events are not too difficult to figure out if you know how events in C# work but I will try and get a tutorial up soon on events for those with less experience.
    1) Make a void function that has 2 parameters.
    Code (csharp):
    1.  
    2. void MyOnLightEnterFunction(Light2D light, GameObject go)
    3. {
    4.     // Do code you want your object to do when the object is inside of the light.
    5.     // -light- parameter is the light that is calling the event
    6.     // -go-  parameter is the object the event is being called on
    7.  
    8.     if(go.GetInstanceID() == gameObject.GetInstanceID())
    9.     {
    10.         // This gameobject is currently inside of the light
    11.     }
    12. }
    13.  
    2) Register your function with the Light2D event system
    Code (csharp):
    1.  
    2. void Start()
    3. {
    4.    Light2D.RegisterEventListener(LightEventListenerType.OnStay, MyOnLightEnterFunction);
    5. }
    6.  
    3) When done, remove your function from the light event listener
    Code (csharp):
    1.  
    2. void OnDestroy()
    3. {
    4.     Light2D.UnregisterEventListener(LightEventListenerType.OnStay, MyOnLightEnterFunction);
    5. }
    6.  
    Hope that helps for now.

    @imteractive: How are things going with you? Everything working fine on your end? As Long as people keep picking up the pack, I will keep working on it ;)
     
  6. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    If anyone is having trouble buying the asset on Unity's asset store. Don't hesitate to email me at jake@reverieinteractive.com and I will help you purchase the package via PayPal. This does not happen very often and my preference is that you go through the Asset Store but I understand that some of you might have troubles.

    Just let me know!

    Jake
     
  7. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hey Jake, no worries. I'll e-mail you some comparison screenshots just in case you can't repro.

    Thanks,

    Ben
     
  8. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Quick update on shaders. The new shaders currently work using the old diffuse/cutout technique but he is still working to provide an easier to use shader.. This shader is the "All in one" shader I was talking about. We have run into a couple of problems but hopefully they will be worked out within the next few days.

    At the very least, I believe the semi-transparency issue is fixed. If that is the case I might release the shaders in their current state at the end of this weekend.

    Look for more updates soon!

    Jake
     
  9. MakinStuffLookGood

    MakinStuffLookGood

    Joined:
    Nov 20, 2012
    Posts:
    21
    Awesome asset. Not using it in my current project but really excited to get it into some really pretty looking 2D game ideas I have. Those soft shadows REALLY make me want to buy Pro.

    The previous semester's game design class at my university would've loved this, so I'll be sure to recommend this asset to the class this coming fall!
     
  10. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Awesome to hear your excited about using it! I'm always excited to see 2DVLS used in games so once you have something you want to share, feel free to post it here or send me some pics at jake@reverieinteractive.com and I will gladly post them on the 2DVLS Doc Page for examples of what 2DVLS can do!

    Jake
     
  11. delVhar

    delVhar

    Joined:
    Sep 29, 2012
    Posts:
    20
    I just wanted to say thanks for this and great work!

    I bought 2DVLS a while ago, and it didn't really suit my needs at the time, but the recent changes have done wonders.

    Looking forward to the new shaders!
     
  12. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    First of all I want to apologize for not replying for a week! I have had a massive migraine this entire week and have basically slept the entire time. Fortunately I am feeling much better and can get back to work ASAP!

    Shader Update
    Okay sounding like a broken record now but just got an update on the shaders and things are coming along slowly. I wont give an ETA this time as I honestly am not sure anymore :) but I would rather give the programmer time and make something very good than just send you guys something I know you wont like.

    Mesh Optimizations Update
    I am still working on the mesh optimizations, I have not come up with a good solution for implementing "LightConeAngle" and "LightConeStart" together. I have been able to make the light work with just the "LightConeAngle' variable alone. Its that darn Math that gives me trouble. For that reason I will not be including the mesh optimizations in the next release.

    Unfortunately in my initial testing generating meshes with less vertices is slower (using my current method) than the current method of adding vertices at every ray. I will probably not be releasing the optimized mesh update until I can get the FPS to match or exceed the performance of the current version of 2DVLS.

    What to expect in 2DVLS 2.7.8
    • I have added a second LayerMask to the lights. The new LayerMask will allow you to override the "Shadow" layer so that you can have events act independently of the light mesh. For example, you want an event sent to an object within range of the light but you dont want a shadow to be cast from that light.
    • I have noticed that there are unnecessary updates when changing the color of the light. For some reason I had the light update its mesh every time you change the lights color. This is not necessary so I have changed it so the light mesh no longer updates when its color is changed.
    • I have also changed the way materials work. Instead of a mesh update when you change the material, it will now change the material without any updates to its mesh.

    Have a good weekend and thanks again for everyone's support!
    Jake
     
  13. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hey Jake,

    Thanks for the update. I'm still really looking forward to those shaders, but am happy to wait. The new features sound great, thanks for your hard work.

    Ben
     
  14. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    I am looking forward to the shaders as well. I hope they come out as expected.g

    Jake
     
  15. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Sounds great.

    I showed Luminesca off at Rezzed game show last weekend and lots of people were very impressed with the lighting. I was bigging-up your plugin whenever I got the chance!
     
  16. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    :cool:

    Awesome man, glad they liked the lighting but I hope they were more impressed by the game overall. I personally think its a very good game. Ever since I played Limbo, I have wanted to make a game using the same art style and your nailing it with yours.

    Thanks again for the referencing ;)
    Jake
     
  17. Flashist

    Flashist

    Joined:
    Jun 25, 2013
    Posts:
    11
    Hi!

    Please, could you show few sample scenes with 2dToolkit + Light2D ?
     
  18. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    If anyone has an example for this could you please share? I cannot get 2dToolkit to import anymore as it crashes my Unity.

    Here is my previous example but it does not show lights that overlap objects:
    $2dToolkit.jpg

    Jake
     
  19. gruddlebug

    gruddlebug

    Joined:
    Mar 11, 2013
    Posts:
    65
    The 2D Volumetric lights EventSampleScene with various 2D Toolkit Sprite types added.

    $tk2dLight.png


    cheers
     
  20. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Cool thanks!

    2DVLS works with all Unity default colliders which means that if your using colliders on your 2DToolkit assets, 2DVLS will work.

    Thanks again for the sample gruddlebug!

    Jake
     
  21. Flashist

    Flashist

    Joined:
    Jun 25, 2013
    Posts:
    11
    2 gruddlebug, reveriejake:
    Thanks a lot =) But I mean, could you share source of unity project, which I may to see how it made inside?
     
  22. gruddlebug

    gruddlebug

    Joined:
    Mar 11, 2013
    Posts:
    65
    Hello,

    The source code is the sample code included with 2D Volumetric Lights EventSampleScene.
    I just changed the assets in the inspector to 2D Toolkit Stuff!

    As I didn't write the example code I'll leave it up to Jake to put it up here.


    cheers

    Paul
     
  23. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    I will see what I can do. I will open up the Unity 4 and see if I cant get the 2Dtoolkit assets to import. I tried to make an example scene in Unity 3.5 and I almost lost all of my code so I have not tried importing 2DToolkit again. Im sure it will work in Unity 4.

    If someone does share a file before I get to it please remember not to include the 2DVLS scripts in the file. When putting a scene up make sure "Include Dependencies" is unchecked. Otherwise I will try to get around to this today once I get off of work.

    Jake
     
  24. Flashist

    Flashist

    Joined:
    Jun 25, 2013
    Posts:
    11
    Hi.

    Thanks a lot again)

    Will be waiting for example.
     
  25. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey Flashist, I didn't get a chance to create the demo yesterday but I just want you to know I have not forgotten and I will get one to you ASAP (Im at work again).

    I might have an issue with sending a project that contains source for 2DToolkit so I might end up just making a quick video tutorial on how to setup a scene this weekend.

    Jake
     
  26. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Hey Jake,
    I am wanting to create like underwater God rays. Would your tool work, without to much overhead? Also does it require Pro?


    Thanks
     
  27. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    @pixelsteam: 2D underwater Godrays? If so then yes, if not then it might depending on the effect your looking for.

    2DVLS does not require pro unless you want your lights to look soft. In that case you will need pro for the blur effect since it uses render textures.

    @Flashist: I still have not gotten around to making that scene. To use 2DVLS with 2DToolKit all you really need to do is swap the 2DToolkit shaders with the 2DVLS/Cutout shaders. There currently isn't a soft alpha shader so don't expect the edges to work. Also the shaders to not work well with overlapping geometry. I have been working with shader programmers recently to try and accomplish this. Unfortunately it turns out to be a larger problem to figure out than I anticipated.

    I will still try to make a 2DToolKit tutorial along with a tutorial on Events once I get the time to devote to it.

    Jake
     
  28. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey guys, I just received a 2 star review and the publisher of that review had some points I wanted to clarify on the forums.

    My BIGGEST Clarification
    It is not painfully obvious because I have done a poor job of advertising it but there is a menu for 2DVLS inside of the "Game Object >> Create New >> 2DVLS" drop-down menu. It should have all of the information you need to get started with 2DVLS without dragging and dropping anything into the scene.

    I tried to avoid adding another item to the menu to prevent clutter for something so simple as 2DVLS which is why it is poorly advertised.


    1) Each light is achieved using hundreds to thousands of Raycasts.
    You can adjust the number of raycasts. A good number to start off with is about 300 raycasts per light. With that said, there are several optimizations in the code to limit the number of times a light has to update using the raycasts so even with 300 lights you might have a case where there are 0 raycasts per update. There are definatly not "Hundreds of Thousands" of raycasts.

    2) Soft shadows scene is not included, and documentation for it doesn't cut it. I was not able to convert the Shadows example to use Soft Shadows.
    I have said this before. I do not include that scene because it is a pro-only feature. If you own a pro copy of Unity feel free to contact me. I Have posted my email address several times in this forums and in the box below my posts.

    3) No information on how to get in touch with the author, forcing me to leave a negative review instead.
    Again, my email is posted everywhere... I usually leave it every 5th comment! But for those who do not know where it is... Here it is once more!

    jake@reverieinteractive.com

    --------------------------------------------------------------------------------------------------------------------------------------

    Update on next 2DVLS:
    It doesn't look like the shader is being advanced anymore. This is the second attempt that has failed and I am still looking for someone who is willing to give it a shot. Please contact me at the address above if you are interested.

    With that said, I am about to release an update (with old shaders) which will include the few optimizations I posted earlier (without the vertex optimization as it is still slow).

    Keep up the great game making guys! And hope you were able to pick up 2DVLS yesterday at 50% off!

    Jake
     
    Last edited: Jul 8, 2013
  29. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Jake, I emailed you a response but the email bounced with "mailbox is full".
     
  30. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Thanks for the heads up. It must have just filled up! I just cleared it out so send it forward!

    Jake
     
  31. SullyTheStrange

    SullyTheStrange

    Joined:
    May 17, 2013
    Posts:
    147
    Hey Jake,

    I'm very interested in this plugin, it looks really awesome, but I was wondering if you could upload a version of the Create Soft Shadows demo without soft shadows? Sounds silly putting it that way, but I'm sure everybody who doesn't have Unity Pro would appreciate being able to try out the version they'd be using before buying. Myself included. :)
     
  32. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
  33. SullyTheStrange

    SullyTheStrange

    Joined:
    May 17, 2013
    Posts:
    147
    Hmm, I don't see the links on the page itself... thanks though! Still beautiful without the blur and definitely suits my needs. I'm sold!
     
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    In Unity 4.2, there's stencil buffer support. This enables a few tricks such as extruding closed meshes out from the light instead of raycasting. You could look into that for a wholly simpler non-deferred approach if you fancied it :) It would be slightly more expensive to render but at least it would mostly reside on the gpu and free up the CPU. Swings and roundabouts.
     
  35. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Thanks for the info Hippo! I will be sure to check it out asap. For the time being its nice to support 3.5.x though.

    Jake
     
  36. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey guys just wanted you to know I have finished with the next update. The biggest change in this update is the number of triangles in a light when it is being cast.

    When using 5000 rays and casting off of 2 cubes the new lights produce only 16 triangles. If you remember the previous versions would produce over 5000 triangles for the same ray count.

    I am going to submit this package in a few days but for now I would like to know who wants to test out the product before it goes live. Its a pretty serious update and I want to make sure it does not mess up any scenes.

    Just email me [jake@reverieinteractive.com], let me know you want to try out the latest version and include your invoice number (if I have not already been in contact with you).

    $LowPolyLight_01.png

    Jake
     
  37. fgielow

    fgielow

    Joined:
    Jan 3, 2012
    Posts:
    122
    Hello!

    I am searching for a 2d lighting system for my use, which can accomplish something like this: http://jotun-dev.tumblr.com/post/55114377905/textured-illumination-system-for-the-line-of

    This is a current project of mine, regarding the lighting system, it should cast shadows in order to project the player's line of sight, but I would also want the sprites to receive such light, having a more lightened side and a darker one, as in the video I have sent.

    Is it possible to accomplish something similar to that with Light2D? My current "solution" is just a prototype that relies on many raycasts and is not that precise.


    Thanks very much for the attention.
     
  38. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    You use a similar technique to mine and I think yours looks very good already! But as you said, it relies on a lot of raycasts which depending on how many rays you cast can be expensive. Mine also relies on a lot of raycasts so there honestly would not be any benefit for picking up my package.

    Since you know your game is going to be in 2D then maybe you can look into alternative solutions. I use raycasts because some of the people picking up 2DVLS are using the system in 3D and on multiple planes. I would suggest to you to implement a line segment map of your scene instead of using Physics. That way your light has something to reference off of and it might be faster on the processing.

    Thanks for the interest though!

    Shoot me an email if you have anymore questions (Link In Signature Box)
    Jake
     
  39. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hey Jake,

    It's a shame to hear that the work on the new shaders has halted, as I was hoping it would fix the problems I've been seeing using 2DVLS on iOS. I e-mailed you screenshots of the issue but unfortunately didn't receive a response. Is there any chance you could take a look at this please?

    $2dvls_ios_issue.png
    (iOS on the left, Mac OS X on the right)

    Specifically the issue is that the mobile shaders on iOS are really bright and opaque, rather than the nice (somewhat subtler) effect I've set up on the desktop. Other than this performance is great - it works as expected and the framerate is good. However, this is somewhat of a moot point if it continues to look bad to the end user.

    I'm using the exact same shaders and setup for mobile as I do for desktop. Is this incorrect? Have you done any tests on iOS and achieved different results?

    Thanks Jake,

    Ben
     
  40. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Oh yeah sorry I missed your email!

    I have been trying to work out the shaders on my own. I am getting very close, I was able to get semi-transparent shaders but they do not have color! If anyone has any idea of how to fix that please shoot me an email.

    Anyway, I have attached a few shaders that I have updated myself. These might work for you!

    http://www.reverieinteractive.com/2DVLS/Downloads/AlteredShaders_v0-1.zip

    Please let me know if these work!
    Jake
     
  41. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Here is the Semi-Transparent textures as they are.

    The biggest issue I see is that when you set the lights alpha channel to 0 the colors go away but when the alpha is 255 the colors are full bright. Can someone test this out and let me know if it works? Make sure your using the above shaders (In the zip file in comment above). Any suggestions are appreciated!

    $SemiTransparentTest3.png

    Code (csharp):
    1. Shader "2DVLS/Transparent"
    2. {
    3.     Properties
    4.     {
    5.         _MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "white" { }
    6.     }
    7.  
    8.     Category
    9.     {
    10.         ZWrite Off
    11.         Cull Off
    12.         Lighting Off
    13.  
    14.         SubShader
    15.         {
    16.             Tags { "Queue" = "Geometry+7" }
    17.  
    18.             Pass
    19.             {
    20.                 //Blend DstColor DstAlpha
    21.                 Blend DstAlpha OneMinusSrcAlpha
    22.  
    23.                 SetTexture [_MainTex]
    24.                 {
    25.                     combine texture
    26.                 }            
    27.             }
    28.         }
    29.     }
    30. }
    Jake
     
    Last edited: Jul 15, 2013
  42. fgielow

    fgielow

    Joined:
    Jan 3, 2012
    Posts:
    122

    Hmm I see! but mine has some limitations which yours have already dealt with, for instance, several sources of light, mine do not cope well with other possible sources apart from the player's central perspective. However the major issue I see in my and several other solutions is that I want the player's Line of Sight to reveal walls which he could see, but nothing on the other side of the wall. And my sprites for the scenario composition are very varied and sometimes they are even combined together. So, for instance, if I have a wall in a format of "H" and the player stands on the right of the H, he should only see a "|" on his left, excluding the "|-" part. And as the meshes and colliders are combined together.... I currenty check for a maximum entrance distance, which is the width of the wall itself, hence the player never can see what is on the other side, but that is not much robust. Gotta work on that a little.

    Thanks for the line segments tip, here is a nice reference I was studying before: http://www.redblobgames.com/articles/visibility/


    Regards.
     
  43. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Very nice reference! It looks like he does the line segment method as well.

    If all of your sprites are going to be Axially aligned and rectangular in shape, you could use the bounding boxes of the colliders to get your line segments and calculate the wall thickness based on the bounding box size.

    That way instead of casting 1000 rays, you can just cast 1 ray per edge based on the bounding box corners. I think that might cut your processing time down quite a bit.

    Jake
     
    Last edited: Jul 15, 2013
  44. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Heads up guys. I am going to bed (Work 3rd shift) I will get back to you guys if you have any more questions at around 4pm PST.

    Thanks for your support and the help you are giving me!
    Jake
     
  45. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hey Jake,

    Thanks for posting the new shaders. I've just tried them on the iPad 2 and iPhone 3GS hardware, but unfortunately it's the same problem as before - they are way too bright. Here's a screen dump from the 3GS.

    $IMG_3594.PNG

    Am I doing something wrong, or is this extension untested on iOS hardware?

    Ben
     
  46. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    I have not been able to test it on iOS. I do not have my Mac at the moment and I am unable to test these out.I have run into this problem before with other default shaders but I am trying to remember what fixed that issue. From what I remember we had a specular shader on a balloon that worked just fine in the editor. But when we put it onto an iOS device it became super white and was very bright.

    Maybe this will work?

    2DVLS_Light.shader
    Code (csharp):
    1.  
    2. Shader "2DVLS/Light"
    3. {    
    4.     Properties
    5.     {
    6.         _MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "white"
    7.     }
    8.    
    9.     Category
    10.     {      
    11.        SubShader
    12.        {
    13.             Lighting Off
    14.             ZWrite Off
    15.  
    16.             Tags { "Queue" = "Geometry-1000" }
    17.        
    18.             BindChannels {
    19.                     Bind "Color", color
    20.                     Bind "Vertex", vertex
    21.                     Bind "TexCoord", texcoord
    22.             }
    23.  
    24.             Pass
    25.             {
    26.                 Blend One One
    27.  
    28.                 SetTexture [_MainTex]
    29.                 {
    30.                     Combine texture * primary
    31.                 }
    32.             }
    33.         }
    34.     }
    35. }
    36.  
    If anyone knows a lot about shader language please tell me if you see anything that would cause this in iOS.

    Jake
     
    Last edited: Jul 16, 2013
  47. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I don't exactly know what you're intending to do here but Blend One One is additive and basically will only brighten the background. I don't know if that's what you intend? You had some other shader earlier where you had Blend DestAlpha OneMinusSrcAlpha, I was curious why you're using destination alpha? Alpha blending should be SrcAlpha OneMinusSrcAlpha. ... but maybe you are using destination alpha as part of your algorithm? If you are, it's possible that on iOS the user doesn't have a 32-bit backbuffer switched on (defaults to 24-bit I think, there's a setting in Unity). ... which would make that fail. Again, I've no idea how your system works under the hood as I don't own it, so I'm just throwing it out there.
     
  48. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    PM Sent to you.
     
  49. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Great news! Enabling the 32-bit buffer fixes the problem on iOS. Thanks for your suggestion imaginaryhuman!

    I've tested on iPad 2 and iPhone 3GS and both work as expected. For anybody else who'd like to get this working you should check the box under Edit->Project Settings->Player->Use 32-bit Display Buffer.

    So do you think there's a way to get the shader working without having to enable 32-bit mode? Or are the extra eight bits representing the alpha which is being used? (As you can tell, I know nothing about shaders :))

    Thanks for your help guys.

    Ben
     
  50. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Woo! Glad he was able to help. I am in the same boat as you. I really have no clue when it comes to shaders so this is a very good learning experience for me as well.

    I second that thank you to imaginaryhuman!

    Jake