Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Hide WebGL globe markers when behind

I'm in the process of building a WebGL Globe using OGL (a lightweight webgl library, way smaller than Three.js) and found a way to place markers on the globe, from lat/long coordinates.

It works perfectly and it looks very nice but I am now struggling to "hide" them when they are visually behind the globe. Right now they are still visible even though we should not see them as seen below:

enter image description here

What would be the way to calculate that? And/or if it can't be done, another way could be to show them sticking around the globe to show that some markers are available further.

Here is a working CodeSandbox demo: Globe

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your transform code is a 3D transform, but you only use the x and y coordinates to display the projected labels. You can use the 3rd coordinate to determine if you're in front or behind the sphere.

A quick patch to your code to do as you wish was this:

markerEl.style.display = screenVector[2] < 0.83 ? "block" : "none";
almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!