Screen Space Mapping

From Shader Forge Wiki
Jump to: navigation, search
Screen space mapping.png

Screen space mapping is a technique for projecting textures flat from the camera. The node setup for this is quite straightforward.

The screen position node outputs the position of the current pixel being rendered, in screen space. It's set to "Tiled" to prevent stretching across the whole screen.

This coordinate system has 0 in the center, which we usually don't want, so we'll remap the values from a [-1 to 1] range to a [0 to 1] range.

This is then plugged in as UV coordinates of a texture sampler, and is plugged into emission.

Note that screen coordinates are per-vertex by default, which may cause distortion if the triangles cover a large area of the screen. You can enable per-pixel screen coordinates checked in the shader's quality settings to prevent this.