A little help with vertex shaders
Posted: Thu Jan 02, 2014 2:12 am
I'm pretty inexperienced with shaders, and especially vertex shaders, but I've been fooling around with them trying to distort geometry (meshes now) based on the position of a light or camera. The meshes aren't distorting the way I expected them to, I've used the same formulas that are in the shader to create the effect I wanted using just love's newMesh function but it was a bit slow creating the new geometry every frame so I was hoping a vertex shader would be a more efficient approach.
I've looked through the forums a bit but haven't found to much information regarding vertex shaders, so I was hoping someone could point out what is causing the shader to perform differently than I expect. Additionally if there's a better way to do what I'm trying to do, I would also appreciate the insight.
This is what happens.

This is the desired effect.

Thank you in advance for any help you can provide, I hope I was clear in explaining my problem.
EDIT: Uploaded the working version of the shader, for those interested. I would still like to figure out a way to make it work with out using an if statment, but I'm pretty happy with it.
I've looked through the forums a bit but haven't found to much information regarding vertex shaders, so I was hoping someone could point out what is causing the shader to perform differently than I expect. Additionally if there's a better way to do what I'm trying to do, I would also appreciate the insight.
This is what happens.

This is the desired effect.

Thank you in advance for any help you can provide, I hope I was clear in explaining my problem.
EDIT: Uploaded the working version of the shader, for those interested. I would still like to figure out a way to make it work with out using an if statment, but I'm pretty happy with it.