Search Unity

NextGenSprites – Modular Shader for Sprites -> Reflections, Liquid, Dissolve & more!

Discussion in 'Assets and Asset Store' started by garrido86, Nov 3, 2015.

  1. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Screen Overlay is not supported but I will look into it, maybe I can make a special UI Shader.
     
    emoritz45 likes this.
  2. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    I have normal mapped sprites with the standard shader giving order in layer, receiving shadows and diffuse tint/colour etc. but when my main character flips he disappears. If I turn off backface culling then the normal maps are inverted when he flips.

    Does this shader support flipped sprites with normal maps that can still be tinted or receive shadows?

    Is there any way I can trial this asset?
     
  3. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    You can either rotate or flip( by scaling x -1) with no problems, at least no other users reported any problem on this topic :)


     
  4. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    I just downloaded and imported the full package but I get this red error:
    Property (_Layer4) already exists. Use SetTexture instead.

    I've tried the shader on my main character but I'm having several issues:

    My normal map is not affecting the sprite and the sprite is overlapping everything - the order in layer seems to be ignored.

    Also, the sprite only receives shadows when facing right (not when facing left), and is not receiving ambient light when shadowed.





    This is the standard shader for reference:



    Here I switched the rocks to your shadowed shader with their normal maps applied:


    Right now it seems your shader does nothing it claims..
     
    Last edited: Apr 3, 2016
  5. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    I will look now into it, but if things don't work out for you, I can give you a refund.

    /edit
    Do you mind sharing your scene? This would make troubleshooting faster and easy.
     
    Last edited: Apr 3, 2016
  6. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    Thanks. I'd rather have it working than a refund, but see how you go.
    I'm using deferred rendering and I have a single directional light in the scene.

    When I switched my material to your shader, it automatically picked up the normal maps that I was already using, and the sprite seems to be lit correctly in the inspector preview but is not lit correctly in play mode at all..
     
  7. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Have you tried the provided demo scene in you project? Does it have any glitches?

    /edit
    Have you enabled double sided on the Materials?
     
    Last edited: Apr 3, 2016
  8. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    Yes I enabled doublesided (you'll note that the rear of the sprite is drawn when flipped). Also multi-light and Shadow Receiver as you have.

    Also the square fields in the inspector that show the normal maps and diffuse maps are slightly squashed and distorted (it's a rectangle instead of a square), and the images look taller but that's not my main concern right now and it doesn't affect the scene or play mode in any way..

    I haven't tried the demo scene.
     
  9. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    How do you "make" the shadows in your scene? Do you use some kind of plugin like the "2D Dynamic Lights" asset?

    In NextGenSprites you receive shadows by having the sprites which are supposed to cast the shadow be physically on the Z-Axis in front of the shadow receiving sprites - well basically we handle them like normal 3D Objects.

     
  10. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    The shadows are the default shadows from 3D geometry.
     
  11. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Well I am kinda out of fire here and this guesswork is not very productive, so with that I only see two options:
    - You send me an example Scene of your project so that I can troubleshot your lighting problem.
    - I refund you.

    So please, don't get me wrong, I really like to help but troubleshooting remotely without insights into the project is not trivial.
     
  12. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    I tried your example scene and found that your normal maps are only responding to your point light and not your directional light so that would be the first thing to fix. Some of the other effects like reflection seemed to have no effect and I didn't see anything on double sided sprites..

    Though turning on bloom and hdr were a nice idea so thanks for that.
     
  13. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Alright after some intensive investigation I found two bugs on my ShadowCasting renderpass:
    -Culling was not disabled
    -Point Lights where ignored

    Both are now fixed and will be submitted ASAP to the AssetStore!
    Itch.io customers may receive the update already today or the next day.

    @Cereal_Killa
    If you bought NGS here on the AssetStore, then please send me a PM with your Invoice Number so that I can pass you directly the fixed version!

    Edit
    Changelog:
    Edit2
    Normal Maps work with Directional and Point/Spot Lights simultaneously perfectly fine as long you use the Multi Lit and not Single Lit Shader.

    When you enable the Reflection feature the strength is set by default at 0, so that you can ramp it up at your liking. Note: for real time reflections you need to use a Render Texture.
    The double sided feature allows Sprites to be lit from the backsite (i.e. flipped or rotated) and corrects the normal direction.
     
    Last edited: Apr 5, 2016
    jasonMcintosh and hopeful like this.
  14. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    I've been trying your asset, seems great, but I am struggling with one point : How can I change the hue shift properties of a material through scripting? Let's say I want to change the brightness value in code. I'm not seeing any enum value under ShaderFloat that would allow me to do that. Am I missing something?
     
  15. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Hello Miguel,

    you need to use the ShaderVector4, it goes like this:

    Code (CSharp):
    1.         //define a new Vector4
    2.         var hsbc = new Vector4 ();
    3.  
    4.         //Set the desired values - make sure they are in range from 0 - 1
    5.         //Hue
    6.         hsbc.x = 0.5;
    7.         //Saturation
    8.         hsbc.y = 0.35;
    9.         //Brightness
    10.         hsbc.z = 0.75;
    11.         //Contrast
    12.         hsbc.w = 0.25;
    13.  
    14.         //Apply them
    15.         TargetMaterial.SetVector (ShaderVector4.HSBC.GetString (), hsbc);
    I hope this helps :)
     
  16. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,193
    Hi, I just purchased this package and I'm wondering about the Dissolve Patterns. In the demo there are multiple patterns, but I only see "dissolve_demo" in the actual package. Am I missing something or are the other patterns not included with the package?
     
  17. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    You can find the Bootstrap Assets on the Wiki.

    http://wiki.next-gen-sprites.com/doku.php

    On the righthand side you can see the Download button.

    You can also create your own dissolve maps, they are basically grayscale images.
    Just experiment a bit in Photoshop and you will find out how to create your own dissolve maps :)
     
  18. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,193
    Thanks garrido!

    I could create my own, but you've already created so many excellent textures, why bother? Seriously, great work. 5 stars for sure!
     
  19. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Awesome, I am happy to know that you like the Bootstrap Assets! ;)
     
  20. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    Hey Garrido, how do I actually enable or disable the hue via script? C# preferably.... ;)
     
  21. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    No worries, I worked it out:

    Code (CSharp):
    1. material.EnableKeyword("HSB_TINT_ON");
    Also, you can define the Vector4 hsbc as a "Color hsbc" in Unity as technically they are the same thing in shader terms, I think.
     
    garrido86 likes this.
  22. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    I can't exactly follow you. The HSBC property on the Shader is already a Vector4. Or do you mean using a Color Inspector field for the Material Editor? Either way, I am happy to know that you got the Shader feature toggle working :)
     
    Last edited: May 24, 2016
  23. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    @garrido86 Hello :)
    I bought your asset and it's even better than I expected!!!
    but I can't find the animation listener( code to handle the properties collection, that you said in a video tutorial).
    I also tried to find it on the links of that specific video, but the link is not working...
    can you help me? :)
     
  24. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Zehru likes this.
  25. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Wow... that was a fast reply :)
    congratulations for the brilliant asset and for the very nice and fast support.
    after buying your asset my game started to get reeally better to look at :D
    when I have enough, I'll send you a demo of the game( if you want) and also, I'll put your name on the "Special Thanks" on the credits of the game :)

    but I'm still with the same problem :( , because the code "Animation Event Listener" is not there in your new Github account
     
    Last edited: Jun 24, 2016
    theANMATOR2b likes this.
  26. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Wow that would be really awesome! I am also happy that you have good use for NGS :)
    What kind of Game are you working on?

    I will look at it ASAP once I am home back from my day-job!

    @Topic
    Updates where kinda slow but I will work on remake the Web-Demo and include it into the Asset. You will be able to use it's assets for your own game :) I am also thinking making a iOS and Android Benchmark app, so that you can validate it for your target mobile platforms.
     
    theANMATOR2b and Zehru like this.
  27. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    I'm working on a platfomer with some RPG aspects a.k.a "metroidvania style" :)

    okay, I'll be waiting :D
     
  28. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    I love Platformer! Can't wait to see it :) I also once worked myself on one but it was 3D and gave up due to time constraints and missing budget. Though you can watch here a Pre-Alpha build:


    Anyway, I must excuse myself but the Animation Tutorial on youtube is actually deprecated and I will delete it asap!
    This is the new animation Tutorial is kinda hidden because it is part of the 1.2 Update Walkthrough:


    Note: You mustn't create a new Property Collection each time, you can use the export function from the Material Inspector and then duplicate it to make the variations.
     
    theANMATOR2b and Zehru like this.
  29. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Nice game you were doing :D
    This kind of art generally fits well with crazy and unique game mechanics :D really reminds me of games released to nintendo ^^

    Thank you very much for the tutorial!!! :D
    it's working now :)
     
    garrido86 likes this.
  30. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    This looks useful! Dumb question, but what's the difference between this solution and the built-in Standard Shader? I've been using increasingly modified versions of the Sprite/Default and Sprite/Diffuse shaders, but the more I read about this, the more I forget why we don't just use the Standard Shader for 2D as well.
     
  31. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    The standard 2D Shader offers none of NGS features, there is no Normal Mapping, Hue Shift, Emission Masking, Dissolvement etc.
     
  32. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    Not the default 2D shader, but the Standard Shader that you're supposed to use for 3D. If I recall correctly, you can set Render Mode to Fade to enable alpha, and it supports features like normal maps. I had tried it with 2D back when I was first learning Unity, but I switched to the default 2D shaders because I figured you were supposed to, and now I'm wondering if that wasn't necessary at all.
     
  33. superwendel

    superwendel

    Joined:
    Jun 18, 2013
    Posts:
    105
    Hey Ruben, may I ask that you push the 1.3.9 update to Itch.io?

    I also noticed that the Bootstrap assets, at least in 1.3.7, isn't there in the Extras folder. Looking to play with those again. :)
     
  34. kostet1977

    kostet1977

    Joined:
    Mar 30, 2015
    Posts:
    11
    I have a repetitive issue with this asset. I`ve created material with reflection, applied to cut-out character. It`s working Ok with one single sprite, but when I drag the different sprite on the scene (actually the different part of multi-sprite atlas) the scrolling speed of reflection stop working (as if it was zero valued).
     
  35. kostet1977

    kostet1977

    Joined:
    Mar 30, 2015
    Posts:
    11
    Helloooo! is somebody here?! Need to finish the project!
     
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    Devs don't always receive prompt notification of new comments on their forum threads. If you want to get in touch with @garrido86 right away, then contact him via PM or his support email.
     
  37. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    Hi, @garrido86, your plugin is very helpfull. a question, do you have a sample to use your shadow shader?
    Thanks a lot!

    Stefano
     
  38. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Here you go mate:

    Jump to minute 4, this is the section where I start to talk about shadows.
    If this is isn't enough intel, just let me know :)

    Yep you are right, but I will look from now on more often in this thread.
    The bootstrap assets can be found on the Wiki page: http://wiki.next-gen-sprites.com/doku.php
    On righthand side you can the download button.
    I am very sorry that I couldn't respond sooner, do you still have those issues? Are the textures set in the settings to "repeat"?
     
    Zehru and lordubik like this.
  39. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hi @garrido86 !
    I restarted doing my entire project optimizing it and doing it better, so I still don't have a beta to send to you, but when it's ready, I'll send you like promised before :D

    I just have a question.

    Is this asset still going to be updated?
    I ask this due to the fact that Unity engine is getting lots of improvements, and maybe now, shader can achieve new stuff that they weren't able to achieve before :)
    thank you for your time and congratulations for this amazing asset :)
     
  40. emoritz45

    emoritz45

    Joined:
    Jun 4, 2015
    Posts:
    1
    This would be massivley helpful for me. I'm guessing many others use Screen Space - Overlay as well!
     
    Zehru and Yukichu like this.
  41. unstablesun

    unstablesun

    Joined:
    Jul 19, 2017
    Posts:
    2
    Awesome, awesome product. Having a lot of fun with it. Have a question about lighting. I've set everything up in the scene as per the instructions. My directional light works but when I add a point light nothing is affected by it. Using 5.6.2f1. Camera is using unity's new post processing for bloom (instead of legacy effects) Sprites are using lit shaders with normal maps. As I said the directional light is affecting the sprites and they look awesome but adding a point light to the scene does nothing. Thanks for the great product!

    Edit : Got it working. Sprites need the multi lit shader to be affected by point and spot lights. Single lit shader is affected by directional light though which is cool.
     
    Last edited: Jul 20, 2017
  42. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    I'm sorry to not have responded earlier to you, as I'm currently moving to a new city for a job opportunity.
    But I'm glad that you got it sorted it and please let me know if you need more help!
     
  43. Crystan

    Crystan

    Joined:
    Oct 11, 2014
    Posts:
    20
    Hi,
    over a week ago I tried to contact the author of this asset but i haven't recieved any reply to my mail yet, so I'm going to ask here in the hope that either the dev or someone who bought the asset can answer my question.

    I'm currently developing a 2.5D game and I'm looking for advanced sprite shader and it looks like this asset would be a really great addition to my game.

    To cut a long story short: I basically just want to make sure the shader performs fine when using the perspective view. I would be grateful if anyone can answer me this question. :)
     
  44. superwendel

    superwendel

    Joined:
    Jun 18, 2013
    Posts:
    105
    I use it on an orthographic camera normally but I've never had issues when trying it over on a perspective camera.
     
    Crystan likes this.
  45. Crystan

    Crystan

    Joined:
    Oct 11, 2014
    Posts:
    20
    Ah this sounds good! And thanks for replying to my question. :)
     
  46. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    Can I ask, is NextGenSprites supported on consoles?
     
  47. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    Hi, I have imported the plugin in unity 2017 but doesn't works; do you have in schedule to create a compatible version? :) Thanks!
     
  48. revanaii

    revanaii

    Joined:
    Jun 13, 2017
    Posts:
    11
    Unity 2018.1.0b7, macOS

    :c
     
  49. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hey @garrido86 !
    There is a new update online on asset store. :D
    That made me really happy, as this is one of my favorite assets. I'll try it today again :)
     
  50. UnlimitedHugs

    UnlimitedHugs

    Joined:
    Sep 24, 2012
    Posts:
    1
    These are gorgeous- excellent work.
    Came for the dissolve shader, got an entire sprite shading suite instead :D