Media preview
Media thumbnail
Media thumbnail
Media thumbnail
Media thumbnail
Media thumbnail
Description
Changelog
Reviews (0)

WarpViewportContainer

Godot 4.5+ ko-fi

A WarpViewportContainer WarpViewportContainer is a Control node (based off of Godot's SubViewportContainer) that draws its child SubViewports through a distortion defined by a WarpShape WarpShape resource, and forwards pointer input through the same distortion, so clicks, hovers and drags land on the right control (or Area2D) inside the viewport.

WarpShapes

Each shape owns the ShaderMaterial, the uniforms it writes, the CPU remap the pointer path mirrors, and the coverage mask. Pick one in the container's warp_shape field, or leave it empty to draw the viewports unwarped.

  • WarpShapePanorama WarpShapePanorama: Squeezes the sampled image along one axis by a factor that shrinks towards the container's edges.
  • WarpShapeWave WarpShapeWave: Ripples the sampled image like a flag. The sample is displaced across one axis by a sine travelling along the other.
  • WarpShapePerspective WarpShapePerspective: Draws the sampled image into an arbitrary quadrilateral from four corner positions. (Based off of my Perspective Quads addon's implementation, which has a PerspectiveViewportContainer2D PerspectiveViewportContainer2D for more specialized use cases.)
  • WarpShapeLens WarpShapeLens: Bends the sampled image like a lens, being either a barrel distortion or a radial distortion.
  • WarpShapeSphere WarpShapeSphere: Wraps the sampled image around a sphere. The sphere is only circular in UV, meaning that the sphere is displayed as an ellipsoid whenever the container's rect is not square.

Writing your own WarpShape

Subclass WarpShape WarpShape and implement:

  • _default_shader(): Returns the shader that the generated material runs.
  • _collect_uniforms(): Returns every uniform within a dictionary as uniform names pointing to callables that return the values needed by the generated material.
  • _warp_uv(): The CPU remap that mirrors the shader's UV operations.
  • _collect_validation_issues(): (Optional) Return super() plus the shape's own complaints, and notify Changed.WARNINGS from every setter that could change the answer.

Additionally, make sure every setter touches the uniforms they moved and correctly notify how the shape was changed.

Example:

func set_warp(value: float) -> void: if warp == value: return warp = value _touch_uniform(&"warp") _notify(Changed.UNIFORM | Changed.GEOMETRY)

Changelog for version v1.0.0

2026-11-03 23:00:00

No changelog provided for this version.

Reviews

WarpViewportContainer has no reviews yet.

Login to write a review.

Consider supporting the creators!

If you enjoyed this asset consider supporting its creator. Follow the link below.