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

Happy new year everybody!

NextGenSprites has been updated to 1.2.1 with mostly bug fixes and changes here and there, though there is one new feature and that is a method to change materials smoothly from a Properties Collection.
This Update is already online on itch.io and it is also awaiting for approval from the AssetStore Team.

Changelog

+++Please Note+++

If you come from a previous Version, you may need to delete:

  • *NextGenSprites/Utils/Helpers/PropertiesCollectionManager.cs
  • *NextGenSprites/Utils/Helpers/PropertiesCollectionSoloManager.cs

NEW

  • Added a method to update materials smoothly by a supplied duration to the Properties Collection Handler and Controller

UPDATE

  • Renamed Scripts related to Properties Collection to be more explicit about their purpose
  • Some simple custom inspectors for the Properties Collection Proxy classes

FIX

  • Errors when invoking some buttons on the extras Panel from the Material Inspector
  • Preferences are now saved per Project and not global
  • Several smaller bug fixes on Shaders and Scripts
2 Likes

Happy new year!!! :slight_smile:

1 Like

Hello are you planning to integrating with DOTween pro?

Do you have anything specific in mind? I could add a helper function for tweening Shader property values and also transitions between two materials.

edit
There actually is already float and color tweening in dotweening, check DoTweens docu :slight_smile:
Example:

//Tween over 5 seconds the Blur reflection to 0.1
myMaterial.DOFloat(0.1f, ShaderFloat.ReflectionBlur.GetString(), 5f);

edit2
I have now requested the DoTween author to add Material transition tweening. Let’s hope it comes soon :slight_smile:

:)[quote=“garrido86, post:24, topic: 604007, username:garrido86”]
Do you have anything specific in mind? I could add a helper function for tweening Shader property values and also transitions between two materials.

edit
There actually is already float and color tweening in dotweening, check DoTweens docu :slight_smile:
Example:

//Tween over 5 seconds the Blur reflection to 0.1
myMaterial.DOFloat(0.1f, ShaderFloat.ReflectionBlur.GetString(), 5f);

edit2
I have now requested the DoTween author to add Material transition tweening. Let’s hope it comes soon :slight_smile:
[/quote]
Yes my bad i don’t read the doc properly,anyway material transition sounds wonderful

Your wish shall come true, I have worked today on the material transition and already submitted my new version to the AssetStore :slight_smile: To use the feature, you need to instantiate an DualMaterial object which you feed two source materials.
DualMaterials returns the lerped material and the lerp itself can be set via the LerpMaterial method. And from here you can use a Tweening Engine like DoTween to handle the lerping animation.

I have included a simple demo scenes which explains better how it works. I will also update the wiki asap.

Please note that DualMaterial only takes the float and color values, textures currently are not supported.

Some might wonder why I went all the length to implement my own material lerping if unity already provides a Material Lerping feature? Well, the problem is that Unity’s lerping method only interpolates internally with an easeInOut easing and this obviously breaks other Tweening Engines.

Oh and before I forget to mention;

NextGenSprites is currently 75% Off on sale!

edit
I have added an article about the Dual Material to the wiki.

Yeayyyyy u made my day…

I just purchased this and was super excited and hoped to be able to integrate this on my UI but am using screen space overlay… which looks to be a deal breaker right? There’s no way to have these shaders on a screen space overlay or camera correct? Getting a world space canvas to scale for multiple resolutions seems like a major headache… any pointers on how best to do this because I must say these effects are really freaking sweat.

Edit- ok, never mind, it looks like it works fine with screen space camera. :slight_smile: saweeet!

1 Like

I am glad you got it resolved, if you have any other issue, questions or requests, just let know! :slight_smile:

Hi Garrido
i Just bought your asset and i have a problem.
I am making a isometric game and I had my sprites with a custom shader for solving the z depth /sorting layer issue.
The problem is that i can’t use this shader with your asset because i can’t have both running.

How Could i fix this ?

The problem happens this way.
As seen in picture i have 2 sprites that act as background (horizontal) and a character sprite who is vertical.
the 2 background sprites, the island and the ocean has the nextgen shader. the character has the sprite default shader and as you can see, it looks good.

But when i activate the nextgen shader in the character it disappears, covered by the 2 background images.

i can fix it via script with this code

         GetComponent<SpriteRenderer>().sortingOrder = Mathf.RoundToInt(transform.position.y * 100f) ;

but i hope i could solve this with shaders like I had it before.
By the way no possibility of cast shadows?


Do you mind to send me your old custom shader? Then I can look into it :slight_smile:

Edit

To clarify, you can already cast shadows with NGS Shaders, that’s no problem. Just enable Shadow Casting on the Sprite Renderer and you are good to go. But receiving Shadows is not possible but you can always use a plane.

Great news!
I have submitted NextGenSprites 1.3 to the AssetStore and itch.io will follow tomorrow.

What is new?
-Shadow Receiving(!)
-Unlit MegaStack (stack up to 10 Sprites)

See for yourself:

Shader "Sprites/Bumped Diffuse with Shadows"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
        _BumpMap ("Normalmap", 2D) = "bump" {}
        _Color ("Tint", Color) = (1,1,1,1)
        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
                _Cutoff ("Shadow Alpha Cutoff", Range (0,1)) = 0.5

    }

    SubShader
    {
        Tags
        {
            "Queue"="AlphaTest"
            "IgnoreProjector"="True"
            "RenderType"="TransparentCutOut"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
           
        }
            LOD 300


        Cull Off
        Lighting On
        ZWrite On
        Fog { Mode Off }
       

        CGPROGRAM
        #pragma surface surf Lambert alpha vertex:vert addshadow alphatest:_Cutoff
        #pragma multi_compile DUMMY PIXELSNAP_ON

        sampler2D _MainTex;
        sampler2D _BumpMap;
        fixed4 _Color;

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_BumpMap;
            fixed4 color;
        };
       
        void vert (inout appdata_full v, out Input o)
        {
            #if defined(PIXELSNAP_ON) && !defined(SHADER_API_FLASH)
            v.vertex = UnityPixelSnap (v.vertex);
            #endif
            v.normal = float3(0,0,-1);
            v.tangent =  float4(1, 0, 0, 1);
           
            UNITY_INITIALIZE_OUTPUT(Input, o);
            o.color = _Color;
        }

        void surf (Input IN, inout SurfaceOutput o)
        {
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
            o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
        }
        ENDCG
    }

Fallback "Transparent/Cutout/Diffuse"
}

what happened with this update?

1.3 is now Live on the AssetStore, have fun!

[NEW]

  • Added an additional Standard “Shadowy” Shader variation which can receive Shadows.
  • Added MegaStack Shader. Based on Unlit shader and stacks up to 10 Sprites.

[UPDATE]

  • Unlit now supports Curvature (fixed front directional)
1 Like

Don’t forget about itch.io Ruben. :slight_smile:

The last update I received on there was for 1.2.1.

Please excuse :sweat_smile: my delay, 1.3 now uploaded and ready for download!

Is this compatible with spritelamp produced data such as normal maps, depth maps, occlusion maps, specular maps, etc.
Does it allow for self shadowing, specularity, etc?

Is it compatible with pixel perfect addons?

Hey I noticed you put your asset on sale and was wondering how long you were going to keep it at that price? If you don’t mind me asking.