• Create Account

## Deferred Shading + Anisotropic Spec?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1lpcstr  Members

Posted 29 April 2013 - 07:13 PM

I was thinking about the feasibility of using a flexible anisotropic specular as the primary BRDF in a deferred shading setup. You'd obviously have to store two roughness parameters in the gbuffer instead of one. My question is, wouldn't you also have to store the tangent and bitangent vectors, since those are needed by the BRDF? That would require a lot of space in the gbuffer.

Edited by lpcstr, 29 April 2013 - 07:17 PM.

### #2Bacterius  Members

Posted 29 April 2013 - 07:19 PM

I was thinking about the feasibility of using a flexible anisotropic specular as the primary BRDF in a deferred shading setup. You'd obviously have to store two roughness parameters in the gbuffer instead of one. My question is, wouldn't you also have to store the tangent and bitangent vectors, since those are needed by the BRDF? That would require a lot of space in the gbuffer.

Note you can calculate any one of the bitangent, tangent and normal vectors with the other two via a cross product.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

### #3Hodgman  Moderators

Posted 29 April 2013 - 09:53 PM

I'm experimenting with this at the moment, and my configuration is to store the normal and tangent in 16-bits each (using schemes from this page), two roughness parameters in 8 bits each, and the sign of the binormal (whether it's cross(N,T) or -cross(N,T)) in one bit.

This requires 49 bits of G-buffer space, rather than 24 bits for isotropic specular...

I also tried storing the T/B/N basis as a quaternion, but to get decent quality I needed to use 16-bits for each of the 4 components. I was able to drop one component and reconstruct it (due to quaternion rotations being normalized), bringing it down to 16-bits * 3, but this was still way more space and conversion math than the above configuration.

Crytek mention in one of their presentations (forget which one, sorry) that they faked anisotropic specular by simply adjusting the normal when writing to the g-buffer.

Edited by Hodgman, 29 April 2013 - 09:59 PM.

### #4MJP  Moderators

Posted 29 April 2013 - 09:53 PM

I was thinking about the feasibility of using a flexible anisotropic specular as the primary BRDF in a deferred shading setup. You'd obviously have to store two roughness parameters in the gbuffer instead of one. My question is, wouldn't you also have to store the tangent and bitangent vectors, since those are needed by the BRDF? That would require a lot of space in the gbuffer.

Yes, you need the full tangent frame. One possible option is to to store the entire tangent frame as a quaternion, however you can run into trouble with this if you need to blend into your G-Buffer normals (like you would with decals, for instance).

### #5zeGouky  Members

Posted 30 April 2013 - 07:07 AM