How to define a scene background with gradients?

Is it possible to define a background with gradients for scene.background?
I think not, or?

Then, is it possible to define an background-image for scene.background?

Depends on what you want to achieve in the end.

You can set a solid color. Or a texture (with gradient). Or a videotexture. Or a cube texture. Have a look at the documentation.
You can instantiate THREE.WebGLRenderer() with the .alpha property set to true. And then use .setClearColor(0x000000, 0), thus you can use html elements as you can see through the backgound of the scene.
Or, for the background, you can use a big box or a sphere with gradient made with shaders.

1 Like

Also see: How to set image as background for gltf format?

1 Like

Using the alpha/transparent option you could also go with a CSS background if it’s an option for you.

2 Likes

I like https://github.com/mattdesl/three-vignette-background for a grainy vignette. grainScale must be set to 0 on iOS though.

2 Likes

I create a simple Three JS gltf/glb template with a gradient background and added grain. You can download it on Github.

Was searching help on this topic and found the following example from the Oimo.js library which literally inserts an IcosahedronGeometry with a gradient texture as background:

http://lo-th.github.io/Oimo.js/examples/test_basic.html