Add README files to Viewport demos
20
viewport/2d_in_3d/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# 2D in 3D
|
||||
|
||||
A demo showing how a 2D scene can be shown within a 3D one using viewports.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
## How does it work?
|
||||
|
||||
The Pong game is rendered to a custom
|
||||
[`Viewport`](https://docs.godotengine.org/en/latest/classes/class_viewport.html)
|
||||
node rather than the main Viewport. In the code,
|
||||
`get_texture()` is called on the Viewport to get a
|
||||
[`ViewportTexture`](https://docs.godotengine.org/en/latest/classes/class_viewporttexture.html),
|
||||
which is then assigned to the quad's material's albedo texture.
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
0
viewport/2d_in_3d/screenshots/.gdignore
Normal file
BIN
viewport/2d_in_3d/screenshots/pong.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
20
viewport/3d_in_2d/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# 3D in 2D
|
||||
|
||||
A demo showing how a 3D scene can be shown within a 2D one using viewports.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
## How does it work?
|
||||
|
||||
The 3D robot is rendered to a custom
|
||||
[`Viewport`](https://docs.godotengine.org/en/latest/classes/class_viewport.html)
|
||||
node rather than the main Viewport. In the code,
|
||||
`get_texture()` is called on the Viewport to get a
|
||||
[`ViewportTexture`](https://docs.godotengine.org/en/latest/classes/class_viewporttexture.html),
|
||||
which is then assigned to the sprite's texture.
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
0
viewport/3d_in_2d/screenshots/.gdignore
Normal file
BIN
viewport/3d_in_2d/screenshots/3d_in_2d.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
@@ -1,4 +1,4 @@
|
||||
# 3D scaling
|
||||
# 3D Viewport Scaling
|
||||
|
||||
This demo shows how to scale the 3D viewport rendering without affecting
|
||||
2D elements such as the HUD. It also demonstrates how to toggle filtering
|
||||
@@ -9,3 +9,13 @@ the main game area and a non-pixel-art viewport for HUD elements.
|
||||
|
||||
ViewportContainer can also be used to display a viewport in a GUI, but it
|
||||
doesn't offer the ability to enable filtering.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
0
viewport/3d_scaling/screenshots/.gdignore
Normal file
BIN
viewport/3d_scaling/screenshots/high.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
viewport/3d_scaling/screenshots/low.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
@@ -1,24 +1,49 @@
|
||||
# The project
|
||||
This sample project showcases an implementation of dynamic split screen, also called Voronoi split screen, using the [Godot engine](https://godotengine.org).
|
||||
# Dynamic Split Screen
|
||||
|
||||
# Dynamic split screen
|
||||
A dynamic split screen system displays a single screen when the two players are close but a splitted view when they move apart.
|
||||
This sample project showcases an implementation of dynamic
|
||||
split screen, also called Voronoi split screen.
|
||||
|
||||
The splitting line can take any angle depending on the players' position, so it won't be either vertical or horizontal.
|
||||
Language: [GDSL](https://docs.godotengine.org/en/latest/tutorials/shading/shading_reference/shading_language.html) and GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
Note: An HTML5 export is testable
|
||||
[here](https://benjaminnavarro.github.io/godot_dynamic_split_screen/index.html).
|
||||
|
||||
## Details
|
||||
|
||||
A dynamic split screen system displays a single screen when
|
||||
the two players are close but a splitted view when they move apart.
|
||||
|
||||
The splitting line can take any angle depending on the players'
|
||||
position, so it won't be either vertical or horizontal.
|
||||
|
||||
This system was popularized by the Lego videogames.
|
||||
|
||||
# How it works
|
||||
Two cameras are placed inside two separate viewports and their texture, as well as some other parameters, are passed to a shader attached to a TextureRect filling the whole screen.
|
||||
## How it works
|
||||
|
||||
The `SplitScreen` shader, with the help of the `CameraController` script, chooses wich texture to display on each pixel to achieve the effect.
|
||||
Two cameras are placed inside two separate viewports and their
|
||||
texture, as well as some other parameters, are passed to a
|
||||
shader attached to a TextureRect filling the whole screen.
|
||||
|
||||
The cameras are placed on the segment joining the two players, either in the middle if they're close enough or at a fixed distance otherwise.
|
||||
The `SplitScreen` shader, with the help of the `CameraController`
|
||||
script, chooses wich texture to display on each pixel to
|
||||
achieve the effect.
|
||||
|
||||
# How to use it
|
||||
Open and launch the project inside the Godot engine and then you can use WASD keys to move the first player and IJKL keys to move the second one.
|
||||
The cameras are placed on the segment joining the two players,
|
||||
either in the middle if they're close enough or at a fixed
|
||||
distance otherwise.
|
||||
|
||||
The `Cameras` node has parameters to tune the distance at which the screen splits and also the width and color of the splitting line.
|
||||
## How to use it
|
||||
|
||||
# Try it out
|
||||
An HTML5 export is testable [here](https://benjaminnavarro.github.io/godot_dynamic_split_screen/index.html).
|
||||
Open and launch the project inside the Godot engine and then
|
||||
you can use WASD keys to move the first player and IJKL keys
|
||||
to move the second one.
|
||||
|
||||
The `Cameras` node has parameters to tune the distance at
|
||||
which the screen splits and also the width and color of
|
||||
the splitting line.
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||
0
viewport/dynamic_split_screen/screenshots/.gdignore
Normal file
BIN
viewport/dynamic_split_screen/screenshots/splitscreen.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
12
viewport/gui_in_3d/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# GUI in 3D
|
||||
|
||||
A demo showing a GUI instanced within a 3D scene using viewports,
|
||||
as well as forwarding mouse and keyboard input to the GUI.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 3
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
0
viewport/gui_in_3d/screenshots/.gdignore
Normal file
BIN
viewport/gui_in_3d/screenshots/gui.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
11
viewport/screen_capture/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Screen Capture
|
||||
|
||||
An example showing how to take screenshots of the screen.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
0
viewport/screen_capture/screenshots/.gdignore
Normal file
BIN
viewport/screen_capture/screenshots/capture.png
Normal file
|
After Width: | Height: | Size: 996 KiB |
@@ -10,4 +10,4 @@ Note: There is a GDScript version available [here](https://github.com/godotengin
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||