Gaming
Индустрия· Latest Game Industry News | 80 Level· Amber Rutherford

Add Four-Point Perspective Warping To 2D Sprites In Godot

Draggable corner handles, carousel drivers, and SubViewport input forwarding.

If you want to give a 2D piece of paper some depth, create a point-and-click game with pseudo-3D elements, or just play around with 2D perspective effects, Perspective Quads by BunkWire2X8 could come in handy. It's a collection of specialized nodes that let you apply four-point perspective warping to 2D sprites.

PerspectiveQuad2D is a Node2D that lets you apply four-point perspective warping to a Texture2D, so you can place it across four custom corner points. PerspectiveQuadShape is a resource you can use with PerspectiveQuad2D to blend between different shapes and modulations.

Carousel2D provides a shared view position that other nodes can listen to. This lets you control PerspectiveQuad2Ds and CarouselAnchor2Ds together and create 2D scenes with pseudo-3D effects. CarouselAnchor2D uses the Carousel2D's view position to interpolate between different keyframe transforms. You can edit the keyframes right in the inspector, and the node is useful for positioning other elements that aren't PerspectiveQuad2Ds.

Lastly, PerspectiveViewportContainer2D works similarly to a SubViewportContainer, but adds perspective warping. It displays the contents of a child SubViewport with the perspective effect and also forwards input to it.

To use Perspective Quads, you'll need Godot 4.6 or later. The add-on has some limitations, which you can check out on its Asset Store page.

If Godot is your game engine of choice, we've also shared some cool guides recently, including Calin P's look at authentic PlayStation 1-style rendering and Emil J's tutorial series on creating water:

Открыть оригинал