Hi
I have often heard talks of running a potential field through the gpu.
Influence Map,
Potential Fields
Considering most of what is going on is very much image processing (blurring and splatting) I considered doing this through unity’s shaders as the texture processing would be much faster than doing a 2d for loop.
I found out how to combine texture Here
but I do not know how to save that modified data as a separate texture.
Shader "Examples/2 Alpha Blended Textures" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
}
SubShader {
Pass {
// Apply base texture
SetTexture [_MainTex] {
combine texture
}
// Blend in the alpha texture using the lerp operator
SetTexture [_BlendTex] {
combine texture lerp (texture) previous
}
}
}
}
I need to be able to manually control the update frequency.
Also I do not want to do a simple lerp, in some cases I want the maximum value at that pixel to be selected as the new pixel value.
I have looked at the compiled shader to see if there is any access to the combination function but it is exactly the same as the base (shader lab) code
I dont usually mess with shaders, so I would like to learn the bare minimum for this working. Or a nudge in the general direction.