Логотип Td Glsl Vertex

Td Glsl Vertex

Сообщество
rheadsh
td-glsl-vertex

Write GLSL vertex shaders for TouchDesigner's GLSL MAT operator. Use whenever creating 3D materials, vertex displacement, geometry deformation, mesh animation, instancing effects, custom surface normals, or any shader that needs to manipulate vertex data in 3D space. Also covers the complete vertex + pixel shader pair for GLSL MAT. Trigger when the user mentions GLSL MAT, vertex shader, vertex displacement, mesh deformation, instancing in TouchDesigner, 3D material writing, surface normals in GLSL, or wants to create a custom material for a SOP/geometry node.

Обзор

Издательrheadsh
Репозиторийaudiovisual-production-skills
Название навыкаtd-glsl-vertex
Звёзды
45
Форки
2
Файлы в комплекте
7
ЛицензияMIT
Ссылки
  • Инструкции в формате Markdown

    Модель загружает файл SKILL.md по мере необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой большой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 7

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Издатель навыка на GitHub — rheadsh. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Td Glsl Vertex в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/rheadsh/audiovisual-production-skills/tree/main/td-glsl-vertex
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Добавить навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/rheadsh/audiovisual-production-skills.git /tmp/audiovisual-production-skills
mkdir -p .claude/skills
cp -r /tmp/audiovisual-production-skills/td-glsl-vertex .claude/skills/td-glsl-vertex
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Td Glsl Vertex в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Td Glsl Vertex, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Td Glsl Vertex не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими ключами API.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

TouchDesigner GLSL MAT — Vertex Shader Writing

Write vertex and pixel shaders for TouchDesigner's GLSL MAT operator (not GLSL TOP). GLSL MAT applies to 3D geometry and requires both a vertex shader and a pixel shader in separate DATs.

Quick Start — Minimal GLSL MAT

Vertex Shader DAT (e.g. glsl_vert):

glsl
// Minimum viable vertex shader
out vec3 vWorldPos;   // Custom varying to pixel shader
out vec3 vNormal;

void main() {
    // 1. Deform: applies instancing, skinning → world space
    vec4 worldPos = TDDeform(P);

    // 2. Project: world → clip space
    gl_Position = TDWorldToProj(worldPos);

    // 3. Pass data to pixel shader
    vWorldPos = worldPos.xyz;
    vNormal   = normalize((uTDMats[TDCameraIndex()].worldForNormals * N).xyz);
}

Pixel Shader DAT (e.g. glsl_frag):

glsl
// Input varyings from vertex shader
in vec3 vWorldPos;
in vec3 vNormal;

layout(location = 0) out vec4 fragColor;

void main() {
    vec3 color = vNormal * 0.5 + 0.5;  // Visualize normals
    fragColor = TDOutputSwizzle(vec4(color, 1.0));
}

GLSL MAT Setup:

  • Load Page → Vertex Shader: point to your vertex DAT
  • Load Page → Pixel Shader: point to your pixel DAT

Critical Rules

  1. Never declare the TD-provided vertex attributes — P, N, uv[0], Cd, T — they are auto-injected
  2. Never declare default varyings — vUV, vP, vN, vColor — TD provides these if you don't supply a custom vertex shader
  3. Always call TDDeform(P) before TDWorldToProj() — skipping it breaks instancing and skinning
  4. Always match varyings: every out in the vertex shader needs an in in the pixel shader with the same name and type
  5. No #version directive — TouchDesigner injects it automatically
  6. Pixel shader output uses layout(location = 0) out vec4 fragColor; (with layout qualifier, unlike GLSL TOP)

Auto-Provided Vertex Attributes (DO NOT Declare)

glsl
P       // vec3  — vertex position in object/local space
N       // vec3  — vertex normal in object space
uv[0]   // vec4  — texture coordinate layer 0 (uv[1], uv[2]... for additional layers)
Cd      // vec4  — vertex color (RGBA)
T       // vec4  — tangent vector (for normal mapping)

These are injected by TD at compile time. Declaring them yourself causes errors.


Core Vertex Functions

glsl
// Transform local position → world space (applies instancing + skinning)
vec4 TDDeform(vec3 pos)
vec4 TDDeform(vec4 pos)

// Transform world/view space → clip space (NDC for gl_Position)
vec4 TDWorldToProj(vec4 worldPos)
vec4 TDWorldToProj(vec3 worldPos)

// Per-instance unique ID (use for per-instance variation)
int TDInstanceID()

// Camera index (for multi-camera / stereo rendering)
int TDCameraIndex()

The standard transform chain: gl_Position = TDWorldToProj(TDDeform(P));


Key Uniform Structs

glsl
// Transformation matrices — indexed by camera (use TDCameraIndex())
struct TDMatrix {
    mat4 world;              // Object → world
    mat4 worldCam;           // Object → camera
    mat4 cam;                // World → camera (view matrix)
    mat4 proj;               // Camera → clip (projection)
    mat4 worldCamProj;       // Combined MVP
    mat3 worldForNormals;    // Inverse-transpose for normal transform
    mat3 worldCamForNormals; // Normal matrix in camera space
};
uniform TDMatrix uTDMats[TD_NUM_CAMERAS];

