Loading video...

Video Failed to Load

Go Home

#UnityTips: Progress Bar (Shader Graph) [v2] ✨ (+WebGL and GitHub Download 👇🧵) Here's an animated progress bar made entirely in Shader Graph. Use this for loading screens, player health, etc. Adding colours is just a matter of isolating the individual elements as masks. It's helpful to think of the...

61,248 views • 3 years ago •via X (Twitter)

9 Comments

Mirza Beig's profile picture
Mirza Beig3 years ago

Shader Graph. 💊

Mirza Beig's profile picture
Mirza Beig3 years ago

📸+ Shader Recipe.

Mirza Beig's profile picture
Mirza Beig3 years ago

GitHub:

Chris's profile picture
Chris3 years ago

i gotta start joining in on this vfx friday. i love working in shaders now just tinkering. you give me a lot of inspiration

Filoki'nin Patisi's profile picture
Filoki'nin Patisi3 years ago

I saw your videos from 5 years ago, you did really good work 🙏

Joe Theis | Wishlist Infiniwar!'s profile picture
Joe Theis | Wishlist Infiniwar!3 years ago

This is awesome! Now if only UIToolkit could use Shadergraph....

Binary Lunar: Wishlist Nightmare Shift of Steam!'s profile picture
Binary Lunar: Wishlist Nightmare Shift of Steam!3 years ago

Amazing , thanks for sharing 🙏

CuddlySalmon | nptacek.eth's profile picture
CuddlySalmon | nptacek.eth3 years ago

dammmmmn i implemented one of these by hand back in ~2014 and it was an insane pain in the ass to get right, this is amazing! i love the progress of technology

codedreamer's profile picture
codedreamer2 years ago

cool~

Related Videos

Today we are re-launching shaders in We call them Vibe Shaders. There's nothing else like them. They live next to your .pen files as GLSL files and can be easily vibecoded right on the canvas. Built by designers for designers. They deserved a special Shader Mode, a focused mode to finetune the uniforms directly in the context of your design. In addition to the classic Shader Fills, we've also added Shader Effects. This allows for incredible creative flexibility, as it applies the effect on a whole object tree that's part of a particular frame and you can change everything live, no hustling with textures. Additionally we are also launching Background Shaders, they sample the texture from everything below the object. Imagine creating your own custom background blur or a partial dither effect for objects below a frame. You can also create shaders with 3D transformations to vector logos or build custom shader brushes for vectors paths. Forget having just a fixed set of shaders, this is next level and only possible, because we have a full control over our custom renderer. We also automatically compute the SDF (signed distance field) in realtime, so vectors that have applied shaders can be changed directly on canvas without the need to re-export a new SDF file, an incredible time-saver. Look for the samples in Goodies, which has been updated with a ton of new examples. Or simply pair pen.dev with the latest models, drop in a bunch of images, ask agent to build you a shader and it's guaranteed you will feel an explosion of your creative superpowers!

Tom Krcha

66,914 views • 4 days ago

Great question! 🤔 How do you simulate *multiple* layers of glass/refraction in video games? In the last breakdown, I discussed how to create a glass shader in Unity URP. In essence, we were taking the render of the scene from the camera without any transparent objects. This is available in URP as the global _CameraOpaqueTexture. This is good enough for most use-cases, and more or less the classic way of doing it. 🔍 What is _CameraOpaqueTexture? As the name implies, there are no transparent objects rendered into this texture, so it's not possible by default to have something like a transparent-type ocean material/shader rendered through a refractive glass shader (which samples and distorts this texture to render on its surface, as if it's transparent). ⚠️ Why it’s tricky: It's much easier to sort without much further setup if you don't have refraction, and only a transparent material, because in that case you're not simulating the transparency yourself via sampling the rendered scene texture. But for refraction, it's required-- unless you want to go down the ray/path tracing route. You could simulate accurate, real dispersion... and that's about as expensive as it sounds, and it requires a rework of your entire rendering. --> 🚫 It's not a viable suggestion to offer. 📚 There are well-known terms regarding transparency sorting you can search up, but as you've specifically asked for refractive boxes, I'll discuss briefly about that. 🧱 Simulating layers of refraction: For this kind of rendering, you need some way to render the backfaces before rendering the front. And the backfaces that are rendered may contain whatever data you'd like for additional processing in the layer front-facing mesh render. 🧪 Examples: You could render the back face as a glass shader of its own, as an intermediate step after _CameraOpaqueTexture. Then you sample this texture instead and you end up with multi-layered refraction, "just like that". You can also render the back normals only, via a fully opaque shader, and use that to manually account for that during the front render. You could even bake in data needed for thickness in realtime. 🛠️ Without making it complicated for yourself, the most straightforward method is via render textures, and you can easily set some fractional resolution. Cameras in Unity have an open slot for target textures to render to. You can use custom render textures to process _SelfTexture2D. ⏱️ It's great to do low-resolution processing for more complex tasks, like blurring and caustics. You can get massive performance boosts, considering the square law and number of pixels/fragments that need calculations (quadratic scaling). 🚧 I've not fully exploited the possibilities myself, but research/development with PRISM is ongoing!

Mirza Beig

61,581 views • 1 year ago

🧑‍🏫 How to make a glass/refraction shader: 🍷 Refraction will ultimately have the effect that whatever is behind your mesh should appear distorted by the surface of the mesh itself. We're not going for external caustics projection, just modelling glass-like, distorting "transparency". 🌆 In Unity, you can sample the *global* _CameraOpaqueTexture (make sure it's enabled in your URP asset settings), which is what your scene looks like rendered without any transparent objects. In Shader Graph, you can simply use the Scene Colour node. 🔢 The UVs required for this texture are the normalized screen coordinates, so if we offset/warp/distort these coordinates and sample the texture, we ultimately produce a distorted image. We can offset the UVs by some normal map, as well as a refraction vector based on the direction from the camera -> the vertex/fragment (flip viewDir, which is otherwise vertex/fragment -> camera) and normals of the object. 📸 Input the (reversed) world space view direction and normal into HLSL refract. **Convert the refraction direction vector to tangent space before adding it to the screen UV.** Use the result to sample _CameraOpaqueTexture. refract(-worldViewDirection, worldNormal, eta); eta -> refraction ratio (from_IOR / to_IOR), > for air, 1.0 / indexOfRefraction (IOR). IOR of water = 1.33, glass = 1.54... 💡 You can also do naive "looks about right" hacks: fresnel -> normal from grayscale, which can be used for distortion. Or distort it any other way (without even specifically using refract at all), really... 🧠 Thus, even if your object is rendered as a transparent type (and vanilla Unity URP will require that it is), it is fully 'opaque' (max alpha), but it renders on its surface what is behind it, using the screen UV. If you distort those UVs by the camera view and normals of the surface it will be rendered on, it then appears like refractive glass on that surface. > Transparent render queue, but alpha = 1.0.

Mirza Beig

125,253 views • 1 year ago