WarpViewportContainer
A
WarpViewportContainer is a Control node (based off of Godot's SubViewportContainer) that draws its child SubViewports through a distortion defined by a
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: Squeezes the sampled image along one axis by a factor that shrinks towards the container's edges.
WarpShapeWave: Ripples the sampled image like a flag. The sample is displaced across one axis by a sine travelling along the other.
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
PerspectiveViewportContainer2Dfor more specialized use cases.)
WarpShapeLens: Bends the sampled image like a lens, being either a barrel distortion or a radial distortion.
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 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) Returnsuper()plus the shape's own complaints, and notifyChanged.WARNINGSfrom 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.