The emission of light from a source in Three.js does not impact the shading of surrounding objects

Currently, I am immersed in a solar system project that involves the majestic display of planets and a rocketship orbiting gracefully around a radiant sun. Within this digital cosmos resides a main light source embedded within the following code:

// integrate subtle ambient lighting
var ambientLight = new THREE.AmbientLight(0x0c0c0c);
scene.add(ambientLight);

// introduce spotlight for shadow effects
var spotLight = new THREE.PointLight(0xffffff);
spotLight.position.set(-200, 50, 150);
spotLight.castShadow = true;
scene.add(spotLight);

An attempt has been made to imbue the sun object with an emissive property in order to illuminate the surrounding planets. While this endeavor succeeded in engendering a luminous aura around the planet, it did not quite transform the sun into a definitive light source. The code implemented for the creation of the sun object is illustrated below:

 function createSunMesh(geom) {
     var loader = new THREE.TextureLoader();
     var planetSunTexture = loader.load("../assets/textures/planets/sun.jpg");
     //var normalSunTexture = loader.load("../assets/textures/planets/moonbump.jpg");

     var planetSunMaterial = new THREE.MeshLambertMaterial({map: planetSunTexture, emissive: 0xac3d25});
     //bumpMap: normalMoonTexture

     // fabricate a multimaterial entity
     var planetSunMesh = THREE.SceneUtils.createMultiMaterialObject(geom, [planetSunMaterial]);
     planetSunMesh.visible = false;

     return planetSunMesh;
 }

Hence, my inquiry pertains to the possibility of augmenting the strength of the emissive property of the light emitted by the sun, such that it exerts a more pronounced influence on the neighboring objects. Various attempts were made using both Lambert and Phong materials, yet the outcomes yielded similar effects across the board.

Answer №1

After some adjustments, I managed to position the main spotlight inside my sun object, achieving the desired effect. Additionally, by boosting the intensity and decreasing the decay, the light now has a more authentic appearance.

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

Firebase Lists versus Objects: A comparison of data structures

Seeking some clarification regarding Firebase lists. I'm attempting to access multiple lists within a single object in order to iterate through them. The structure of the object is as follows: user : { playlists: {}, // List 1 joined: {}, ...

The script from '*' is being denied execution because its MIME type ('application/json') is not executable, and a strict MIME type check is in place

Here is the code I used to retrieve data from the confluence rest api: <script type="text/javascript" src="Scripts/jquery.min.js"></script> <script> $.ajax({ type: "GET", url: "https://blog.xxxxx.com/rest/api/content? ...

Ways to set up various Content-Security-Policies and headers in your application?

In my email application, I am trying to prevent alerts in JavaScript by using a CSP header. However, even with the current policy in place, alerts can still execute when I send an HTML document attachment that contains script tags. Changing all JavaScript ...

Utilizing the scrollTop method to display the number of pixels scrolled on

My goal is to show the number of pixels a user has scrolled on my website using the scrollTop method in jQuery. I want this number of pixels to be displayed within a 'pixels' class. Therefore, I plan to have <p><span class="pixels"> ...

How to retrieve TypeScript object within a Bootstrap modal in Angular

Unable to make my modal access a JavaScript object in the controller to dynamically populate fields. Progress Made: Created a component displaying a list of "person" objects. Implemented a functionality to open a modal upon clicking a row in the list. ...

Enable users to choose either today's date or a future date by implementing AngularJS UI Bootstrap

I am currently utilizing the ui-bootstrap directive for a datepicker. My goal is to restrict the selection of dates to today's date or any future dates. Below is the HTML code snippet for the datepicker: <div class="input-group"> ...

Issue deploying Netbeans module

Question Title: Error Message: C:\Documents and Settings\user\My Documents\NetBeansProjects\ConsultingAgency\nbproject\build-impl.xml:563: The module has not been deployed. Hello there! I am currently diving into Java ...

using javascript to retrieve php variables

After creating a webpage, setting up Apache2 on an Ubuntu server to access it over the internet, and installing PHP5 and MySQL, I encountered issues with accessing database information on my page through a .php file. Despite having a file named test.php th ...

Rotating display for showcasing various portfolios

I'm facing an issue with my portfolio images carousel using a map in Bootstrap. When I navigate from one portfolio (e.g. image 4) to another (which has only one image), the carousel shows up blank because the active carousel-item is at index 3 (image ...

Analyzing the attributes of an array object in JavaScript

I have an assignment that requires me to filter an array into a new array for a vehicle with the term "ford" in it. The format should be in ES6 using arrow function syntax, like this: const arr = [ {name: "Honda", type: "Accord"}, {name: "ford", type: "fu ...

Encountering an issue with jQuery where the element cannot be hidden

Having an issue with jQuery I am attempting to hide an element instantly using a function. Here is the code snippet: <!DOCTYPE html> <html> <head> <title>Test Page</title> </head> <body> <script src="https ...

What is the best way to bubble up the ondragover event occurring within an iframe to its parent div?

Is there a way to propagate an ondragover event from an iframe back up to the parent div that contains the iframe? I have linked ondragover and ondrop event handlers to the parent div. In my code, I generate an iframe dynamically in the ondrop event hand ...

Encountering issues with querySelector() across certain classes

I need to display the actual date in my first column, but my JavaScript script is only working for one class in my HTML code. Question: How can I make my JavaScript code work for every class in the HTML code? I am currently using querySelector(), but I fe ...

Meteor JS failed to load the CSS file due to an unsupported MIME type

Currently, I am working on a meteor js 1.8 app. I have created a layout and now I want to add CSS to it. Here is the structure I am following: imports -ui --stylesheets --bootstrap.min.css --font-awesome.min.css --skins.css --forms.css All my CSS files ...

The properties of a JSON object are not explicitly defined

When I make an AJAX call, I receive a JSON object and log it using this code: console.log(response); This is the response that gets logged in the console: {"filename":"new.jpg","orientation":"vertical"} However, when I try to access the orientation pro ...

Guide to dynamically rendering VueJS templates within a custom element

Currently, my Vue application relies on Esri's Mapping API for functionality. One feature provided by the Esri API allows me to define a popup template content using an object: const popupWindowTemplate = { title: "{mag} magnitude near {place}", ...

Is there a way to load jQuery after the page has loaded? Any suggestions on how

Exploring jQuery $(document).ready(function(){ $('.categories').live('change', function() { var my_location = window.location.pathname.replace('admin/', ''); $(this).parents("tr").next("tr.subcat ...

Sending dynamic object information to a component through nuxt-link

I've developed a project in Nuxt 3 that features a homepage displaying various products. Users can click on the product title to access the details page, achieved through the use of <NuxtLink> <NuxtLink :to="{ name: 'slug', par ...

Limit the use of Javascript specifically within a section of HTML that includes a rich-text editor

Currently, I am working on a web application that has a historic background. This application uses the summernote editor, a rich-text editor that allows users to save formatted notes to the server. Along with this, there are numerous instances of inline Ja ...

Rotate background image upon each visit

I have a collection of around 50 background images that I want to display randomly each time a user visits my website. The idea is to provide a unique background image for every visit, without saving any information about which image was previously display ...