PDA

View Full Version : Register combiner code



McBain
03-09-2002, 07:00 AM
I'm in a situation where i have to combine 2 textures like this:
tex0 / 2 + tex1 / 2
rather than (tex0 + tex1) / 2 to avoid clamping
i do it like this:

!!RC1.0
{
rgb {
spare0 = tex0;
spare1 = tex1;
scale_by_one_half();
}
}
out.rgb = spare0 + spare1;

now i want to do the same with 4 textures
(tex0/2 + tex1/2) / 2 + (tex2/2 + tex3/2) / 2
(rather than (tex0/4 + tex1/4 + tex2/4 + tex3/4) or avoid precision/clamping issues

i cant figure out the rc code
can somone help me ?

ps: using blending to achieve the same is not an option

thnx in advance,
McBain

davepermen
03-09-2002, 07:36 AM
{
discard = tex0;
discard = tex1;
spare0 = sum();
scale_by_one_half()
}
as far as i know this works, the clamping is AFTER each combiner..

do this for the second two textures and a last time for combining spare0 and spare1

dunno but i guess its the same presision/quality as the way you do it, just faster..