ICM WEEK5
PROCESS
This week I started watching a few WEBGL tutoials and exploring 3D shapes in P5. After learning about textures, I found it an interesting idea to create planets for the time assignment.I encounter a few problems simply navigating in WEBGL, for example, getting used to all the 3D shapes insread of the 2D assests we’ve been using.
Creating the 3D planets was quite easy to catch on. The only problem that I could not solve was how to make the planets rotate on their own, isntead of rotating around the function drawn before them. In a perfect world, I would also want the planets to not collide into each other.
I created a few orbits using for loops and the torus shapes to make it a bit more abstract and expressive.
Then I started torture myself by trying to figure out how to create a moving starfield in the background. Luckily, there was a coding train video on creating a starfield which helped me with the logic of creating moving stars. However, the video is on creating a starfield in the 2D space. So I had to figure out how to translate it in WEBGL.
I was originally using the int() to map star sizes, but I heard about ceil function, which calculates the closest integer value that is greater or equal to the number, instead of just rounding them up. This made my stars appear bigger with variety (not sure if I comepletely understand it but I love this effect).
REFERENCE
Coding Train - Star Field
Define Array
SOLVED PROBLEMS
- using WEBGL to create shapes and adding textures
- using Zposition to give stars dimensions and depth
- ceil()
THINGS TO IMPROVE
- How to make the planets rotate on their own?