Illumination modeling

After importing a model using OBJMTLLoader, it is automatically configured as a MeshLambertMaterial, causing the textures to appear darker and not in full color. I am struggling to adjust the lighting in the scene to correct this issue.

I have attempted to add an ambient light, but it has not been sufficient:

scene.add(new THREE.AmbientLight(0xffffff));

Is there a way to disable the 'luminance' setting and make the mesh lambert material visible without relying on any additional lighting in the scene?

Answer №1

If you're looking to update materials, there are a couple of methods you can try. The first involves manually accessing your model file and adjusting the material settings directly within the source code. Alternatively, when using object loader or JSON loader, you can utilize a "for" loop in order to iterate through each material and apply new values accordingly.

var jsonLoader = new THREE.JSONLoader();
jsonLoader.load(model, addCustomMaterialToScene);

                      function addCustomMaterialToScene( geometry, materials ) 
                      {
                          var customMaterial = new THREE.MeshFaceMaterial( materials ); 

                          for ( var i = 0; i < materials.length; i ++ )
                          {
                           var material = materials[i];
                              material.side = THREE.DoubleSide; /// here you have the option to modify attributes
                          }

                          customMesh = new THREE.Mesh( geometry, customMaterial );

                          customMesh.position.set(x,y,z);

                          scene.add( customMesh );
                          console.log(customMesh);
                      }

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

What is the best way to design a grid with various squares in React Native?

Here's the design I aim to achieve: I am looking to implement the above layout in react native and ensure it is responsive on all screen sizes. I attempted using flexbox but couldn't figure out how to make the boxes square shaped. The code provi ...

Are JS commands enough for using Node.js dom APIs like jsdom and cheerio, or do I have to rely on jQuery for these tasks?

Is there a DOM API available for Node.js that allows me to use pure JavaScript commands? I prefer not to use jQuery as I already have existing code in vanilla JS. ...

Rotating around the midpoint of a manipulator in Three.js

Despite asking a similar question recently, I am still struggling to figure out how to properly set the center of a three js control in order for it to rotate as intended. I have come across various examples involving geometry, bounding boxes, pivot points ...

Issue with utilizing display: table and overflow: hidden in Internet Explorer and Firefox, functioning properly on Webkit and Blink

JSFiddle : http://jsfiddle.net/h7xvr2t9/2/ I have been experimenting with ways to achieve some effects: Animating a hidden DIV to slide into view from below a visible container Centering text/image on a link to trigger the animation HTML <div clas ...

Tips for Configuring a Nestjs Query Using TypeORM to Retrieve Several Entries

When I send this specific URL from my Angular application: http://localhost:3000/api/skills?category_id=2 The main issue revolves around how to modify the code in order to successfully retrieve all skills with a category_id of 2. It is important to note ...

Unable to submit form in Node.js with Express

I am just starting out with node.js and I need help with a sample form to insert values into a database. Below is the code snippet for my test page: <form action="/create" method="POST" class="form-horizontal" enctype="application/x-www-form-urlencode ...

Is it necessary to confirm the validity of url.format(urlObject)?

I have been exploring the NodeJS URL API and am particularly interested in the url.format(urlObject) method. My goal is to develop a function that first validates the urlObject before using the format function, and throws a TypeError if any of the key/valu ...

The art of filtering data using jQuery's data-filter feature

I'm struggling to create a jQuery filter function that will display only the items belonging to a specific category when that category is clicked on. Although I have written some functions, I can't seem to get it to work properly. My goal is to ...

Click on the link to go to another page according to the drop-down option selected

Here's a puzzling query that even Google fails to address. I've got two pages: page-1 and page-2. On page-2, there is a <ul> element and a toggle-button-box with the following code: <ul> <li><button class="button is-checked ...

The parameters in VueJS are malfunctioning on this webpage

I created my vue in an external file and included it at the bottom of my webpage, but I am encountering issues with its functionality. One specific problem arises when using v-model, resulting in a template error displayed on the page: Error compiling t ...

Rearrange the provided string in a particular manner

Looking to transform a string like '12:13:45.123 UTC Sun Oct 17 2021' into 'Sun Oct 17 2021 12:13:45.123 UTC' without calling slice twice. Is there a more elegant and efficient way to achieve this? Currently using: str.slice(18)+&apo ...

React: the props appear to be undefined when they should actually have a value

I have a requirement for my props in the children class to be an array of Event objects. Prior to using it in App.js, I am checking if the array is empty like this: function App() { class Event { constructor(id, title, date){ this.id = id; ...

Tips for closing the navbar by clicking elsewhere on the page

Is there a way to modify my code in order for the navbar to close when clicking outside of it, while staying open if something inside it is clicked? $(document).ready(function() { $('.nav-btn').on('click', function() { $('.na ...

Grunt: Executing tasks exclusively for updated files - the ultimate guide!

In my Gruntfile.js, I have the configuration set up as follows: module.exports = function(grunt) { require('jit-grunt')(grunt); grunt.initConfig({ uglify: { options: { manage: false }, my_target: { file ...

Issue with specific selectors causing React CSS module malfunction

Currently, I am a beginner in learning React and have been experimenting with CSS modules. Even though Menu.module.css is mostly functioning correctly, it seems to be having an issue applying styles to the .menu a.last selector for some reason (although i ...

Which HTML element does each script correspond to?

Are there any methods to identify the script used in certain HTML elements? For instance, if I wish to determine the script responsible for creating a drop-down menu, I can locate the HTML and CSS for the menu but not the JavaScript (or other scripts). I ...

Encountering the message "a critical error occurred: 'vips/vips8' file was not located" while using M2 (Apple Silicon) Macs

Encountered a pesky error that read: fatal error: 'vips/vips8' file not found while setting up a React project on my new M2 (Apple Silicon) device. After sifting through multiple reported issues on StackOverflow and github, I pinpointed the culp ...

Update the CSS styles using jQuery

I am looking to update the content within a CSS tag using jQuery. In this instance, I need to change "My content" to "New Content". Here is the CSS code I have: a.appari:focus:after{ background: #333; background: rgba(0,0,0,.8); border-radius: 5px ...

Encountering an issue with the v-carousel component from Vuetify: receiving a 'Cannot read property 't' of undefined' error message

Currently, I am trying to create an image carousel using Laravel along with Vue/Vuetify. The issue lies in the fact that the Vuetify v-carousel and v-carousel-item components are not rendering properly due to the error mentioned in the title. I have alrea ...

Is it feasible to style individual letters in a word within an input field?

Is it possible to change the styling of individual letters in an input containing text? For example, if the word 'Test' is in the input, can I make the 'Te' bold while leaving the 'st' regular? Alternatively, perhaps I'd ...