# Catálogo de nodos

> Todos los nodos de los grafos de shader de Pyzed, por categoría: qué hacen, sus entradas, salidas y ajustes, y un pequeño ejemplo para copiar.

Source: https://albakore.github.io/pyzed/es/shading/nodes/

Un grafo de shader se compone de **92 tipos de nodo** (y 137 entradas en la barra lateral de la vista
Shader, porque muchos nodos vienen en varias variantes: *Sumar*, *Multiplicar* y *Step* son todos el nodo
**Math**). Este catálogo describe cada uno: para qué sirve en palabras sencillas, sus puertos y ajustes, y un
ejemplo en Python.

## Cómo leer un nodo

```mermaid
flowchart LR
    in1["entradas (izquierda)"] --> node["Nodo<br/>ajustes dentro"] --> out1["salidas (derecha)"]
```

- Las **entradas** están a la izquierda de un nodo y las **salidas** a la derecha. Un cable va de una salida a una
  entrada.
- Una entrada sin cable usa su **valor por defecto**: un número, un vector, un color o un valor de *contexto* como
  *UV* (la posición del píxel) o *Tiempo*. Puedes escribir otro valor directamente en el nodo.
- Los **ajustes** no son puertos: una operación, un tipo de ruido, un modo de fusión, las paradas de un degradado.
  Se cambian en el panel Propiedades (o como argumentos con nombre en Python).

### Tipos

| Tipo | Qué guarda | Ejemplo |
| --- | --- | --- |
| `float` | Un número | `0.5`, un brillo, un tiempo |
| `int` | Un número entero | `5` octavas |
| `bool` | Verdadero o falso | ¿está el ratón sobre el shader? |
| `vec2` | Dos números | una posición `(x, y)`, un tamaño |
| `vec3` | Tres números | un color `(r, g, b)` de 0 a 1 |
| `vec4` | Cuatro números | un color con alfa `(r, g, b, a)` |
| `texture` | Una imagen | una variable `texture` |
| `T` | Cualquiera de los tipos numéricos | nodos de matemáticas: el tipo más ancho que se les conecta |

Los valores se convierten por el camino: un `float` rellena todos los componentes de un vector (`0.5` pasa a ser
`(0.5, 0.5, 0.5)`) y un `vec3` se vuelve un color con alfa 1. Un cable que nunca puede funcionar, como una textura
hacia un número, se rechaza.

**Números de 0 a 1:**

En los shaders, los colores y la mayoría de las máscaras van de **0 a 1**, no de 0 a 255: `(1, 0.5, 0)` es naranja,
`0` es negro y `1` es blanco. Muchos nodos devuelven 0..1 para que puedas multiplicarlos entre sí, como apilar
plantillas.

## Todos los nodos

|  |  |
| --- | --- |
| **Entrada** | [UV](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#uv), [Píxel](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#píxel), [Tamaño](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#tamaño), [Tiempo](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#tiempo), [Ratón](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#ratón), [UV centrado](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#uv-centrado) |
| **Parámetros** | [Parámetro](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#parámetro) |
| **Constantes** | [Decimal](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#decimal), [Entero](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#entero), [Booleano](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#booleano), [Vector2](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#vector2), [Vector3](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#vector3), [Vector4](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#vector4), [Color](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#color), [Constantes matemáticas](https://albakore.github.io/pyzed/es/shading/nodes/inputs/#constantes-matemáticas) |
| **Matemáticas** | [Matemáticas](https://albakore.github.io/pyzed/es/shading/nodes/math/#matemáticas-1), [Función](https://albakore.github.io/pyzed/es/shading/nodes/math/#función), [Mezclar](https://albakore.github.io/pyzed/es/shading/nodes/math/#mezclar), [Limitar](https://albakore.github.io/pyzed/es/shading/nodes/math/#limitar), [Paso suave](https://albakore.github.io/pyzed/es/shading/nodes/math/#paso-suave), [Reasignar rango](https://albakore.github.io/pyzed/es/shading/nodes/math/#reasignar-rango), [Multiplicar y sumar](https://albakore.github.io/pyzed/es/shading/nodes/math/#multiplicar-y-sumar) |
| **Vector** | [Componer](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#componer), [Descomponer](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#descomponer), [Reordenar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#reordenar), [Producto escalar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#producto-escalar), [Producto vectorial](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#producto-vectorial), [Longitud](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#longitud), [Distancia](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#distancia), [Normalizar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#normalizar), [Reflejar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#reflejar), [Polar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#polar) |
| **UV** | [Repetición y desplazamiento](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#repetición-y-desplazamiento), [Desplazar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#desplazar), [Rotar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#rotar), [Remolino](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#remolino), [Pixelar](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#pixelar), [Barril](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#barril), [Caleidoscopio](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#caleidoscopio), [Voltear](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#voltear), [Repetir](https://albakore.github.io/pyzed/es/shading/nodes/vectors-uv/#repetir) |
| **Ruido** | [Ruido](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#ruido-1), [Ruido fractal](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#ruido-fractal), [Voronoi](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#voronoi), [Ruido blanco](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#ruido-blanco), [Aleatorio](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#aleatorio) |
| **Patrones** | [Tablero](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#tablero), [Franjas](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#franjas), [Cuadrícula](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#cuadrícula), [Puntos](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#puntos), [Degradado lineal](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#degradado-lineal), [Degradado radial](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#degradado-radial), [Onda](https://albakore.github.io/pyzed/es/shading/nodes/noise-patterns/#onda) |
| **Formas** | [Círculo](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#círculo), [Rectángulo](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#rectángulo), [Anillo](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#anillo), [Segmento](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#segmento), [Polígono](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#polígono), [Estrella](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#estrella), [Combinar formas](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#combinar-formas), [Relleno](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#relleno), [Contorno](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#contorno), [Resplandor](https://albakore.github.io/pyzed/es/shading/nodes/shapes/#resplandor) |
| **Color** | [HSV a RGB](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#hsv-a-rgb), [RGB a HSV](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#rgb-a-hsv), [Desplazar tono](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#desplazar-tono), [Saturación](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#saturación), [Brillo y contraste](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#brillo-y-contraste), [Luminancia](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#luminancia), [Escala de grises](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#escala-de-grises), [Invertir](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#invertir), [Gamma](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#gamma), [Posterizar](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#posterizar), [Fusionar](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#fusionar), [Paleta](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#paleta), [Degradado](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#degradado), [RGBA](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#rgba), [Capa](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#capa) |
| **Efectos** | [Viñeta](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#viñeta), [Líneas de barrido](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#líneas-de-barrido), [Grano de película](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#grano-de-película) |
| **Textura** | [Muestrear textura](https://albakore.github.io/pyzed/es/shading/nodes/color-effects/#muestrear-textura) |
| **Lógica** | [Comparar](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#comparar), [Elegir](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#elegir), [Lógica](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#lógica-1) |
| **Variables** | [Guardar valor](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#guardar-valor), [Leer valor](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#leer-valor) |
| **Utilidades** | [Desvío](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#desvío), [Expresión](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#expresión), [Función shader](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#función-shader), [Comentario](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#comentario) |
| **Salida** | [Salida](https://albakore.github.io/pyzed/es/shading/nodes/logic-utility/#salida-1) |

**Prueba un nodo:**

Cada nodo se muestra tal como se ve en la vista Shader, con la vista previa de sus ajustes por defecto. Para jugar
con uno, añádelo desde la barra lateral Shading y conéctalo a la Salida, o pega su ejemplo en un archivo de Python
y ejecútalo.
