Howdy! I’m attempting to minimize the amount of data that’s sent to my fragment program. Essencially what I want to do is pass in the distance from a vertex to a light, and have it automaticially interpolate, rather than having to compute the distance per pixel.
Is it possible to do these custom varying vars? Or am I still going to have to do everything per fragment?
Note: jra101s’ above code will only give you the distance in each x,y and z direction per fragment. To get the absolute distance per fragment you will have to do someting like Length(dist); (in the fragment shader) to get the single float distance.