<p>If you are ok with specular being only white, you could put diffuse and specular into RGBA.</p>

<p>It looks like that is what unity does for it's deferred rendering.</p>

<p>Someone discovering this issue:
<a href="http://forum.unity3d.com/threads/specular-color-based-on-light-color.134412/" rel="nofollow">http://forum.unity3d.com/threads/specular-color-based-on-light-color.134412/</a></p>

<p>The docs mentioning it:
<a href="https://docs.unity3d.com/Manual/RenderTech-DeferredLighting.html" rel="nofollow">https://docs.unity3d.com/Manual/RenderTech-DeferredLighting.html</a></p>

CC BY-SA 3.0
2016-09-20T17:15:14.033Z
thanks, still both Diffuse and Specular should be colored
Unreal_Skif
CC BY-SA 3.0
2016-09-20T16:42:47.833Z
2016-09-20T16:42:47.833Z
Alan Wolfe
<p>You might want to look at <a href="http://www.pmavridis.com/research/fbcompression/">The Compact YCoCg Framebuffer</a>. It uses a 2-channel buffer to store luminance for every pixel and the two chroma components in half the pixels each, forming a checkerboard. It also uses an edge-aware upsampling filter at the end of the frame to reconstruct the missing chroma components and convert back to RGB.</p>

<p>You could extend this to a single 3-channel buffer to store the diffuse luminance, specular luminance, and checkerboarded chroma (assuming based on the diagram in your question that it suffices to store just one pair of chroma values).</p>

<p>You might also consider using R10G10B10A2 format instead, unless you <em>really</em> need the range of the floating-point format. It's the same amount of bandwidth but will give you a good deal more precision (R11G11B10F only gives you 5–6 bits of mantissa per component). Plus, you can use the 2 bits of alpha to store a couple of flags, such as your diffuse/specular flag.</p>

CC BY-SA 3.0
2016-09-18T18:55:50.977Z
2016-09-18T18:55:50.977Z
Nathan Reed
<p>We are trying to optimize Lighting in fillrate. Integrated graphics chips are very slow in memory access.</p>

<p>There are two Light Buffers: one for Diffuse and one for Specular. Both use format R11G11B10F. Is there any way to pack two buffers into one? For instance, using color model Y'CbCr:<a href="https://i.sstatic.net/kUIZU.png" rel="noreferrer"><img src="https://i.sstatic.net/kUIZU.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2016-09-26T14:50:33.917Z
This is for deferred lighting pipeline, right? Are you using tiled implementation to reduce bandwidth? Also, have you considered tiled deferred shading or tiled forward shading instead?
JarkkoL
<shader><color><optimisation>
Encode two R11G11B10F buffers into one using Y'CbCr?
Unreal_Skif
# Encode two R11G11B10F buffers into one using Y'CbCr?

(Asked by: username_0 on 2016-09-18)

We are trying to optimize Lighting in fillrate. Integrated graphics chips are very slow in memory access.

There are two Light Buffers: one for Diffuse and one for Specular. Both use format R11G11B10F. Is there any way to pack two buffers into one? For instance, using color model Y'CbCr:[![enter image description here](https://i.sstatic.net/kUIZU.png)](https://i.sstatic.net/kUIZU.png)

**Tags:** shader, color, optimisation

> **Comments:**
> **username_1**: This is for deferred lighting pipeline, right? Are you using tiled implementation to reduce bandwidth? Also, have you considered tiled deferred shading or tiled forward shading instead?  

---

## 2 answers

### Answer by username_3 on 2016-09-18. Score: 5 | Accepted answer

You might want to look at [The Compact YCoCg Framebuffer](http://www.pmavridis.com/research/fbcompression/). It uses a 2-channel buffer to store luminance for every pixel and the two chroma components in half the pixels each, forming a checkerboard. It also uses an edge-aware upsampling filter at the end of the frame to reconstruct the missing chroma components and convert back to RGB.

You could extend this to a single 3-channel buffer to store the diffuse luminance, specular luminance, and checkerboarded chroma (assuming based on the diagram in your question that it suffices to store just one pair of chroma values).

You might also consider using R10G10B10A2 format instead, unless you *really* need the range of the floating-point format. It's the same amount of bandwidth but will give you a good deal more precision (R11G11B10F only gives you 5–6 bits of mantissa per component). Plus, you can use the 2 bits of alpha to store a couple of flags, such as your diffuse/specular flag.


---

### Answer by username_2 on 2016-09-20. Score: 2

If you are ok with specular being only white, you could put diffuse and specular into RGBA.

It looks like that is what unity does for it's deferred rendering.

Someone discovering this issue:
<http://forum.unity3d.com/threads/specular-color-based-on-light-color.134412/>

The docs mentioning it:
<https://docs.unity3d.com/Manual/RenderTech-DeferredLighting.html>

> **Comments:**
> **username_0**: thanks, still both Diffuse and Specular should be colored  

---

