M
M
Michael2021-08-23 13:21:56
JavaScript
Michael, 2021-08-23 13:21:56

Darken background (picture) in three.js?

Just started learning three.js.

uploaded to the site CubeTextureLoader - 6 images of space.

const loaderBG = new THREE.CubeTextureLoader();
const texture = loaderBG.load([
    './assets/nebula_bg/nebula-xneg.png',
    './assets/nebula_bg/nebula-xpos.png',
    './assets/nebula_bg/nebula-yneg.png',
    './assets/nebula_bg/nebula-ypos.png',
    './assets/nebula_bg/nebula-zneg.png',
    './assets/nebula_bg/nebula-zpos.png',
]);

scene.background = texture;


The problem is that the pictures are lighter than I expected.
I tried to solve the problem through fog (fog) but it only applies to objects, not the background. I found tutorials on the Internet on how to make the background transparent, but it was always a background in the form of a color, how to darken the image (or at least make it translucent, and overlay black under it) I don’t know

texture.fog = new THREE.Fog(0x000000, 1, 1);


61237691d065d915375614.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2021-08-23
@lolzqq

png images in the editor did not try to darken?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question