Could someone please help me with a problem? How do you compute the distance of a ray starting from a position to hit an infinite plane. I need to fit it in a shader too, so it has to be minimal, and what would the best way to describe a plane inside a shader?

This is the function i use in my engine, to compute intersection point , you can easily substituite (sp??) the Vec3f with a float[3] and the plane with a float[4] , think the rest is clear If you want only the distance use this