   [DirectX 10] Multiple render targets
  I'm trying to implement Light Pre-Pass (http://diaryofagraphicsprogrammer.blogspot.com/2008/03/light-pre-pass-renderer.html)and I've to use multiple render targets. I already created and set the render targets, but my shader code doesnt compile; I'm using Color0 and Color1 but looks like Shader Model 4.0 doesnt use it, so how do I render to multiple render targets in DirectX 10.This is my shader:cbuffer cbPerObject{float4x4 gWorld;float4x4 gWVP; };Texture2D gSpecMap;Texture2D gNormalMap;SamplerState gTriLinearSam{Filter = MIN_MAG_MIP_LINEAR;AddressU = Wrap;    AddressV = Wrap;};struct VS_IN{float3 posL: POSITION;float3 tangentL : TANGENT;float3 normalL  : NORMAL;float2 texC: TEXCOORD;};struct VS_OUT{float4 posH: SV_POSITION;float3 tangentW : TEXCOORD0;   float3 normalW  : TEXCOORD1;   float2 texC: TEXCOORD2;float2 depth    : TEXCOORD3;};struct PS_OUT{float4 normal : COLOR0;float4 depth  : COLOR1;};VS_OUT VS(VS_IN vIn){VS_OUT vOut;vOut.tangentW = mul(float4(vIn.tangentL, 0.0f), gWorld);vOut.normalW = mul(float4(vIn.normalL, 0.0f), gWorld);// Transform to homogeneous clip space.vOut.posH = mul(float4(vIn.posL, 1.0f), gWVP);// Output vertex attributes for interpolation across triangle.vOut.texC  = float4(vIn.texC, 0.0f, 1.0f);vOut.depth.x = vOut.posH.z;vOut.depth.y = vOut.posH.w;return vOut;}PS_OUT PS(VS_OUT pIn){PS_OUT pOut;float4 spec    = gSpecMap.Sample( gTriLinearSam, pIn.texC );float3 normalT = gNormalMap.Sample( gTriLinearSam, pIn.texC );// Map [0,1] --> [0,256]spec.a *= 256.0f;float specPower  = max(spec.a, 10.0f);normalT = 2.0f*normalT - 1.0f;// build orthonormal basisfloat3 N = normalize(pIn.normalW);float3 T = normalize(pIn.tangentW - dot(pIn.tangentW, N)*N);float3 B = cross(N,T);float3x3 TBN = float3x3(T, B, N);float3 bumpedNormalW = normalize(mul(normalT, TBN));  pOut.normal.rgb = 0.5f * (normalize(bumpedNormalW) + 1.0f);pOut.normal.a = specPower;pOut.depth = pIn.depth.x / pIn.depth.y;return pOut;}technique10 GBufferTech{    pass P0    {   SetVertexShader( CompileShader( vs_4_0, VS() ) );   SetGeometryShader( NULL );   SetPixelShader( CompileShader( ps_4_0, PS() ) );    }}
  SV_Target0,SV_Target1,... instead of COLORn   ;Quote:Original post by n3XusSV_Target0,SV_Target1,... instead of COLORnThanks lol;  By the way how can I for example render the normals render target?   ;  You mean to see what's going on there? You'll have to draw a fullscreenquad (Like for PostProcessing) then.   ;  You also might want to get used to PIX.  When I was doing my own deferred shading, it was really nice to see step by step each call's result and view all of the render targets.   ;Quote:Original post by link3333You also might want to get used to PIX.  When I was doing my own deferred shading, it was really nice to see step by step each call's result and view all of the render targets.Thanks for the tip, I'm able to see the Normals Map in PIX :D   