Is it possible to render into a texture atlas?
I've been wondering how to reduce the number of textures required for shadow-mapping, and came across a blog post here about rendering up to sixteen shadow maps into one texture-atlas.
According to the blog post mentioned above, these are the steps required:
1. The first step is writing to the texture; bind it to the framebuffer and set the viewport to render into the texture sub-region.
2. When accessing the sub-region, scale/bias the texture coordinates as follows: scale = region size / texture size, bias = region offset / texture size.
I understand this, but I'm not sure how to alter the viewport specifically to allow me to render into a certain square of the texture. I've found plenty of information about reading from it (up-sampling and down-sampling) but I don't know how I'd manipulate the viewport specifically to render into a small square region of the screen, and how I'd do this with a texture smaller than the back-buffer.
I'm using XNA and HLSL at the moment because it's simpler than SharpDX, and there's no point in messing around with that until I've got the theory working 100%.
Thanks for your help.