три js - Как сфера может сиять внутри нее, излучая свет во все стороны - PullRequest
0 голосов
/ 08 мая 2020

Как сделать так, чтобы солнце как сфера сияло внутри и излучало свет во всех направлениях?

заранее спасибо

У меня есть только этот рендеринг на экране СОЛНЦЕ в центре и поле, чтобы увидеть, как на него отражается свет.

// create a geometry
  const radius = 2;
  const widthSegments = 100;
  const heightSegments = 96;

  const geometry = new THREE.SphereBufferGeometry(
    radius,
    widthSegments,
    heightSegments
  );

  const geometry1 = new THREE.BoxBufferGeometry(3, 13, 3);

  //create texture loader
  const textureLoader = new THREE.TextureLoader();
  const texture = textureLoader.load("https://i.ibb.co/3srcxqp/Sol.jpg");

  texture.encoding = THREE.sRGBEncoding;
  texture.anisotropy = 16;

  const material = new THREE.MeshStandardMaterial({
    map: texture,
    color: "#ffffff",
    specular: "#ffffff",
    transparent: true,
    side: THREE.DoubleSide,
    alphaTest: 0.5,
    opacity: 1,
    roughness: 1,
  });

  material.alphaMap = texture;
  material.alphaMap.magFilter = THREE.NearestFilter;
  material.alphaMap.wrapT = THREE.RepeatWrapping;
  material.alphaMap.repeat.y = 1;

  var material1 = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
  mesh = new THREE.Mesh(geometry, material);

  const mesh1 = new THREE.Mesh(geometry1, material1);

  scene.add(mesh);
  scene.add(mesh1);

  mesh1.position.set(-10, -10, -10);
  mesh1.updateMatrix();
...