Shadows in THREE.JS are not being affected by the displacement map

Lately, I've been facing some challenges with getting the shadows to work properly when using a displacement map. Despite researching the issue on Google, I still can't seem to figure it out. From what I gather, the displacement map is supposed to distort the vertices, which should in turn affect the shadows.

Unfortunately, the shadows remain unaffected by the displacement map.

Answer №1

To optimize the shadow casting sphere, experiment with a personalized depth material:

sphere.customDepthMaterial = new THREE.MeshDepthMaterial( {
    depthPacking: THREE.RGBADepthPacking,
    displacementMap: customDisplacementMap,
    displacementScale: customDisplacementScale,
    displacementBias: customDisplacementBias
});

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

Why does my Ajax request keep returning a 400 Error code?

I am facing an issue with WP AJAX. jQuery.ajax({ type: 'POST', url: spaceajax.ajaxurl, // this contains my admin ajax URL data: { "event_id" : 1, "space_id" : 1, "booking_id": 1, 'action' ...

When using AngularJS, the templateUrl feature delays the initialization of the controller, causing issues with dependent code

Recently, I began experimenting with AngularJS and so far, everything seems to be going smoothly except for one small issue. Let's consider a scenario where I have two directives, with one directive relying on the other, like this: angular.module(&ap ...

How can you shrink the file size of models in Three.js?

Lately, I've been utilizing the ObjectLoader to bring all my models into the scene in Three.js. Additionally, I rely on the Three.js editor to implement textures. My current process involves exporting an OBJ file from 3Ds Max and then importing it int ...

What causes TypeScript's ReadonlyArrays to become mutable once they are transpiled to JavaScript?

Currently, I am in the process of learning Typescript by referring to the resources provided in the official documentation. Specifically, while going through the Interfaces section, I came across the following statement: TypeScript includes a special t ...

What causes the discrepancy in the output of `document.documentElement.childNodes` in JavaScript?

While working on my code exercise today, I came across a special case regarding the "document.documentElement.childNodes" property. Originally, I believed it to represent all child nodes within a tag as before. However, when implementing my code, I noticed ...

Is there a way to collapse an element by clicking either the content inside the div or the button within the div?

Is there a way to make a button within a newly activated div close it? The existing code seems to have issues with this functionality, and adding new rules or functions has not solved the problem. Any assistance with fixing this issue using vanilla JavaScr ...

Reprinting information from my server / overlooked a task

After saving "Ben and Jerry's" to my database and retrieving it later for editing/resaving in an input tag, I am encountering an issue. Ben & Jerry's What could be the problem? (I have noticed that the "&" is correctly translated but ...

Can Angular 5 integrate with Pusher?

Below is the javascript code used to integrate Pusher into native HTML: <head> <title>Pusher Test</title> <script src="https://js.pusher.com/4.1/pusher.min.js"></script> <script> // Enable pusher logging - don't i ...

What are the steps for implementing CORS?

I recently attempted to set up Ajax calls and stumbled upon the following code snippet: <!DOCTYPE html> <html> <body> <p id="demo">Let AJAX update this text.</p> <button type="button" onclick="loadDoc()">Updat ...

Exploring data segments in Knockoutjs using various models

I'm trying to figure out why Knockout.js won't allow me to access specific parts of the model data. Could it be because I am binding the model to the div that contains all the submodels (such as the Form in this example), or am I approaching this ...

Navigational controls for a JavaScript slider - Backward and Forward options

I'm in the final stages of completing my slider project, but I'm stuck on how to incorporate the next() and prev() functionalities. Can anyone provide guidance on implementing these functions? http://jsfiddle.net/M4t4L/11/ $(function () { ...

angular-routing does not seem to redirect properly

I'm encountering an issue after logging in, as my page is not redirecting to the main page. Upon investigation, I found that the login condition works when using $window.location. However, I want to implement angular-route to restrict access to the ma ...

Learn how to dynamically set the "selected" option in Vue based on object data

I've done some digging on SO but haven't found exactly what I need. So, here's the situation - I've got a sorting function in progress. I have an array of date ranges (PayPeriods) that I want to render into a select with option compone ...

Is there a missing X-AppEngine-Region in the headers of the AppEngine application?

I've been trying to access the Region and Country in my request, but it seems like the X-AppEngine-Region and X-AppEngine-Country headers are missing. Sometimes I see headers like alt-svc content-length content-type date etag server status via ...

Using Angular.js to trigger a callback function from a separate controller

Currently in my angular project, I am utilizing Angular.js material. I am trying to display a $mdialog with a custom controller, where the user can modify some data and have those changes applied to my $scope variable. This is an example of what I am doing ...

Switching Over to Burger Menu

I created a burger menu using HTML, CSS, and jQuery that switches from a full-width menu to a burger menu. However, I'm facing an issue with toggling the dropdown when the menu collapses. Here's my code: <!DOCTYPE html> <html> < ...

Is it possible to access values from an IndexedDB object store key stored in an array without global access?

I am facing an issue where I am trying to extract values of a specific key from an indexed DB and store them in an array. The array seems to work correctly within the onsuccess function but appears empty after that. It seems like the asynchronous nature ...

Guide to filtering mongoose results with lodash

I am looking to display only the partners that a user is assigned to. Below is a list of partners: { "_id" : ObjectId("57c1cfa16c9cdc9007b26f8a"), "__t" : "Partner", "createdAt" : ISODate("2016-08-27T17:36:33.648+0000"), ...

Implementing a click event listener to target a specific div using JavaScript

In my JavaScript code, I have implemented a snowfall effect. I am looking to create a click event specifically on the 10th snowflake that falls down. Additionally, I want to add a class called "clickable" to this snowflake. The goal is to redirect the user ...

Issue: The value of an object is not defined (evaluating '$scope.inputcode.password')

HTML Form: <form ng-submit="mylogin()"> <div class="list"> <label class="item item-input"> <span class="input-label">Username</span> <input type="text" ng-model="inputcode.username"> ...