The latest on rectAreaLight enhancements in three.js

It seems like this abandoned feature of three.js has become somewhat of a coveted prize; I've attempted to incorporate it a few times without success.

You can find an example that works on an older release here:

My minimal broken example is available here: https://jsfiddle.net/bitsofcoad/1k3arL33/

var width = 20;
var height = 20;
var rectLight = new THREE.RectAreaLight(0xffffff, 500, width, height);
rectLight.intensity = 500.0;
rectLight.position.set(0, 30, 0);
rectLight.lookAt(mesh2.position);
scene.add(rectLight)

var rectLightHelper = new THREE.RectAreaLightHelper(rectLight);
scene.add(rectLightHelper);

I have ensured that the proper rectarealight library is included in the jsfiddle.

This thread was very informative about why this PR faced some challenges: https://github.com/mrdoob/three.js/pull/9234

And this thread was fascinating to see how others had progressed in developing a similar light type for three.js:

Improved Area Lighting in WebGL & ThreeJS

I'm not sure what caused abelnation's example to break, or if it is entirely broken (I may have messed up my jsfiddle...), but I believe there is still significant interest in this feature.

The soft edges look so appealing, I'm tempted to borrow WestLangley's custom shader (http://jsfiddle.net/hh74z2ft/89/), which pretty much has all the functionality I require.

Has anyone else managed to get the basic functions working? Thank you!

Answer №1

Area lights are supported by both MeshStandardMaterial and MeshPhysicalMaterial, while the remaining materials do not offer this feature.

This information pertains to version r.89 of three.js.

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

Tips for resolving the error "Cannot access the title property of undefined" when utilizing NextJS prerendering

I am preparing this page in advance for a specific post within my Next.js application: import Head from 'next/head'; import Link from 'next/link'; import client from '../../lib/apollo/client' import POSTS_WITH_SLUGS from &apos ...

Prevent dropdown from closing when clicking inside components [react-bootstrap]

I am searching for a solution to hide a drop-down bot by clicking on elements inside it. I am exploring different methods using JQuery. Is it possible to achieve this using JavaScript in combination with react-bootstrap? My current approach involves calli ...

unable to gather information from suppliers

I'm currently building a login page with nextjs and spotify js, but I've run into the following error https://i.sstatic.net/cKiM8.png Here is the code snippet that is causing the issue: import React from 'react' import { getProviders ...

Tips for ensuring that a server waits until a database connection is successfully established using node.js, MongoDB, and Express

I have a server.js file and a database.js file In the server.js file, I have the following code: const express = require('express'); var db = require('./database'); const app = express(); . . some get/post methods app.listen(3000); . ...

Child component being disabled by parent component using ng-disabled

While I'm delving into Angular js v1.5, I'm taking the opportunity to experiment with components. In this endeavor, I've come up with 2 components: A circular button, aptly named "circular button". A component that encapsulates a circular ...

Issues with receiving data on $.ajax POST request

If you'd like to check out my website Please use the following login details (case sensitive): Username: stack Password: stack Click on the tab labeled "yourhours." The main goal is to send all input box data to a database. At the moment, I am fo ...

Acquiring the index of a selector event within a list of dynamic elements

I am seeking guidance on how to go about solving the issue of obtaining an event index. I have a hunch that closures might play a role in the solution and would appreciate some insights. Initially, I dynamically build an HTML5 video container using an aja ...

The property 'createUploadWidget' cannot be read from an undefined source

While working on a React js tutorial, I encountered an issue related to using Cloudinary React SDK for image and video uploads. Specifically, I was using the Upload Widget provided by Cloudinary and faced an error when trying to open the widget - 'Typ ...

The PDFKIT feature ensures that any overflowing data in a row is automatically moved to a new page

A function in my code generates a row of data based on an array. It works perfectly fine for the first page, but as soon as the data overflows somewhere around doc.text("example",70,560), it jumps to the next page. The issue arises when the Y coo ...

A step-by-step guide on how to implement a window scroll-controlled color transition

I've implemented jQuery code to change the opacity of my navbar's background as the user scrolls, transitioning from transparent to blue. Here's the snippet: $(window).scroll(function(){ var range = $(this).scrollTop(); var limit = 45 ...

Assigning a variable in jQuery to a PHP variable that has not been defined can halt the script

Here is the code snippet for a document ready function: $(document).ready(function(){ var id = <?php echo "" ?>; alert('boo'); if(id!=0){ $(' ...

Leverage the power of the select function in Angular to transmit multiple parameters

In Angular Js, is there a way to utilize a select element in a manner similar to how you can use a list of links? For instance, if I have links set up like this: <a ng-click="ctrl.change('argument1','argument2')">One</a> & ...

Implementing a "Click to view additional comments" feature using PHP and AJAX

I've been working on setting up a video commenting system, but I'm stuck on getting my "load more" button to function properly. Despite checking my PHP script and finding no errors, nothing seems to be happening when I click the button. As someon ...

Looking for a fully customizable event and booking calendar?

Currently, I am searching for a unique event and booking calendar that provides the ability to customize each cell or day with our desired content. While most calendars only allow for inputting events as text, we require a solution that enables us to add ...

Generating a collection of items using a pre-existing array of items

Struggling to create an array of objects based on another array of objects. I attempted to use flatMap and then reduce, but encountered an issue when I tried to collect multiple statuses in one object. Below is what I have attempted and the desired result ...

The function array.map() is not functioning as anticipated when trying to display the <li> element within a React component

I'm having trouble rendering multiple <li> components using the map() function. No content is being displayed on the screen and I'm not receiving any error messages, so I'm unsure of what the issue might be. reviewCard = revie ...

I am experiencing difficulties connecting my webRTC app to the remote system

I've set up my webRTC app on an HTTPS server and it's working fine. However, I'm facing an issue where the Remote system details (SDP) are not being captured. Both the Local system (PC1) and Remote system (PC2) are unable to establish connec ...

How to Use Discord.js v13 to Make an Announcement in a Specific Channel

Looking for a Solution I am trying to create a command that allows an admin user to send a specific message to a designated channel. The Issue at Hand My current approach involves sending a response back to the user who triggered the command with the ent ...

Is there a way to download a file using an ajax request?

We are faced with a particular scenario in our application where: Client sends a request Server processes the request and generates a file Server sends the file back as a response Client's browser prompts a dialog for downloading the file Our appli ...

Jest encountered an UnhandledPromiseRejection error because the promise was unexpectedly resolved instead of being rejected

I am facing a difficult error message from Jest that I can't seem to figure out. The error message indicates that the promise is being resolved instead of rejected, causing an unhandled promise rejection. It's confusing because Jest expects an er ...