Transform normals correctly:

glsl
// ❌ Wrong — does not handle non-uniform scale
vec3 worldNormal = mat3(uTDMats[0].world) * N;

// ✅ Correct — uses inverse-transpose
vec3 worldNormal = normalize(uTDMats[TDCameraIndex()].worldForNormals * N);

Varyings — Passing Data Vertex → Pixel

Declare out in vertex, matching in in pixel:

glsl
// Vertex shader
out vec2  vTexCoord;   // UV coordinates
out vec3  vWorldNorm;  // World-space normal
out vec4  vVertColor;  // Vertex color passthrough
out float vDisplace;   // Any scalar

// Pixel shader (must match exactly)
in vec2  vTexCoord;
in vec3  vWorldNorm;
in vec4  vVertColor;
in float vDisplace;

The GPU interpolates these values across each triangle — what arrives in the pixel shader is a smooth blend across the surface.

See reference/VARYINGS.md for full patterns.


Instancing

When Render TOP has instancing enabled, each instance gets a unique TDInstanceID(). You can sample per-instance data from a CHOP or texture:

glsl
uniform sampler2D uInstanceData;  // CHOP/texture with per-instance values
uniform int uInstanceCount;

void main() {
    int id = TDInstanceID();

    // Sample per-instance position offset from texture row
    float u = (float(id) + 0.5) / float(uInstanceCount);
    vec4 offset = texture(uInstanceData, vec2(u, 0.5));

    vec4 worldPos = TDDeform(P + offset.xyz);
    gl_Position   = TDWorldToProj(worldPos);
    ...
}

Common Patterns

See reference/VERTEX-API.md for the complete function reference.

Vertex Displacement

glsl
uniform float uDisplaceAmount;
uniform float uTime;

void main() {
    // Displace along local normal
    float noise = TDSimplexNoise(vec3(P * 2.0 + uTime * 0.5));
    vec3 displaced = P + N * noise * uDisplaceAmount;

    gl_Position = TDWorldToProj(TDDeform(displaced));
}

Wave Deformation

glsl
uniform float uFrequency;
uniform float uAmplitude;
uniform float uTime;

void main() {
    vec3 pos = P;
    pos.y += sin(pos.x * uFrequency + uTime) * uAmplitude;
    pos.y += sin(pos.z * uFrequency * 0.7 + uTime * 1.3) * uAmplitude * 0.5;

    gl_Position = TDWorldToProj(TDDeform(pos));
}

Response Format

When writing a GLSL MAT shader, always provide:

  1. Vertex Shader — complete GLSL code with comments
  2. Pixel Shader — complete GLSL code, matching all varyings
  3. TouchDesigner Setup:
    • Load Page: which DAT goes in Vertex Shader / Pixel Shader fields
    • Uniforms: parameter page, name, type, value or expression
    • Render setup notes if instancing or lighting is involved

Common Errors

ErrorCauseFix
'P' : redefinitionDeclared P in shaderRemove your declaration — TD provides it
Black / no geometryForgot TDDeform()Use TDDeform(P) before TDWorldToProj()
Varyings mismatchName/type differs between stagesVerify out ↔ in names and types match exactly
Instancing brokenManual position, no TDDeformAlways route through TDDeform()
Normal flippingWrong normal transformUse worldForNormals matrix, not world
layout errorMissing layout(location=0)Pixel output must be layout(location = 0) out vec4 fragColor;

Additional Resources

Файлы в комплекте

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ Td Glsl Vertex?

Write GLSL vertex shaders for TouchDesigner's GLSL MAT operator. Use whenever creating 3D materials, vertex displacement, geometry deformation, mesh animation, instancing effects, custom surface normals, or any shader that needs to manipulate vertex data in 3D space. Also covers the complete vertex + pixel shader pair for GLSL MAT. Trigger when the user mentions GLSL MAT, vertex shader, vertex displacement, mesh deformation, instancing in TouchDesigner, 3D material writing, surface normals in GLSL, or wants to create a custom material for a SOP/geometry node.

Зачем использовать Td Glsl Vertex в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Td Glsl Vertex — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Td Glsl Vertex в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/rheadsh/audiovisual-production-skills/tree/main/td-glsl-vertex. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Td Glsl Vertex?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Td Glsl Vertex?

С любым количеством. В TypingMind вы можете использовать Td Glsl Vertex с любой моделью, которая поддерживает навыки, в том числе с GPT, Claude, Gemini, Grok, DeepSeek, Mistral и Llama. Для этого вы используете собственные ключи API.

Бесплатен ли навык ИИ Td Glsl Vertex?

Да. Навык опубликован на GitHub по лицензии MIT. Издатель — rheadsh. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это набор инструкций, которыми модель ИИ может пользоваться каждый раз, когда ей нужно выполнить конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты, которые она может вызывать: при вызове где-то выполняется код и возвращает результат. Навык ИИ, напротив, даёт модели знания и описывает порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