Object Illumination Effect Using Three.js

Currently, I am working on creating an earth scene using Three.js and everything seems to be going well except for the large and distracting reflection disc that appears on the surface of the earth object. Does anyone have any suggestions on how to either remove this reflection entirely or at least reduce it significantly?

Link to Image

Lighting Setup:

//Setting up the renderer
    renderer = new THREE.WebGLRenderer( { canvas : spaceCanvas} );
    renderer.setSize( 672, 472 );
    renderer.shadowMap.enabled = true;
    renderer.shadowMap.renderReverseSided = false;
//Creating the main scene
    mainScene = new THREE.Scene();
    mainCamera = new THREE.PerspectiveCamera( 45, window.innerWidth /window.innerHeight, 0.01, 2000 );
    mainCamera.position.z = 2.25;
//Adding lighting to the scene
    var ambLight    = new THREE.AmbientLight( 0x222222 );
    var light   = new THREE.DirectionalLight( 0xffffff, 1 );
    light.position.set(5,3,5);
    light.castShadow = true;
    light.shadow.camera.near = 0.01;
    // Setting up shadow camera properties
/* Additional light properties... */
    mainScene.add(light, ambLight);

Earth Object Setup:

function CreateEarth(){
earth = new THREE.Object3D();
THREE.crossOrigin = "";
    var loader = new THREE.TextureLoader();
    // Loading textures for earth object
    /* Additional texture loading code... */
    var earthGeometry = new THREE.SphereGeometry( 0.5, 32, 32 );
    var earthMaterial = new THREE.MeshPhongMaterial({
        // Applying textures to the earth object
        /* Texture mapping properties... */
    });
    earthMesh = new THREE.Mesh(earthGeometry, earthMaterial );
    earth.add(earthMesh);

function CreateEarthAtmosphere(){
    var loader = new THREE.TextureLoader();
    // Loading cloud texture
    /* Additional cloud texture loading code... */
    var atmosphereGeometry = new THREE.SphereGeometry(0.51, 32, 32);
    var atmosphereMaterial = new THREE.MeshPhongMaterial({
            // Applying cloud texture to create atmosphere around earth
            /* Cloud texture mapping properties... */
    });
    atmosphereMesh = new THREE.Mesh(atmosphereGeometry, atmosphereMaterial);
    earthMesh.add(atmosphereMesh)
}

Answer №1

The shininess level of your 25 may be impacting the appearance of the earth material object.

let earthMaterial = new THREE.MeshPhongMaterial({
        map : colorMap,
        bumpMap : bumpMap,
        bumpScale : 0.05,
        specularMap : specMap,
        specular : new THREE.Color("grey"),
        shininess: 25 // Should this be adjusted?

});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating two variables that share an identical name

Can variables with the same name set outside of a function be called within the function? var a = $(window).width(); // This is the variable I want to call if(!$.isFunction(p)){ var a = $(window).height(); // Not this one alert(a); } FIDDLE ...

Setting a checkbox to true within the MUI Data Grid using my input onChange event - how can I achieve this?

I am looking to highlight the selected row in my usage input onChange event. https://i.stack.imgur.com/rp9rW.png Details of Columns: const columns = [ { field: 'part_code', headerName: 'Part Code', width: 200 }, { ...

Getting rid of a cookie from the header in Reactjs

Currently, I'm developing an application with Reactjs and utilizing the Next.js framework. To manage user authentication, I've implemented cookies. However, I am facing a challenge when it comes to logging out users and removing the cookie. Could ...

Failure of app script to retrieve data from an external spreadsheet

In an attempt to consolidate data, this program aims to transfer information from one spreadsheet to another. The process involves retrieving all files within a designated folder (all of which are spreadsheets), extracting values from a specific range, and ...

Showing recurring HTML elements with conditional content

I am displaying multiple bootstrap badges in a table column with different colors based on the values. Each badge has a unique class and style name to differentiate the colors. I feel like there is a lot of repetition in my HTML code. Is there a way for me ...

Tips for utilizing the window object in Angular 7

To implement the scrollTo() function of the window object directly, we can use window.scrollTo(0,0). However, when researching how to do this in Angular, I found that many people create a provider as shown below: import {InjectionToken, FactoryProvider} f ...

Determining if an element is present in a JavaScript array and returning true

I've come up with this code so far: var isMatch = viewedUserLikedUsersArray.indexOf(logged_in_user); if (isMatch >=0){ console.log('is match'); } else { console.log('no match'); } When an element is ...

Confirming the structure of a URL using JavaScript/jQuery

I have a text field where users input URLs. I need to validate the format of the URL using regular expressions. Specifically, I am looking for invalid URLs such as: http://www.google.com//test/index.html //Invalid due to double slash after hostname http: ...

I am looking to consolidate my array of objects into a single object with distinct keys

Hey there! I'm looking to showcase the expenses for each category throughout the months of the year. Here's an example: {Month: "January", Food: 610, foodColor: "#063951", Others: 121, othersColor: "#C13018", …} Fo ...

Transmitting an HTML file along with JSON data and enabling the browser to refresh the JSON data without reloading the entire

I'm currently working on a project involving a browser-server program where the browser sends an http get request to ''. The server is expected to return both an HTML page and a JSON response. I attempted using res.render(), passing the JSON ...

Navigating Redirect Uri in Ionic for third-party API integration

After creating a webapp, I decided to venture into developing a mobile app using Ionic. The idea of making a progressive web app crossed my mind, but unfortunately Apple doesn't support it yet. (By the way, I'm still quite new to all of this) F ...

