Skip to content

Instantly share code, notes, and snippets.

View pollend's full-sized avatar
:octocat:
working on random stuff

Michael Pollind pollend

:octocat:
working on random stuff
View GitHub Profile

To integrate the Phong lighting model into a raytracer, you essentially use the raytracer to handle the geometry and visibility (finding what the light hits), while the Phong model handles the color and intensity calculation at that specific hit point.

In a standard raytracer, for every pixel, you cast a primary ray from the camera into the scene. When that ray intersects an object, you calculate the lighting for that point using the three components of the Phong model: Ambient, Diffuse, and Specular.


1. The Intersection Point

When your ray $R(t) = O + tD$ hits a surface, you need three pieces of information to compute Phong lighting:

Warfork Release Notes

Covers changes from the previous release through the current master.

Highlights

  • New Vulkan renderer. Warfork now ships a Vulkan-based renderer (NRI backend) alongside the existing OpenGL one. You can pick which to use from the video options menu. The new backend brings modern descriptor management, GLSL→SPIR-V shader compilation via glslang, and a foundation for future graphics work.
  • Steam integration. Steam avatars, friends, server browser, server info, and ticket-based authentication are now wired through a dedicated Steam shim. Includes groundwork for peer-to-peer connections and voice chat (both currently opt-in / disabled by default while we soak-test them).
  • Warmonger master server. New first-party master server with up-to-date server lists, in-band browser updates, and richer server info (including Steam ID).
  • Crash reporting. Crashes are now captured via Crashpad and uploaded to Sentry with debug symbols, so we can actually fix what's hitting pla

● Changelog: 82128e31 → master

Range: 2024-11-11 → 2026-05-02 (502 commits)

Major features

  • New Vulkan renderer (NRI backend). Replaces the old OpenGL ref module. Includes GLSL→SPIR-V pipeline via glslang, descriptor pools, dynamic vertex/index buffers, ring/segment/scratch allocators, frame ring allocator, pogo buffers for FXAA + color correction, lightmap texture arrays, screenshot support, fullscreen toggle, fog/skybox/portal/shadow shaders, and a ref_import module to centralize the renderer interface (PR #282 and follow-ups).

Changelog: v2.16.0 → master (8d5284729)

Range: 8278f5cfe (v2.16.0, 2025-05-23) → 8d5284729 (2026-05-02) 126 commits (95 non-merge) across ~11 months.

Renderer / Vulkan

  • Reworked the Vulkan backend and resource uploader pipeline (63cc1b2b0, e328da98b)
  • Moved r_imagelib into ref_base (#510)
// MIT License
//
// Copyright (c) 2017 Nikolay Govorov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
const std = @import("std");
pub fn EvictingFifo(
comptime T: type,
comptime size: usize,
) type {
return struct {
items: [size]T,
head_index: usize,
tail_index: usize,
macro_rules! db_id {
($type: ty,$name:ident) => {
#[derive(Debug, Clone, Copy, PartialEq, Eq, sqlx::Type, Hash)]
#[sqlx(transparent)]
pub struct $name(pub $type);
impl $name {
pub fn new(id: $type) -> Self {
Self(id)
}
}
// MIT License
//
// Copyright (c) 2017 Nikolay Govorov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
pub const std = @import("std");
pub fn IndexPool(comptime T: type) type {
return struct {
const Self = @This();
pub const IdRange = struct {
start: T,
end: T,
// MIT License
//
// Copyright (c) 2017 Nikolay Govorov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: