Having trouble rendering only half of a sphere in three.js

I'm currently working on a skydome project in three.js and here is how I am approaching it:

var geometry = new THREE.SphereGeometry( 40, 32, 15, 1*Math.PI/2, 2*Math.PI, Math.PI, Math.PI);
var material = new THREE.MeshBasicMaterial( { color: 0xddddff } );
mesh = new THREE.Mesh( geometry, material );
mesh.material.side = THREE.DoubleSide;
scene.add( mesh );

However, while this code successfully renders half of a sphere, it also colors the area that I intended to be open (the surface needed for the skydome). How can I troubleshoot and fix this issue?

Answer №1

  1. Creating a custom skydome using a custom mesh is highly recommended as drawing half a sphere may not correctly position UVs.

  2. If you opt to use a skydome, consider using mesh.material.side = THREE.BackSide instead of .DoubleSide, especially if you will not be staying on the surface constantly.

Answer №2

My approach to drawing the sphere was flawed:

var geometry = new THREE.SphereGeometry( 50, 60, 60, Math.PI, Math.PI, 3*Math.PI/2);
var material = new THREE.MeshBasicMaterial( { color: 0xddddff } );
mesh = new THREE.Mesh( geometry, material );
mesh.material.side = THREE.DoubleSide;
scene.add( mesh );

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

The browser failed to display the SVG image, and the console log indicated that the promise was rejected, with the message "false."

I'm struggling to understand why my SVG isn't showing up on the screen. The console log is displaying "false," which I believe indicates that a promise was rejected Here is the TypeScript file I am working with: export class PieChartComponent im ...

What could be causing the issue where only one of my videos plays when hovered over using UseRef?

I'm currently working on a project where I have a row of thumbnails that are supposed to play a video when hovered over and stop when the mouse moves out of the thumbnail. However, I've encountered an issue where only the last thumbnail plays its ...

Clicking on an ID within a jQuery list will return the value

<ul id='myid' > <li>Apple MacBook Pro</li> <li>Apple iPad Pro</li> <li>Apple iPhone 12 Pro</li> <li>Apple Watch Series 6</li> <li>Apple AirPods Pro</li> </ul> ...

Having trouble navigating through filtering in JavaScript using Node and Express?

After experimenting with different methods, I noticed that when using (age => age.Book === book && age.Chapter === 1) as my filter criteria, everything works perfectly. However, when I try using (age => age.Book === book && age.Chapt ...

Using React.js to dynamically display or hide elements generated within a component

I'm currently working on a project where I need to dynamically generate form fields based on certain criteria. Specifically, I want to hide some fields and only show them when other specific conditions are met, a common requirement in form designs. Fo ...

Position the div in the center of a container that is 100% width and has floating elements with dynamic widths

I am looking to align 3 divs inside a container div, with the arrangement of [LEFT] [CENTER] [RIGHT]. The container div should be 100% wide without a fixed width, and I want the center div to stay centered even when resizing the container. The left and ...

Using asynchronous JavaScript (AJAX) to request a file to be processed on the client-side

I have a query that I need help with: My goal is to retrieve a file from the server after it has undergone input-dependent processing through an AJAX request (such as using jQuery). However, I don't want to directly offer this file for download in th ...

A one-page digital space that functions as a dynamic slide show

Check out this cool website I want to emulate. The site is a single-page design where you can navigate vertically using various methods like keyboard, mouse, scroll, or swipe gestures. There are carousels that allow left and right navigation. Each section ...

Leveraging Buttons within React Material UI Tables

I am facing an issue with the logic of editing and deleting rows on a table created using Material UI. The first column of every row contains two buttons for these actions, but I am unsure of how to implement them effectively. Is there a way to achieve thi ...

Error message indicating unfulfilled peer dependency in Ionic Angular when using npm

Having trouble integrating the angular google maps package npm install @agm/core Encountering errors with unmet peer dependencies, unsure of the reason. Could it be that the version of Angular in my project is incompatible with the agm/core package? This ...

Stop automated web crawlers from crawling through JavaScript links

To enable remote jQuery templating, I have embedded some links in JavaScript. For example: <script type="text/javascript"> var catalog = {}; catalog['key1'] = 'somepath/template_1.html'; catalog['key2'] = 'anotherp ...

Tips for inserting a row component into a table using Angular 7

I am currently using the latest version of Angular (7.2.0). I have created a custom tr component as follows: import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-table-row', templateUrl: './table- ...

Executing onClick event in RiotJS upon page load

As I develop a table application using RiotJS, I consistently encounter an issue with the onclick event. Whenever I attempt to utilize the <tag onclick={somefunction}> I face unpredictable behavior. Sometimes, it will excessively call the function ...

What is the best way to modify an array of objects within component state?

I am currently working on updating a specific property of an object that is stored in an array. Here's a glimpse of my current state: state = { todos: [ { id: '1', title: 'first item, completed: false }, { ...

Guide on accessing CGI Script response using AJAX

Greetings, Here is the situation: I'm working on a login form. Once the submit button is clicked, it needs to trigger a CGI script called "someurl?userName=user&password=pwd". Depending on the response from the script, I should be able to navigat ...

Navigating to the default landing page using basic authentication middleware in Express

I'm currently working on implementing basic authorization for an entire website using Express. The goal is to have users enter their credentials, and if correct, they will be directed to the standard landing page. If the credentials are incorrect, the ...

The date conversion within AngularJS's interpolation is resulting in an incorrect timestamp

Given a timestamp of 1519347000, I am trying to convert it into a date format using interpolation like so: {{$ctrl.myTimestamp | date:'MMM d y, hh:mm'}} The resulting value is Jan 18 1970, 04:02, which is incorrect. The correct date should be F ...

Is it possible to determine the success or failure of an asynchronous function when the function itself already handles errors?

The architecture of my app is currently set up with functions that are scoped to specific modules, such as "Auth" for instance: async function authenticate(email) { let authenticated = false; try { if (email) { if (!validEmail(email) ...

Using async/await in combination with Vuex and Feathers

Please review my code below. I am attempting to integrate Async Await into vuex. While everything is functioning properly, I would like to call another action after this one using async await. However, the expected result is not being achieved as the conso ...

Transforming a Processing (cursor) file into an interactive webpage

I have created a custom cursor using Processing and now I want to incorporate it into my website. Is there a way to convert the cursor into a .java file so that I can include it in my HTML file? ...