Godot Documentation: Using a Viewport As a Texture
Repository
The above picture is included in the tutorial only for demonstration purposes only. It shows the kind of planet look that can be achieved with procedural texture generation. However, the tutorial does not cover how to do the atmospheric scattering effect found in this picture.
Details
This post arose out of two things: first, I wanted to infuse the Godot documentation with more procedural generation content, and second, I wanted to showcase how to use Viewports in 3D in Godot. Viewports are something that a lot of users have trouble with, even experienced users express confusion over what Viewports should be used for. This post walks the user through the process of setting up a Viewport and using it as a render texture. At the end of the tutorial the user is able to use render a planet from a 2D texture including setting the roughness of the ocean to make it more water-like. I hope that new users will be able to use this tutorial to jumpstart making procedural solar systems of their own!
Components
The tutorial covers the following topics:
- How to use a Viewport as a render texture
- Mapping a texture to a sphere with equirectangular mapping
- Fragment shader techniques for procedural planets
- Setting a Roughness map from a Viewport Texture
In a game engine, a Viewport is a surface that objects are rendered to. By default your scene contains a Viewport that is built into the scene itself. Godot also provides an interface to create your own Viewports to render to. In other engines these would be called offscreen buffers, or render targets. While using a Viewport is actually quite easy, many users express frustration over the process. This tutorial aims to make it a little easier to understand.
One area that the tutorial covers that is relatively unique is how equirectangular projection works and how to set your texture up so that the equirectangular projection works out of the box in Godot. Equirectangular projection is one way of mapping a 2D texture to a sphere. It is very commonly used in computer graphics nowadays.
At the end of the tutorial the reader will have created a planet that looks like the one below.
Links
http://docs.godotengine.org/en/latest/tutorials/viewports/using_viewport_as_texture.html
GitHub Proof of Authorship
- GitHub Account: https://github.com/clayjohn
- Pull Request: https://github.com/godotengine/godot-docs/pull/1606
Leave Godot Documentation: Using a Viewport As a Texture to:
Read more #utopian-io posts
Best Posts From Clay John
We have not curated any of clayjohn's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Clay John
- Godot: Bug Fixing
- Godot Development: MSAA in the GLES2 backend
- Godot Documentation: Introduction to Shaders series
- Godot Documentation: Differences between GLES2 and GLES3
- Godot Documentation: Animating Thousands of Objects
- Godot Documentation: Shader Reference
- Godot Documentation: Advanced Post-Processing
- Godot Documentation: Custom Post-Processing
- Godot Documentation: Shader Migration Guide
- Godot Documentation: Using a Viewport As a Texture
- Godot Documentation: Lights and Shadows in 2D
- Godot Vertex Shader Documentation
- Godot Viewport Documentation
- Documentation for Godot | PanoramaSky and ProceduralSky
- Building a Procedural Solar System in Godot
- Updates On World Generation and Passing Data From CPU to GPU
- Post Processing with three.js
- Into The Great Abyss: A game about exploration and resource management
- Learning 3D Graphics With Three.js | Raycasting Part 2
- Learning 3D Graphics With Three.js | How To Use a Raycaster