create account

Godot Documentation: Using a Viewport As a Texture by clayjohn

View this thread on: hive.blogpeakd.comecency.com
· @clayjohn ·
$30.85
Godot Documentation: Using a Viewport As a Texture
#### Repository
[Godot Documentation](https://github.com/godotengine/godot-docs) and [Godot](https://github.com/godotengine/godot)

http://docs.godotengine.org/en/latest/_images/planet_example.png

*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.

http://docs.godotengine.org/en/latest/_images/planet_ocean_reflect.png

#### 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
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 99 others
properties (23)
authorclayjohn
permlinkgodot-documentation-using-a-viewport-as-a-texture
categoryutopian-io
json_metadata{"tags":["utopian-io","documentation","gamedev","godot"],"image":["http://docs.godotengine.org/en/latest/_images/planet_example.png","http://docs.godotengine.org/en/latest/_images/planet_ocean_reflect.png"],"links":["https://github.com/godotengine/godot-docs","https://github.com/godotengine/godot","http://docs.godotengine.org/en/latest/tutorials/viewports/using_viewport_as_texture.html","https://github.com/clayjohn","https://github.com/godotengine/godot-docs/pull/1606"],"app":"steemit/0.1","format":"markdown"}
created2018-08-18 22:14:18
last_update2018-08-18 22:14:18
depth0
children4
last_payout2018-08-25 22:14:18
cashout_time1969-12-31 23:59:59
total_payout_value23.438 HBD
curator_payout_value7.412 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,689
author_reputation12,492,798,894,700
root_title"Godot Documentation: Using a Viewport As a Texture"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,640,793
net_rshares23,436,638,500,158
author_curate_reward""
vote details (163)
@ms10398 ·
$5.17
Thats a really great contribution.

As I pointed out before that you are doing really great work for this project.

I really appreciate your efforts

I can honestly say this is one of the gem contributions of my category and I am staff picking it.

Keep up the great work.

I am really looking forward to more contributions from you.

Keep Contributing

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/4/1211122).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , ,
properties (23)
authorms10398
permlinkre-clayjohn-godot-documentation-using-a-viewport-as-a-texture-20180820t070952803z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/4/1211122","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-08-20 07:09:54
last_update2018-08-20 07:09:54
depth1
children1
last_payout2018-08-27 07:09:54
cashout_time1969-12-31 23:59:59
total_payout_value3.901 HBD
curator_payout_value1.266 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length843
author_reputation27,572,487,973,390
root_title"Godot Documentation: Using a Viewport As a Texture"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,775,856
net_rshares3,844,269,842,003
author_curate_reward""
vote details (7)
@utopian-io ·
$0.02
Thank you for your review, @ms10398!

So far this week you've reviewed 3 contributions. Keep up the good work!
πŸ‘  ,
properties (23)
authorutopian-io
permlinkre-re-clayjohn-godot-documentation-using-a-viewport-as-a-texture-20180820t070952803z-20180822t072009z
categoryutopian-io
json_metadata"{"app": "beem/0.19.42"}"
created2018-08-22 07:20:09
last_update2018-08-22 07:20:09
depth2
children0
last_payout2018-08-29 07:20:09
cashout_time1969-12-31 23:59:59
total_payout_value0.017 HBD
curator_payout_value0.003 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length110
author_reputation152,955,367,999,756
root_title"Godot Documentation: Using a Viewport As a Texture"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,992,457
net_rshares15,194,823,646
author_curate_reward""
vote details (2)
@steem-ua ·
Hi @clayjohn! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus upvoting quality Utopian-io contributions! Nice work!
πŸ‘  
properties (23)
authorsteem-ua
permlinkre-godot-documentation-using-a-viewport-as-a-texture-20180820t071754z
categoryutopian-io
json_metadata"{"app": "beem/0.19.54"}"
created2018-08-20 07:17:54
last_update2018-08-20 07:17:54
depth1
children0
last_payout2018-08-27 07:17:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length185
author_reputation23,214,230,978,060
root_title"Godot Documentation: Using a Viewport As a Texture"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,776,465
net_rshares13,896,853,349
author_curate_reward""
vote details (1)
@utopian-io ·
$0.02
Hey @clayjohn
 **Thanks for contributing on Utopian**.
Congratulations! Your contribution was Staff Picked to receive a maximum vote for the documentation category on Utopian for being of significant value to the project and the open source community.

We’re already looking forward to your next contribution!

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
πŸ‘  ,
properties (23)
authorutopian-io
permlinkre-godot-documentation-using-a-viewport-as-a-texture-20180821t051509z
categoryutopian-io
json_metadata"{"app": "beem/0.19.42"}"
created2018-08-21 05:15:09
last_update2018-08-21 05:15:09
depth1
children0
last_payout2018-08-28 05:15:09
cashout_time1969-12-31 23:59:59
total_payout_value0.017 HBD
curator_payout_value0.003 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length499
author_reputation152,955,367,999,756
root_title"Godot Documentation: Using a Viewport As a Texture"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id68,876,721
net_rshares15,824,359,195
author_curate_reward""
vote details (2)