top of page

SCANNER

The DistortionBall Shader is a stylized transparent sphere effect designed to resemble energy shields, scanning bubbles, or distortion fields. Built entirely with Unity HDRP Shader Graph, it features screen-space refraction-like distortion, dual scrolling noise, Fresnel-based edge highlighting, and depth-aware intersection fading. This breakdown dissects the shader into five functional modules, explaining the logic, key nodes, and underlying rendering principles behind each visual element.

--------------------  BREAKDOWN --------------------

PART 1 - Distortion IOR Offset

This module simulates a refraction-like effect (Index of Refraction, IOR) by distorting the scene behind the object using screen-space UV offsets. This creates a parallax-like visual that mimics light bending through a transparent medium.

  • Screen Position - Provides screen-space UVs (usually for sampling Scene Color).

  • Split & Multiply - The RGB values are scaled by the user-defined IOR_Scale to adjust distortion strength.

  • Combine & Add Noise - The offset UVs are combined and augmented with procedural noise to add dynamic warping.

  • Scene Color - The final distorted UV is used to sample the screen's rendered color.

PART 2 - Noise Scrolling

This module introduces movement into the distortion by applying time-based scrolling to noise patterns. These serve as dynamic UV offsets, adding a sense of energy flow.

Dual Scroll UV

  • Time + ScrollSpeedA/B - Two float inputs create separate time offsets.

  • Vector2 Combination - Offsets are packed into a vector for directional UV shift.

  • Tiling and Offset - Used to scroll a noise texture dynamically.

Noise Multiplication

  • Gradient Noise + Sample Texture2D - Two noise sources are layered to increase visual complexity.

  • Multiply with DistortionStrength - Amplifies the impact of noise-driven displacement.

PART 3 - Fresnel Rim Glow

The Fresnel effect highlights the edges of a 3D object based on the angle between the surface normal and the camera view vector. It enhances the visual silhouette and mimics realistic reflection behavior.

  • Fresnel Effect Node - Operates in World Space for view-dependent edge detection.

  • Power - Controlled via FresnelPower to fine-tune the glow intensity.

  • Color Blend - Blends FresnelColor with CenterColor using Lerp for smooth transitions.

PART 4 - Intersection Fading

To avoid hard edges when the sphere intersects with other geometry, depth comparison is used to create a soft fade along the edge, simulating realistic interaction with the world.

  • Scene Depth vs. Screen Depth - Computes distance from the camera to the background and the object.

  • Subtract & Smoothstep - Creates a soft mask based on how close the object is to intersecting.

  • One Minus - Inverts the fade mask for correct edge highlighting.

Application Ideas

Sci-fi Energy Shields

Scanning Spheres or Drones

Portal Effects

Time Warps or Distortion Zones

aYemsrooooom

pngkey.com-artstation-logo-png-3071381.png
Clipboard - 2024-09-16 19.24.27.png
—Pngtree—white linkedin icon png_3562068.png
transparent-essentials-icon-github-icon-github-logo-icon-6066e5d47d18e1.545284051617356244
Clipboard - 2024-09-16 19.17.23.png

Irvine, CA, USA

(+1) 949 701 7768

bottom of page