TGViewer
Прогаем с кенгурой Прогаем с кенгурой @coding_with_kangaroo · 236 subscribers
Post #170 112
Сверху катмулл-ром, снизу - линейная интерполяция


float3 catmullRom(float3 r, float3 g, float3 b, float3 a, float x, float t0) {
float t1 = t0 + 1.0 / 3.0;
float t2 = t1 + 1.0 / 3.0;
float t3 = t2 + 1.0 / 3.0;
float t = x;

float3 D0 = r;
float3 D1 = g;
float3 D2 = b;
float3 D3 = a;

float3 C1 = (t1-t)/(t1-t0)*D0 + (t-t0)/(t1-t0)*D1;
float3 C2 = (t2-t)/(t2-t1)*D1 + (t-t1)/(t2-t1)*D2;
float3 C3 = (t3-t)/(t3-t2)*D2 + (t-t2)/(t3-t2)*D3;

float3 B1 = (t2-t)/(t2-t0)*C1 + (t-t0)/(t2-t0)*C2;
float3 B2 = (t3-t)/(t3-t1)*C2 + (t-t1)/(t3-t1)*C3;

float3 A = (t2-t)/(t2-t1)*B1 + (t-t1)/(t2-t1)*B2;

return A;
}



float3 gradientCatmullRom(float3 r, float3 g, float3 b, float x) {
return select(select(catmullRom(b, r, g, b, x, -1.0 / 3.0),
catmullRom(r, g, b, r, x, 0),
x > 1.0 / 3.0),
catmullRom(g, b, r, g, x, 1.0 / 3.0),
x > 2.0 / 3.0);
}
  • ❤ 1
More from @coding_with_kangaroo
  1. Oct 7, 2026Пополнение библиотеки. Буду расширять область, а то все картинки да картинки
  2. Oct 7, 2026Post #823
  3. Oct 7, 2026А вот еще вспомнил про pixator и решил затащить поддержку видео
  4. Oct 6, 2026Еще вот так умеет
  5. Oct 6, 2026Оно даже работает
  6. Oct 6, 2026Спагетти-архитектура Я знаю, что можно красиво и аккуратно, но ножек в наличии нет, а с ал…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →