I helped out the wonderful @by_index team to create this project
π bizupagency.com/en/
This twitter thread is a break-down of the homepage WebGL #threejs interactive animation:
π§΅π
1 - Problem decomposition π
The idea was to have an interactive glossy 3d ball that would interpolate between different states on scroll π±
At this point I know that a custom #shader is going to be involved as well as a sort of key frame manager for the state interpolation
2 - Interactive Bump (1/4) π€π€
With this idea,
I also needed to come up with a mouse interactivity visual on the ball that would be present throughout the animation
These next few parts will be about the development of that βmouse bumpβ
3 - Interactive Bump (2/4) π€π€
The ball is a simple #threejs icosphere with a custom #glsl #shader
Using the RayCaster object, I am tracking the projected position of the mouse on the UV coordinates of the sphere and transfer this data to the fragment shader
4 - Interactive Bump (3/4) π€π€
To have a more βflowy-ish πβ look n' feel,
I ease the bumpPosition, as well as the displacement intensity with the oldest easing math function is the bookπ΄
5 - Interactive Bump (4/4) π€π€
Take that function created in the fragment shader and bring it back up to the vertex shader to plug it into the vertex coordinates,
And boom, we got a bump π£
6 - Noisy Ball π§Ά
Using @hughskennedy βs fantastic glsl-noise repo, the second and 3rd state of the ball are a simple noise function remapped and multiplied to the xyz coordinates of the vertices
7 - Wavy Ball πββοΈ
This time playing around with Mπ
°TH, the 3rd state of the ball is a wavy morph effect using simple trigonometry functions and a bit of spicy noise for more β¨ organicness β¨ (if organicness is a word)
8 - Mix it Mix it Mix it π€π¨βπ³
Now that we have all of our displacement functions,
it's time to put 'em all together using glslβs mix() function and #GSAP to create a timeline, controllable on scroll, interpolating between these states
9 - F*cked Shading π―
I knew that I wanted to use a matcap for this project.
It seemed to be the most adapted and optimized solution for the shading of this component.
Problem was that I now need to recompute the F*cked normals of the sphere with all these displacements
11 - Normal re-computeπ»
Thanks to a goated article from @marco_fugaro ,
Re-computing the sphere's normals on the fly was done using some good old Mπ
°TH to have the actual new normal data.
Pass that back to the frag shader to update the matcap sampling,
And voilΓ , we done. π€
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.