how can i use the visual shader in the enviroment sky godot 3.4 any idea?
I dont have nothing else to put..

- 99
- 1
- 8
1 Answers
Post-processing
You might be trying to make some post-processing effect. in that case, you have these options:
- Use a
ViewportContainer
andViewport
combo, then you can use a Canvas Shader on it. See Custom post-processing. - Use geometry that covers the view, and use a Spatial Shader on it. See Advanced post-processing.
- There are, of course, some post-processing options available on
Environment
. See Environment and post-processing.
Color Correction
If you set adjustment_enabled
to true, you can set a texture on adjustment_color_correction
. This means you can set a ViewportTexture
as described at the end. Godot is expecting a gradient.
Custom Background
If you want to make a custom background or sky. Look at the property background_mode
in the Environment
object under "Background". There are only two cases that are useful for us:
PanoramaSky
: If you set thebackground_mode
to "Sky" or "Color+Sky", you can set a newPanoramaSky
, which has a propertypanorama
that takes a texture. Godot expects an equirectangular texture. And thus, you can set aViewportTexture
as described at the end.Canvas
: If you set thebackgroud_mode
to Canvas, you can figure some Canvas Layers to be in the background. And, of course, you can set a Canvas Layer withCanvasItem
s that have Canvas Shaders. Remember that you can get the currentViewport
withget_viewport
and from it, the current 3D camera withget_camera
. Thus, you can use the orientation of the current 3D camera to update the contents of the Canvas Layer.
Appendix: ViewportTexture
If you have a texture property that you want to make dynamically, you can create a Viewport
and then set a ViewportTexture
to the property, referencing the Viewport
.
That allows you to use shaders (or whatever you want) to create the texture you want. Because the texture will be whatever scene is rendered in the Viewport
.
There is just one caveat: you cannot do this on a resource saved independently of a scene. Thus, to set any of the textures of the Environment
, you will need to save it as part of the scene (which also means not using the default environment). So add a WorldEnviroment
node to the scene, give it an Environment
and make sure it has resource_local_to_scene
set to true.

- 31,890
- 5
- 57
- 86
-
I tried using viewport but the dimensions confuse me – Rubén ramirez Jan 03 '22 at 04:18
-
1@Rubénramirez It is an equirectangular projection. Imagine the image has the left and right edges glued into a cylinder, and then the cylinder is pinched down into a sphere ([something like this](https://www.youtube.com/watch?v=3Ic5ZIf74Ls)). You can think of the horizontal coordinate as azimuth, and the vertical as altitud. Search for [equirectangular skybox](https://duckduckgo.com/?q=equirectangular+skybox&t=opera&iar=images&iax=images&ia=images) for reference. *In fact, try a few.* – Theraot Jan 03 '22 at 04:43