To build the current scene, we generated the terrain and the sky using procedural techniques based on triangles and Perlin noise. The water surface is created with triangle strips, where each vertex receives a height value calculated from Perlin noise, producing smooth wave patterns that move organically across the grid. The same noise function is used to add color variation to the water, making the surface look deeper and more dynamic. The clouds in the sky are driven by layered Perlin noise, giving them natural softness and density variation. After that, we added a reflective sphere using spherical coordinates and texture generation to simulate a floating object. We also improved the sunset by adjusting the color transitions in the sky dome, enhancing the warm tones and atmospheric depth.
We enhanced the sunset by modifying the sky dome’s color interpolation, blending warm reds, oranges, and soft blues to create a smoother atmospheric gradient. The lighting transition was adjusted so the horizon appears brighter while the upper sky darkens gradually. To add the floating sphere, we generated a full 3D sphere using stacks and slices, applied environment-based texture coordinates, and blended it with transparency so it reflects the colors of the scene while maintaining a soft glowing appearance.
To generate the shadow beneath the reflective sphere, I implemented a procedural shading function that darkens the water based on the sphere’s influence over the surface. Instead of using real-time shadow mapping, the shadow is computed analytically by measuring the distance from each water vertex to the sphere’s center. Using this distance, the
sphereShadowFactor() function returns a brightness value between 0.45 and 1.0, creating a soft falloff that looks like a natural shadow. This factor is then multiplied with the water’s color so vertices closer to the sphere become darker, while distant vertices remain fully lit. By applying this calculation inside the water-rendering loop, the shadow blends smoothly with the waves.