Is this possible? I would like my shader to know how far each vertex is from the camera, to adjust the strength of an effect. Passing the vec_dist (from entity to camera) to the shader could work for some situations, but doesn't seem as versatile especially for large objects. Any thoughts?
Re: Getting distance/Z-buffer data in vertex shader
[Re: MatAllum]
#443100 07/09/1411:0207/09/1411:02
After you multiply the InPos data with matWorldViewProj, the result (OutPos) will have the distance to the screen in its z-component (I think the w-component is some distance related information, too, maybe it is scaled (non-linearly) compared to z, I don't know).
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual