Mixed render target use (multiple and not)

I’m new to the use of multiple render targets, so I’m still a little uncertain about how they work. According to my reading, it’s effectively as simple as outputting a struct of float4s instead of a single float4. So far so good. My concern now becomes, if I’m rendering several models to multiple targets, but wish to interject some object-specific additional details along the way, how does that play into the multiple targets? For example, let’s say most objects produce their diffuse, depth, and light map outputs, but for some particular object (think polymorphism), I wanted to add some extra geometry onto just the light map? Is there a way to specify just the one as the target temporarily? It seems like it would be a decidedly bad idea to literally SetRenderTarget, as that would slow considerably, and likely clear its contents too.

I think a may have found a solution; haven’t tried it yet, and don’t know it it’s the solution.

Apparently there is an “IndependentBlendEnable” property, and an array of TargetBlendStates in the BlendState class. I could set that in between draws, and thereby turn off writing for all other render targets. Is that the correct way of going about it?

Unfortunately, it seems that independent blend states per target are not supported in the most recent official build, which is over a year out of date. This is acknowledged in the git updates, and has supposedly been implemented since. I tried downloading development version 3.8.7034 (I think it was), but it doesn’t seem to work in that, either. I tried building the code, but one of the third party dependencies has been taken down on account of DMCA.

Any further suggestions or insight?

Is this for a mobile app? Having a couple of render target changes every frame is no problem on PC. If you have multiple objects that just output to the lightmap, you definitely want to set the lightmap render target only once, and then render all objects in one go.

To preserve your render target contents, you can create the render target with RenderTargetUsage.PreserveContents, or, set a new render target and copy the existing lightmap to it.

From what I’ve read, PreseveContents is at severe risk for slowing things down, depending on the platform or hardware (not sure which), so I dismissed that as an option. The solution that I found, which is rather cumbersome, is to put in every shader techniques that will output only to each of the different render targets, should I need to alter just one of the four.