Skip to content

Instantly share code, notes, and snippets.

View HogJonnyMaxPlay's full-sized avatar

Jonny Galloway HogJonnyMaxPlay

View GitHub Profile
@HogJonnyMaxPlay
HogJonnyMaxPlay / gameShaderLighting.hlsl
Last active December 14, 2016 13:25
This is a typical game shader snippet for lighting/specular. It doesn't conserve energy, so I don't think it's proper PBR. It can probably use a few tweaks.
// shadertype=hlsl
float G1V(float NdotV, float k)
{
return 1.0f / (NdotV * (1.0f - k) + k);
}
float SchlickFresnel(float u)
{
float m = clamp(1 - u, 0, 1);