Striped artifacts can be observed in the lights of A-Frame technology, with their appearance varying depending

I'm currently using A-Frame version 1.0.4 and have experimented with both spotlights (as shown in the attached image) and direct light sources.

Adjusting the shadowBias to -0.0001 only minimally impacts the artifact issue.

By setting shadowMapHeight and shadowMapWidth to 1024, the artifact reduces slightly from the light source. However, completely eliminating it requires increasing it to 4096, which is a performance hit as all lights can't have a 4k shadow map.

An alternate effect is seen by extending the shadowCamera far distance, for example, from 500 to 5000. This, however, results in incorrect shadows being cast away from objects—even after adjusting the shadowBias.

Am I missing something? Why do default light settings pose these issues? Could it be related to the models used?

Any insights on this matter would be highly valued.

https://i.sstatic.net/w0UFf.png

Answer №1

I discovered the culprit! It turns out my models were double sided, causing shadows to be cast on both the front and back faces simultaneously, resulting in a striped glitch.

After consulting the three.js material documentation and verifying with material.side that the models were indeed double sided, I utilized

material.shadowSide = THREE.BackSide
to ensure that the backside casts shadows onto the front side, regardless of the model's properties. This simple adjustment fixed the glitch!

It is important to note that if a model has incorrect normals, meaning they are not facing outward or are inverted, the glitch will reoccur on those particular faces.

Answer №2

After downloading a intricately detailed and animated model (found here) in glTF format from Sketchfab, I managed to achieve relatively accurate shadows using the following parameters:

<a-entity shadow="cast: true; receive: true" id="model1" gltf-model="scene.gltf"
  position="6 1.5 -12" scale="0.5 0.5 0.5" animation-mixer>
</a-entity>

<a-entity light="type: ambient; intensity:0.1;"></a-entity>

<a-entity id="sun" light="type: directional; color: #FFF; intensity: 0.9; castShadow: true; shadowCameraFar: 500;
    shadowCameraVisible: false;
    shadowBias: -0.001;
    shadowMapHeight:2048; shadowMapWidth:2048;
    shadowCameraLeft: -50; shadowCameraRight: 50;
    shadowCameraBottom: -50; shadowCameraTop: 50;" position="10 50 -10">
</a-entity>

The outcome appeared satisfactory: https://i.sstatic.net/VN0Lr.png however, there were still some imperfections visible. Moreover, it turned out to be slightly taxing for the Oculus Quest.

In hindsight, I opted for shadow baking when dealing with my own models, even though it's not applicable to animated models.

I recall encountering an issue with z-buffer fighting on one of my models, rather than with the shadows themselves.

If you decide to experiment with this model, adjusting the parameters accordingly, you may encounter similar results before incorporating your own model into the mix.

Perhaps this insight will prove useful.

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

Generating a sequential array of dates and times in Angular

