Hi,
I have been doing a lot of shader work in unity3 beta, and am really enjoying it but some of the artists I have been working with are getting a bit annoyed. The reason is that in unity 3 (even with custom shaders) there is no way to output a specular color to the surface descriptor. The output structure only takes a specular power and a specular brightness (specular / gloss respectively).
I believe the reason for this is that the output structure is basically 3 half4’s and these go into the G-Buffer for deferred rendering.
struct SurfaceOutput {
half3 Albedo;
half3 Normal;
half3 Emission;
half Specular;
half Gloss;
half Alpha;
};
Because of G-Buffer not being fat enough there does not seem to be an easy way to get per pixel specular color into the final render output. And looking at the shaders that come with Unity3 it seems that per material specular color is kind of a hack at the moment (hard coded as float4 _SpecColor).
There are two ways that this could be fixed:
- Add an extra half4 channel added to the surface output structure. This could be a custom channel, that can be used in the lighting shader at the discretion of the shader programmer.
- Allow the emission channel to be used in this way for custom lighting, and provide a flag on the shader that tells unity internals to not perform the emissive pass when rending the material, then in the lighting passes the emissive value can be used by the custom lighting shader.
I can understand why you wouldn’t want to make the g-buffer fatter, but having a bit more customization on what the output channels are used for would be very nice ![]()