# Shader: Difusión Simple

```glsl
uniform sampler2D initTex;
uniform sampler2D prevFrame;
uniform vec2 resolution;
uniform float K0; 
uniform float K1;
uniform float K2;
uniform float bbmix;
uniform float time;

IN vec2 texCoord; 


{{MODULES_HEAD}}

void main()
{
    vec2 pixel = texCoord;
    vec4 init = texture2D(initTex,texCoord);
    vec4 prev = texture2D(prevFrame,texCoord);
    
    vec2 dy = vec2(1.,-1.)*1./resolution.y;
    vec2 dx = vec2(1.,-1.)*1./resolution.x;
    
    vec4 N = texture2D(prevFrame, vec2(pixel.x, pixel.y + dy.y));
    vec4 S = texture2D(prevFrame, vec2(pixel.x, pixel.y + dy.x));
    vec4 E = texture2D(prevFrame, vec2(pixel.x + dx.x, pixel.y));
    vec4 W = texture2D(prevFrame, vec2(pixel.x + dx.y, pixel.y));
    
    vec4 NE = texture2D(prevFrame, vec2(pixel.x + dx.x, pixel.y + dy.x));
    vec4 NW = texture2D(prevFrame, vec2(pixel.x + dx.y, pixel.y + dy.x));
    vec4 SE = texture2D(prevFrame, vec2(pixel.x + dx.x, pixel.y + dy.y));
    vec4 SW = texture2D(prevFrame, vec2(pixel.x + dx.y, pixel.y + dy.y));
    
    
    // Lapalace 
    float lap = 0.0;
    lap += prev.r * K0;
    lap += N.r * K1;
    lap += S.r * K1;
    lap += E.r * K1;
    lap += W.r * K1;
    lap += NE.r * K2;
    lap += NW.r * K2;
    lap += SE.r * K2;
    lap += SW.r * K2;
  
    
    vec4 newColor ;
    newColor.r = prev.r+lap*0.045*texCoord.y;
    newColor.g = prev.g+lap*0.02;
    newColor.b = prev.b+lap*0.05;
    newColor.a = 1.0;
    
   
    outColor = mix( init , newColor, bbmix);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genesis-digital.solsarratea.world/clases/dia-2/shader-difusion-simple.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