Currently, I am working on implementing a feature that will allow users to see the available visit times between two dates they select, specifically from 8:00 to 17:00 every day. For instance: If a user selects 1 Sep to 4 Sep, the system should return [1. ...

Tips for restoring lost data from localStorage after leaving the browser where only one data remains

After deleting all bookmark data from localStorage and closing my website tab or Chrome, I am puzzled as to why there is still one remaining data entry when I revisit the site, which happens to be the most recently deleted data. This is the code snippet I ...

What is the best way to retrieve the second element based on its position using a class name in Jquery?

DisablePaginationButton("first"); The statement above successfully disables the first element that is fetched. DisablePaginationButton("second"); ===> not functioning function DisablePaginationButton(position) { $(".pagination a:" + position).ad ...

I'm struggling to find a way to showcase my JSON data in HTML. Update: I have a clear vision of how I want it to look, but I'm struggling to display it in any format other than raw JSON

I've been trying to figure this out for hours, scouring every resource I can find, but I'm stuck. I've left the API URL in there, so feel free to take a look (it's public). If my message doesn't make sense due to exhaustion, please ...

How can a function be invoked in a child component from a parent component?

I am facing a challenge where I need to trigger the function showExtraBlogposts() in Blogpostreader.js upon clicking on a button rendered in Blog.js. Initially, I attempted to call it using onClick={Blogpostreader.showExtraBlogposts()} but it returned an ...

Utilizing the principles of object orientation in Javascript to enhance event management

After attempting to modularize my JavaScript and make it object oriented, I found myself struggling when dealing with components that have multiple instances. This is an example of how my code currently looks: The HTML file structure is as follows: & ...

What is causing the error message "Uncaught TypeError: Cannot read properties of null (reading 'push')" to be displayed when running this code?

I encountered an issue while trying to run this code which resulted in an Uncaught TypeError: Cannot read properties of null (reading 'push') console.log("HI"); let addbtn = document.getElementById("addbtn"); addbtn.addEventLi ...

Utilizing React-map-gl in combination with either useContext or useState to update the viewport from a separate component

Lately, I've been struggling to understand how to use useContext and/or useState with React/Nextjs along with react-map-gl. In my project, I have a searchbox component that uses Formik and a map component from react-map-gl. What I'm trying to ach ...

Unveiling the Truth about Svelte Transitions

Recently, I attempted to incorporate the guidance provided in this repl () for implementing flying and fading effects on divs. However, it seems that I may have a slight misunderstanding regarding the concept... To tackle this, I designed a component rese ...

Is there a way to make my for loop search for the specific element id that I have clicked on?

When trying to display specific information from just one array, I'm facing an issue where the for loop is also iterating through other arrays and displaying their names. Is there a way to only show data from the intended array? const link = document. ...

What sets apart importing components in computed from importing components in dynamic import in Vue.js?

Imagine there are 4 components available on a page or within a component, and the user can utilize them based on their selection by toggling between Input, Image, Video, or Vudio components. There are two ways to lazily load these components: 1) <temp ...

Customizing Material UI Select for background and focus colors

I am looking to customize the appearance of the select component by changing the background color to "grey", as well as adjusting the label and border colors from blue to a different color when clicking on the select box. Can anyone assist me with this? B ...

Partially extended texture in Three.js

Currently, I am using the Collada loader in Three.js r65 to load my 3D object. Upon loading, I apply a texture to all parts of the model using the following code snippet. var loader = new THREE.ColladaLoader(); loader.options.convertUpAxis = true; loader ...

Please ensure that the menu is included within the HTML file

How can I include a menu from menu.html into index.html? The content of menu.html is: <li><a href="home.html">Home</a></li> <li><a href="news.html">News</a></li> In index.html, the code is: <!docty ...

Vanishing Act: React-js MUI Tooltip vanishes upon clicking

The standard behavior of the MUI Tooltip is as follows:
 If the button/icon to trigger a tooltip is not in focus, the tooltip will not disappear when clicking directly on the popper. However, if the button/icon is focused, the tooltip will disappear upo ...

Here is a unique version: "A guide on centering a carousel item in jquery upon being clicked."

Does anyone know how to center the item I click in a carousel? I've searched high and low for a solution but couldn't find a clear answer. Can someone please assist me with this? This is what I have tried so far: http://jsfiddle.net/sp9Jv/ Here ...

Exploring the potential of utilizing the "wait" function in Selenium WebDriver for

I want to automate a test on my website using the Selenium WebDriver for JavaScript. How can I approach running tests here with content that may not be ready when the page loads, such as data coming from an external API? In my case, the content is loaded ...

Click on the hyperlinks one by one that trigger ajax events

There is a feature on the popular social media platform reddit.com where you can load more comments by clicking a link. I understand that comments may be hidden for performance reasons, but I would like to automatically expand all comments without having t ...

Is Eslint functioning in just one Sublime Text project?

I have encountered an issue where I duplicated the .eslintrc and package.json files for two projects, but only the first project is able to run linting properly. The second project does not show any errors. I am using sublime-linter with the eslint modul ...

Replace Original Image with Alternate Image if Image Error Occurs Using jQuery (Bootstrap File Input)

I am currently utilizing the Bootstrap File Input component for file uploads, and it's working splendidly. I have set up the initialPreviewConfig to display the existing image on the server. However, there are instances when there is no file available ...