Hi,
I'm having a bit of trouble getting my head around how interpolation works in HLSL when sending values from the vertex shader to the pixel shader. I've attached a shader I'm working with at the moment for rendering a water plane:
[attachment=24796:water_shader_snippet.txt]
So I understand that HLSL will interpolate everything I've put in the vertex shader across the face of the current triangle when it is sent to the pixel shader, so I was wondering, could I move some of my other calculations across into the vertex shader? For example, my 'attenuation' calculation uses LightDirTS as a variable - would it still get interpolated properly if I move it over into the vertex shader and passed it in? Same with 'projTexCoord'.
Likewise I understand that things like 'reflectionVector' and 'specularLightingFactor' can't be in the VS because they are calculated using texture values (which are sampled per-pixel).
Can anyone help me understand exactly what should and shouldn't be in the vertex shader?
Thanks :)