Skip to content

Instantly share code, notes, and snippets.

View rubbyzhang's full-sized avatar

rubbyzhang rubbyzhang

  • tencent
  • 上海
View GitHub Profile
@troughton
troughton / AmbientDice.cpp
Last active April 23, 2020 14:32
Ambient Dice
struct Vertex {
vec3 value;
vec3 directionalDerivativeU;
vec3 directionalDerivativeV;
};
void AmbientDice::hybridCubicBezierWeights(u32 i0, u32 i1, u32 i2, float b0, float b1, float b2, VertexWeights *w0Out, VertexWeights *w1Out, VertexWeights *w2Out) const {
const float alpha = 0.5f * sqrt(0.5f * (5.0f + sqrt(5.0f))); // 0.9510565163
const float beta = -0.5f * sqrt(0.1f * (5.0f + sqrt(5.0f))); // -0.4253254042