Golden items catch the eye in the field of view - THREE JS

I am facing an issue with ThreeJS. I have a scene set up like this:

var scene = new THREE.Scene();

scene.fog = new THREE.Fog(0xf7d9aa, 100, 950);

var aspectRatio = GLOBAL.WIDTH / GLOBAL.HEIGHT;
var camera = new THREE.PerspectiveCamera(
    45,
    aspectRatio,
    0.1,
    1000
);

camera.position.z = 50;

scene.add(camera);

var renderer = new THREE.WebGLRenderer({
    alpha: true,

    antialias: true
});

renderer.setClearColor(0xffffff, 0);

renderer.setSize(GLOBAL.WIDTH, GLOBAL.HEIGHT);

renderer.shadowMap.enabled = true;

var container = $('.threejs-container');
container.append(renderer.domElement);

window.scene = scene;

Despite not having any lights in the scene, my objects are still visible. However, objects that are far from the camera appear yellow before displaying their actual color. For instance, an object with a z position at 900 shows up as yellow, while an object with a z position of 100 appears normal.

You can see an example of this issue with circles here: https://i.sstatic.net/c9KOl.jpg

Could someone provide me with some guidance on how to address this issue?

Thank you 🙂

Answer â„–1

Your fog color is the problem - it's yellow!

scene.fog = new THREE.Fog(0xf7d9aa, 100, 950);

If you prefer a different color, consider changing it to a shade of grey instead. You can explore shades of 0xf7d9aa at this link:

To adjust the intensity of the fog, you can also increase the last value (950) to lessen its effect at a greater distance.

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

Firing a personalized event using RxJS

I'm currently delving into the world of Reactive JS. While I have experience triggering custom events in JQuery like this: $(document).bind('eventbus', function(e, d) { console.log(d);}); $(document).trigger('eventbus', 'test ...

Tips for orchestrating the moon's orbit around the Earth and its journey with the Earth around the sun

The moon orbits the earth as the earth orbits around the sun. While trying to maintain the matrix4 methods, I attempted to achieve this through matrix multiplication but encountered some difficulties in changing the order of multiplication. // Solar Sys ...

Selecting a HEX code from a color picker to configure three.js as a string

Recently, I've been using a color picker from jscolor.com that outputs colors in the format of FFA6A6. The challenge I'm facing is integrating this color output with three.js, which requires the color to be in the format of 0xFFA6A6. As much as I ...

Using HTML and JavaScript allows for the video URL to seamlessly open in the default video player app on the device

Working on my mediaplayer website, I want to give users the option to choose which app to play their uploaded videos with. So far, I've attempted to implement a button that triggers this action: window.open("video.mkv", '_blank'); Howeve ...

Running Next.js with various environment variables

In my NextJS project, I'm looking to set up three different environments: development, staging, and production. Each environment requires specific variables to run properly. For development, I use a file named .env, for production it's .env.produ ...

Screen rendering can be a challenging task

As I dive into learning how to use THREE.js for creating browser games, I've encountered a roadblock. Every time I attempt to import a model using the code, the screen just renders black. Surprisingly, I've been smoothly coding and running it in ...

Is it possible to securely embed videos on external websites while also utilizing tokens to safeguard the content?

Protecting our video content on our website is a top priority, which is why we have implemented a system where a token is grabbed through AJAX and verified through PHP before allowing the download of any files. As I delve into providing an embed feature s ...

The MUI Select event is coming back as undefined

I am facing an issue with a Select component in my MUI form. Here is my current state: const [formdata, setformdata] = useState({}); This is my event handler: const onchangehandle = (e) => { setformdata((prevState) => ({ ...prevState, [e.target. ...

What is the name of the scrolling header effect achieved in the following?

I've been seeing a lot of people using a unique header effect lately and I'm curious to learn more about how it's done. Can anyone explain the process behind achieving this effect, what it's called, and if there are any good tutorials a ...

Having difficulty displaying elements from two arrays at particular intervals

I am currently working with two arrays that have the same number of items in each. My goal is to print these items in intervals within the console. The desired output would look something like this: 1 Bruce Wayne 45 Then, after a one-second interval, it s ...

Developing with PHP and Ajax with the onchange event handler

This is the code snippet from my cat.php file: <script> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlh ...

Break down the text of a paragraph into separate words, placing each word within its own span element, and then add animations

I am facing an issue with my paragraph element that has the display property set to hidden. I have split each word of the paragraph and placed them inside individual span elements. My goal is to create an effect where each word comes from different locatio ...

Highlight or unhighlight text using Javascript

Currently, I am facing a challenge in highlighting specific words on an HTML page. Although I have succeeded in highlighting the desired element, I am struggling with unhighlighting the previous word when a new search is conducted. Despite my attempts to i ...

Unleashing the power of AJAX to showcase data in an HTML form

I am faced with the following data scenario. Javascript file var numbers = 1234 HTML file. <label>Name</label> <input type="text" class="form-control" name="name" id = "name"> <label>Id</label> <input type="text" class ...

Koa cookie fails to return expected value of `undefined`

Once a POST request is initiated from the browser to the server's /generate endpoint, my goal is to create a string and store it as a cookie. Subsequently, when a GET request is sent from the browser to the /retrieve endpoint on the server, I intend t ...

Fetch data dynamically upon scrolling using an AJAX request

Instead of making an ajax call to load data, I want to do it on scroll. Here is the code I have: $.ajax({ type: 'GET', url: url, data: { get_param: 'value' }, dataType: ' ...

When the submit button is clicked, only the last form within the function will be submitted

I currently have a submit button that is meant for 3 different forms. When submitting, I use the following approach: restaurantCreateForm = function(){ document.getElementById("restaurant-features" ).submit(); document.getElementById("information_ ...

Arrange elements prior to the treeview within the unordered list/ list items

Below is a snippet of code that I am working with: <ul> <li>group 1 <ul> <li>group 1.1</li> <li> group 1.2</li> <li>group 1.3 <ul> <li>group 1.3.1</li> <l ...

Axios encounters difficulty retrieving the response data following a POST request

When using axios to post data and fetch a response, I am encountering an issue where the data is successfully posted but the response data cannot be printed. This works correctly in Postman, so I'm not sure if the problem lies with the backend or fron ...

Concealing the pathway to a background image

Currently, I have a large grid made up of divs that display different sections of an image. By using background-image and background-position, I am able to showcase parts of the image. However, one issue is that users can easily view the complete image by ...