You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
776 B
Plaintext

/******************************************************************************/
/*
Project - MudBun
Publisher - Long Bunny Labs
http://LongBunnyLabs.com
Author - Ming-Lun "Allen" Chou
http://AllenChou.net
*/
/******************************************************************************/
#ifndef MUDBUN_NORMAL_DEFS
#define MUDBUN_NORMAL_DEFS
#include "Math/Vector.cginc"
float normalDifferentiationStep;
float normalQuantization;
float normal2dFadeDist;
float normal2dStrength;
int invertNormals = 0;
bool should_quantize_normal()
{
return normalQuantization > kEpsilon;
}
float3 quantize_normal(float3 n)
{
float step = lerp(0.01f, 1.0f, normalQuantization);
return normalize_safe(quantize(n, step), 0.0f);
}
#endif