-
// BirdShaders.hlsl — GPU Feather Simulation
StructuredBuffer<float3> FeatherBasePositions;
RWStructuredBuffer<float3> FeatherPoints;
cbuffer FeatherParams { float WindStrength; float Flexibility; float Time; }
[numthreads(256, 1, 1)]
void main(uint3 id : SV_DispatchThreadID)
{
float3 base = FeatherBasePositions[id.x];
float3 p = FeatherPoints[id.x];
float wind = sin(Time * 3 + id.x * 0.1) * WindStrength;
float curl = curlnoise(p * 0.25) * 0.3;
// Feather bending = base anchor + wind deformation + curl turbulence
p = lerp(base, p + float3(0, wind, curl), Flexibility);
FeatherPoints[id.x] = p;
} -
// Aerodynamics.h
#pragma once
#include "Math.h"
struct AeroForces {
Vec3 lift;
Vec3 drag;
Vec3 turbulence;
};
class Aerodynamics
{
public:
static AeroForces ComputeForces(
const Vec3& velocity,
const Vec3& wingNormal,
float wingArea,
float airDensity,
float featherFlexibility);
};