Day 10 of building a custom 3D game engine from scratch in C++ and DirectX 12 using the Microsoft GDK.

In today’s update, I implemented a real-time orbiting Point Light with smooth distance attenuation and Blinn-Phong specular highlights, combining it with our existing directional and ambient lighting while keeping the 40x40 reference grid unlit.

Chapters:
00:00 Intro - Day 10 C++ & DirectX 12 Game Engine
00:25 Live Engine Demo - Orbiting Point Light & Attenuation in Real Time
01:25 Step 1 - Expanding SceneConstantBuffer to 256 Bytes (Game.h)
02:10 Step 2 - Point Light Distance Attenuation & Blinn-Phong Shader (shaders.hlsl)
03:00 Step 3 - Animating & Uploading Point Light Data in Game::Update() (Game.cpp)

What’s new in Day 10:

  • Expanded 256-Byte Constant Buffer: Added pointLightPos, pointLightColor, pointLightRange, and pointLightInt to SceneConstantBuffer in Game.h while adjusting padding to maintain strict 256-byte alignment.
  • Point Light & Distance Attenuation in PSMain: Updated shaders.hlsl to compute world-space light distance and range-based smooth attenuation, adding diffuse and Blinn-Phong specular contributions on top of directional and ambient lighting (useLighting = 1.0f), while keeping the grid unshaded (useLighting = 0.0f).
  • Per-Frame Orbital Animation: Updated Game::Update() to orbit a warm Point Light around the rotating cubes in real time using timer.GetTotalSeconds() and upload its parameters into each cube’s mapped Constant Buffer.

Current Engine Controls:

  • W / A / S / D: Move forward, left, backward, right
  • Q / E: Move down / up
  • Right Mouse Button + Move: Free look (Yaw & Pitch)
  • Left Shift: 2.5x movement speed boost
  • Mouse Wheel: Adjust base camera speed
  • R: Reset camera to default position and orientation
  • Link Point Light Day 10:https://youtu.be/AfUWnVofeWg

Tech Stack: C++, DirectX 12, HLSL, DirectXMath, Win32 API, Microsoft GDK.

Follow the daily engine development journey here on Low-Level Code | USA.

CPP #DirectX12 #GameEngine #GraphicsProgramming #EngineProgrammer #LowLevelProgramming #GameDev #MicrosoftGDK hlsl #PointLight #BlinnPhong