Is there a way to switch planet textures with a button click?

Hey, This is my fist post here, so please forgive me if I am asking too many questions. I am VERY new to three.js, and WebGL as a whole. Actually, I’m kinda new to JavaScript… there I said it.

But I am trying to put together a small project of planets. I ran across the discussion found here and it is almost exactly what I have been looking for.

I made a few edits to remove things that I don’t need/want, and have this (hopefully that fiddle shows up):

The first things I’d like to do is remove that loading screen, as well as the black background.
Then I want to be able to show the planet in a div/container so that I can add a different CSS background.

The last thing I’d like help on is that I will have a list of planets. I want to be able to click on a planet name and have the planet texture change based on whatever name is clicked.
What I have in mind is VERY close to what has been done here:

But I’m hoping there is a less verbose way of switching the planet textures in JS than using the else if statements.

I know I’m asking a lot, but I appreciate any and all help you all can provide.


you can switch the planet through modify the material of planet