Search Unity

[RELEASED] Resource Bubble Shader

Discussion in 'Assets and Asset Store' started by Alexander-Dubrovsky-Jr, Dec 16, 2015.

  1. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Resource Bubble 1.0

    Resource Bubble is a shader designed to help you create a resource orb (or bubble :] or globe :] ) for display of HP/MANA/ENERGY or any other resource. Asset package contains shader itself orb model as well as a set of textures for the shader.​
    • 20+ textures for "liquid" part of the orb.​
    • 3 mask textures that control how "liquid" fades into "hotline"​
    • 1 scratched glass orb texture​
    • 1 hotline texture​
    • multiple complimentary textures (dragon, spikes) that were used in the demo.​

    You select what textures you want to use and set scroll speed for x and y axis of each texture.Shader also allows setting color for the "liquid" part and the "hotline" part. Shader fill is controlled using single float value.

    Orb model is used to add depth and roundness to the globe. You can still use this shader with standard unity UI Image but in this case, orb will appear flat.​









     

    Attached Files:

    Last edited: Dec 21, 2015
    Bhanshee00 and carsenk like this.
  2. giotta

    giotta

    Joined:
    May 31, 2015
    Posts:
    46
    Finally a good asset for life / mana Obrs
     
  3. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    It's a nice asset, but if you ask me, it would be much more appreciated if you would make it so that it would work properly with UGui, because i don't think people would be happy to have two solutions for HUD at the same time when they can easily use the UGui for most of stuff, the problem would be how to use your system in combination with new unity's gui system :/

    also, i think a description of what each one of the first three textures do in detail would be nice.
     
    Last edited: Feb 25, 2016
  4. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Actually the shader itself can be used with uGUI (but in this case we
    sacrifice depth).

    The WebGL demo has this uGUI asset variation.

    Bring depth to uGUI version is in my TODO list. So far I did not find an efficient way to achieve this, however I am working on it
    upload_2016-2-25_18-10-38.png
     
  5. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    If by depth you mean how three textures would blend, did you give compute shaders a try? they can read and write to textures very fast, not sure how would you convert a texture 2D to a sprite by code to use in UGui though, but using compute shaders would let you use all the power from GPU to calculate new textures at run time !
     
  6. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    By depth I mean that orb appears to be 3D. You can see how "mana" bends and wraps around orb inner walls during movement. I do not get the same effect when simply using material on uGUI image. But I guess this "depth" is very subtle right now. I have to emphasize this in feature updates. I guess this asset is in dire need for a proper web demo with uGUI and mesh prefabs side by side on the same screen.
     
  7. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Take a look at this page, it has a spherical distortion, i am not sure if it would be easy to convert it to be used by a shader or not but it worth giving it a try, if you are registered (free) then you can download the source and take a look into it

    http://www.codeproject.com/Articles/3419/Image-Processing-for-Dummies-with-C-and-GDI-Part
     
  8. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Last edited: Feb 28, 2016
  9. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Thanks I will check them both out.
     
  10. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    Is there anyway to get this shader to work with uGUI's scrollbar Fill transform? My scripts interact with the fill to update the globe, so can it be set as the Fill rect on a Slider component?
     
  11. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Are you using Scrollbar's Handle width Image script with Image Type = ""Filled" and "File Amount" drives your bar ?
    Is this setup correct ?

    upload_2016-5-6_23-11-10.png
     
    carsenk likes this.
  12. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    EDIT: Just purchased :D wanted to support you on this!

    EDIT Again: Got it working :) looks awesome! I am wondering thought it seems like they are affect by light in the scene if you are moving a player camera around, is there anyway to avoid this so that they dont "flicker"?
     
    Last edited: May 7, 2016
  13. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Please contact me @ alexander.dubrovsky.jr@gmail.com and we will fix the issue.

    In general the asset should not be affected by lights.

    This video is my attempt to make it flicker. As you can see it does not flicker when I move the camera and move around.Sorry for the chunky frame rate.



    upload_2016-5-7_9-44-15.png
     
    carsenk and Bhanshee00 like this.
  14. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    I got it working :) I basically had to setup my UI image globes that have the material attached on a separate canvas than the one I was using. It is working beautifully now! :)

    I have it setup as a material on an Image, my script is all custom coded now to update the progress float :) working great, amazing asset man! A++++++!!!!
     
  15. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    I am glad to hear that ! :)
     
    carsenk likes this.
  16. DarkArts-Studios

    DarkArts-Studios

    Joined:
    May 2, 2013
    Posts:
    386
    I have tried for hours to get this to work within UGUI without success. All the sprites (as soon as I add any Resource Bubble material to a UGUI sprite) are 100% black.

    I think this may or may not be related to https://issuetracker.unity3d.com/is...s-not-render-in-the-game-view?page=1#comments

    ... however surely there must be someone that's got this to work, within UGUI, within a canvas as ScreenSpace - Overlay for the canvas Render Mode.

    Any advice would be greatly appreciated!

    Thanks
     
  17. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    I've made a hotfix. Please contact me via support email I will send you fixed shaders.
    It will be 5-10 work days before fix gets published due to the lengthy approval process.
     
  18. DarkArts-Studios

    DarkArts-Studios

    Joined:
    May 2, 2013
    Posts:
    386
    You sir, are fantastic!

    Incoming email, thank you.
     
  19. TBruce

    TBruce

    Joined:
    Jan 18, 2015
    Posts:
    86
    Great asset but I am having a big problem trying to create another globe for the right side of the screen
     
  20. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Hi Mavina,

    I have created a demo with two globes. Please contact me via support email (alexander.dubrovsky.jr@gmail.com) and I will send it to you.

    If this demo is not what you are looking for then:
    1) You can also send me an example project that illustrates your problem.
    2) Or you can write more detailed description of the problem. (Cameras: 2d / persp, Globe: mesh / UGUI (+ Canvas render mode) / Sprite )

    Then I will assemble a project that fits your requirements and send it to you via email.
    upload_2016-6-4_11-10-27.png
     
    Bhanshee00 likes this.
  21. clerify

    clerify

    Joined:
    Feb 27, 2016
    Posts:
    14
    Hi Alex,

    A great improvement to your tutorial would be to simply use the demo scene and display the inspector while the globe is selected. Your current video displays a very inefficient method when we can instead use the demo scene to figure out what values we want the prefab to have.

    demo.png
     
    Bhanshee00 likes this.
  22. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Hi clerify,

    There is a video that does what you have described. At least I think it does. =) Correct me if I am wrong.



    However I think there is a lot of room for improvement anyway.
     
  23. robin-gallimard

    robin-gallimard

    Joined:
    Feb 2, 2015
    Posts:
    6
    Hi Alex,

    Have you tested your asset on mobile devices? Does it perform well on iOS and Android ?
    I have not found anything concerning mobile support.

    Cheers
     
  24. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    This asset was created with desktop machines and consoles in mind.I have no data about is performance on IOS or Android.
    I will share the link to the "cloud build" apk soon.
     
  25. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
  26. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    upload_2016-7-27_19-1-4.png

    Here is the QR code for the apk mentioned above.
     
  27. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    544
    Hi, is there a way to enable the scrolling regardless of what the timescale is? I'd like to be able to choose to have it still work while my games is paused but when time.deltaTime = 0 the scrolling stops altogether. THx
     
  28. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Hi Chris,

    There is no build in option for that. The only option is to edit the shader, change all _Time[0] to float parameter and pass an Time.unscaledTime to the material using setFloat method.

    Check your email, there is a demo package that has altered shader version.
     
  29. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    544
    Hi, messing around some more with this. Quick suggestion is to perhaps prevent the hotline from wrapping around back to the other side. With some of my setups I get the glow showing on the opposite side once progress gets close to zero or 1. Thx!

    Edit: I just scrunched in the UI textures from the edges a bit, problem solved!
     
    Last edited: Oct 11, 2017
  30. Ivy-SM

    Ivy-SM

    Joined:
    Apr 18, 2013
    Posts:
    29
    Hi,
    I imported your asset in a 2018.1 beta project, but I get these shader errors:
    Shader error in 'Custom/GlobeSpriteCutoutShaderV2': Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line 29
    Shader error in 'Custom/GlobeCutoutShader': Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line 29
    Shader error in 'Custom/GlobeShader': Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line 28
    Any idea what's wrong?
     
  31. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Looks like Unity changed something under the hood.
    GlobeShader needs a full rewrite or at least it should lose one of his textures.
     
  32. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Looks like it is time for this package to become deprecated.
     
  33. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    544
    :(
    I really love this asset.
     
  34. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    185
    Why deprecate something when it doesn't work with a unity beta version....seems kind of silly to me.
     
  35. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    544
    Soooo, not sure what happened within Unity that caused this but I have a quick solution as long as your target platform isn't axed...

    add the following line to the offending shaders:
    #pragma target 3.5

    and everything works normal. Here's a link to anyone wanting to know the difference between shader models...
    https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html
     
  36. Alexander-Dubrovsky-Jr

    Alexander-Dubrovsky-Jr

    Joined:
    Mar 21, 2015
    Posts:
    20
    Frankly I am too busy to update it. And I wont be able to provide decent support.
    Usually it takes month or two for Unity to transition from beta to a stable release.
     
  37. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    900
    This seems to work just fine. You can see the demo scene's bubble looks just fine. I'm not sure why I have that thing in the upper right, if that is normal or something that changed. DemoScene.jpg

    I think it would be a good idea to note that you have to add that #PRAGMA line specifically under the CGPROGRAM section. I've never messed with Unity's shaders so I had no idea where to put it until I looked in the documentation a bit.

    @Alexander-Dubrovsky-Jr

    It's a shame that you are preferring to deprecate this asset instead of fix it for modern versions of Unity. It's a really nice asset and I would think it is still quite relevant(as in it hasn't been replicated internally by Unity or anything, or any other asset that I know of either). Wouldn't it maybe be a good idea to just add that #PRAGMA line to that shader to keep it up and going? Is there something in the asset store rules that don't allow you to directly target a shader version?
     
  38. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    544
    Very glad you see this un-deprecated! :D
     
unityunity