Using JavaScript and jQuery to calculate the time difference between two values

Here is a code snippet for calculating the difference between two numbers: function calculateDifference(num1, num2) { if (num1 > num2) { return num1 - num2; } else { return num2 - num1; } } On document.ready event: var result = calculateD ...

Unable to retrieve the sum total of all product items and display it in the designated text element

My product items are dynamically generated in a list. I have used the calculateItemTotal() method to determine the total for each item. Now, I need to sum up all these item totals and display the result in the total text field. However, instead of showing ...

Controller is not being triggered by Ajax method when there is a decimal value

I am currently working on implementing a time registration feature in my web application. Users can select the project they worked on and enter the number of hours spent on that project. Everything is functioning properly until users start adding half-hou ...

How about this: "Unveil the beauty of dynamically loaded

var request = new Request({ method: 'get', url: 'onlinestatusoutput.html.php', onComplete:function(response) { $('ajax-content').get('tween', {property: 'opacity', duration: 'long&apos ...

Issue with Angular *ngFor functionality causing malfunction in Tailwind Elements Select component

Below are my codes for a basic Angular component where I'm utilizing the Tailwind Elemets CSS framework. app.componenets.ts import { Component, OnInit } from '@angular/core'; import { Select, Datepicker, Input, initTE } from "tw-elemen ...

Adjust the scope variable upon submission and refresh the display in AngularJS

Currently, I am working on my first web app using angularjs and facing an issue where the page does not update with new values once the user submits text or numbers in an input box. For this project, I am utilizing Java8, MongoDB, angularJS, and twitter b ...

Generate a custom map by utilizing JavaScript and HTML with data sourced from a database

Looking for guidance on creating a process map similar to this one using javascript, html, or java with data from a database. Any tips or suggestions would be appreciated. https://i.sstatic.net/tYbjJ.jpg Thank you in advance. ...

I am unable to halt the relentless stream of asynchronous events

Struggling to retrieve an array using a loop in the asynchronous environment of nodejs. Check out my code below: getDevices(userIDs, function(result) { if (result) { sendNotification(messageUser, messageText, result); res.send("Success"); } else { ...

Converting an ajax request to CORS

Would appreciate some guidance on accessing an API through my localhost using the code below: $.ajax({ url: "http://domain.xxx.net/api/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7a3b8bcb2b9a4f9bda4b8b9e8b2ba ...