Hello!
You've landed in the repository for my interactive 3D globe landing page! This project is a dynamic and visually engaging web experience built with React, Three.js, and Tailwind CSS. It combines an interactive 3D globe with a showcase of my projects, all wrapped in a responsive and modern design.
This README aims to provide a comprehensive overview of the project, from its architecture and features to the technologies used and the installation process. I hope you find it informative and inspiring!
The centerpiece of this landing page is an interactive 3D globe, meticulously crafted using Three.js and enhanced with custom shaders and textures. The globe is composed of several layers, each contributing to its realism and interactivity:
Earth Sphere: The core of the globe, rendered as a sphere with detailed textures for surface, bump mapping, and specular highlights. Two versions exist:
Earth (Static): A base sphere with static textures. (Earth)
Earth Season (Animated): A dynamic sphere with animated seasonal textures, achieved through custom shaders and texture manipulation. (Earth Season)
KTX2Loader
.texturePathGeneration
in test_split_sphere_weather.jsx.RoughnessTexturePathGeneration
in test_split_sphere_weather.jsx.Earth Cities Light: A custom shader illuminates city lights on the night side of the globe, using alpha maps and emissive properties for a realistic nighttime glow. (Earth Cities Light)
Earth Cloud: A simple sphere with a cloud texture applied as an alpha map, adding a layer of atmospheric detail. (Earth Cloud)
Earth Fresnel: A single-color sphere with a custom shader that simulates a light-accurate Fresnel effect, enhancing the globe's visual depth. (Earth Fresnel)
Earth Atmosphere: A sphere with inverted normals and a reverse Fresnel effect, creating a realistic light scattering effect for the atmosphere. (Earth Atmosphere)
These layers are combined and managed within components like Earth Meshes Atmosphere and Earth Meshes Physical. The EarthMeshesPhysical
component utilizes gsap
for animations and Redux for managing the selected location and triggering animations.
The landing page features a project showcase, highlighting my skills and experience. Each project is presented with a title, description, and relevant details:
The Project.jsx component dynamically loads project information and panel images.
The useIsVisible
hook is used to detect when a project comes into view, triggering animations and updating the camera and background via Redux actions.
Projects include:
Animations play a crucial role in enhancing the user experience and providing visual feedback. The project employs a variety of animation techniques:
useFrame
hook from React Three Fiber.EarthMeshesPhysical
uses gsap
timelines to smoothly transition between locations.The graphical user interface (GUI) provides users with controls to interact with the globe and explore different features. The GUI is built with:
During development, Leva is used for debugging and quick UI adjustments, thanks to its easy and fast hook implementation.
The project structure is organized to promote maintainability and scalability:
.
├── .eslintrc.cjs # ESLint configuration
├── .gitignore # Specifies intentionally untracked files that Git should ignore
├── CNAME # Custom domain name configuration
├── components.json # Configuration for shadcn/ui components
├── index.html # Main HTML file
├── package.json # Project dependencies and scripts
├── postcss.config.js # PostCSS configuration
├── README.md # Project documentation
├── tailwind.config.js # Tailwind CSS configuration
├── tsconfig.json # TypeScript configuration
├── vite.config.js # Vite build tool configuration
├── .github/ # GitHub workflow configurations
│ └── workflows/
├── public/ # Public assets
│ ├── basis/ # Basis Universal transcoder files
│ ├── music/ # Music files
│ ├── textures/ # Static textures
│ ├── textures_sequence/ # Texture sequences for animations
│ └── textures_transition/ # Transition textures
├── readme_assets/ # Assets for the README file
│ ├── Animation.gif
│ ├── Earth_Examine.gif
│ ├── earth_layers.gif
│ └── Screenshot (508).png
└── src/ # Source code
├── index.css # Global styles
├── Template_main.jsx # Main application component
├── assets/ # Static assets
├── cameras/ # Camera configurations
├── components/ # Reusable React components
├── context/ # React Context providers
├── editor/ # Editor-related components
├── grid/ # Grid-related components
├── Hook/ # Custom React hooks
├── lib/ # Utility functions
├── lights/ # Light configurations
├── meshes/ # 3D mesh components
│ └── earth/ # Earth-related components
├── music/ # Music-related components
├── official/ # Official components
├── postprocesses/ # Post-processing effects
└── UI/ # User interface components
This project leverages a range of modern web development technologies:
To optimize texture loading and performance, the project utilizes KTX2 compressed textures. These textures are efficiently loaded using the KTX2Loader
from Three.js. The public/basis
directory contains the necessary Basis Universal transcoder files for decoding these textures.
The project also includes a script, public/textures_sequence/upscayl_batch.sh
, used for upscaling textures. This script automates the process of enhancing texture resolution using Upscayl, an AI-based image upscaling tool.
To run this project locally:
git clone https://github.com/th-nguyen-dev/ryannguyenweb.git
cd ryannguyenweb
npm install
npm run dev