A downloadable asset pack



                                          >>>Available on the Unity Asset Store<<<

The 2D Depth of Field package simulates a 3D like depth of field in a 2D environment. It uses one shader to blur the edges of the screen like a vignette and another shader individually instanced on foreground and background sprites to increase the blur amount based on the distance of the z position from zero. The 2D Depth of Field package offers a visual effect that mimics the depth of field seen in 3D environments, but implemented within a 2D rendering pipeline. This is achieved through the strategic application of two distinct shaders.

The first shader operates by applying an adjustable radial blur towards the edges of the screen, similar to a vignette. This subtly draws the viewer's attention towards the center of the frame, contributing to the illusion of depth.

The second shader is designed to be instanced and applied individually to both foreground and background sprites within the 2D scene. This shader dynamically adjusts the amount of blur applied to each sprite based on its simulated distance from a conceptual focal plane, which is represented by a z-axis position with zero as the point of focus. Sprites positioned further away from this zero point, either in the positive or negative z-direction, receive a greater degree of blur. This varying blur intensity across different sprites is the core mechanism that creates the convincing depth of field effect. By carefully controlling the simulated z-positions of the sprites, developers can artfully guide the viewer's focus and create a heightened sense of dimensionality within their 2D projects. This technique can be particularly effective in drawing attention to key elements within the scene while subtly softening less important background or foreground details.

Included:

  • 2 Shader Graphs
  • 4 Sub Shaders
  • 2 Blur Materials
  • Sprites and Tilemaps
  • 4 Scripts
  • 2 to control shaders
  • 1 for player movement
  • 1 for a simple Parallaxing effect

Thanks For Considering!


                                             >>>Available on the Unity Asset Store<<<

Published 12 hours ago
StatusReleased
CategoryAssets
AuthorTLSAxt
Tags2D, depth-of-field, Shaders, Unity

Leave a comment

Log in with itch.io to leave a comment.