1

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

1 Answers1

1

Post-processing

You might be trying to make some post-processing effect. in that case, you have these options:


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 the background_mode to "Sky" or "Color+Sky", you can set a new PanoramaSky, which has a property panorama that takes a texture. Godot expects an equirectangular texture. And thus, you can set a ViewportTexture as described at the end.
  • Canvas: If you set the backgroud_mode to Canvas, you can figure some Canvas Layers to be in the background. And, of course, you can set a Canvas Layer with CanvasItems that have Canvas Shaders. Remember that you can get the current Viewport with get_viewport and from it, the current 3D camera with get_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.

Theraot
  • 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