This question is regarding deferred shading
I was looking for an alternative way (if any) of storing material properties (i.e specularity level, material type etc) from geometry pass to the light pass.
So far I store the kind of material (diffuse map, diffuse map with normal map etc) in the 4th component of the diffuse color, and it works great. But there are cases where I have to store properties per material (geometry Fragment glsl) that needs to interact with the light pass.
I Could add another texture to the g-buffer that simply stored properties, and that will work, but I have some concerns of added overhead, so i was looking for alternatives
There is usually a trade off of GPU processing verses the number of g-buffers. The easiest is to just add another g-buffer but you can pack multiple pieces on information in a single float field by using something like x + y * 100 + z * 1000 and then decompose at the other end. You can avoid float rounding problems by using an integer and using intBitsToFloat/floatBitsToInt.
Alright, thanks for the reply. I expected this was the only way to determine the property of a particular fragment in the light pass. I added another texture to be stored on the g-buffer, performance loss was minimal. (0.1 - 0.3 %)
Your point on using integers is a good idea, till now I used var > value due to rounding problems as you said.
I would not mind so much about performance in the beginning of the deferred shading and throw in as much g-buffers as you need. When your material-system is finished then you can try to pack and reduce the channels you need e.g. could you calculate some of the properties later in the shading-stage (bitangent out of normal and tangent). GPU Gems 2 has a chapter about deferred shading in STALKER (although most probably not anymore up-to-date) where it shows a short comparison of storage options.