Game Development Community

A different approach to rendering

by Ian Omroth Hardingham · in Torque 3D Professional · 09/29/2009 (12:21 pm) · 1 replies

Hey guys.

Ok, I have a pretty strange question. Bear with me while I try to explain it.

First, imagine a T3D level with nothing in it apart from a simple red DTS cube and a light. No skybox, no terrain, no nothing.

Now imagine the cube has translucency on and is semi-transparent.

Here's what appears to happen during the rendering of this scene:

1. The entire frame buffer starts out blank with a RGBA value of 0,0,0,0
2. The red cube is going to be rendered with a (simplified for arguments' sake) colour value of 1,0,0,0.5
3. The resultant pixel colour is 0.5,0,0,0.5. The reason is not because the background is "black" - it's not, it's colourless. The reason is that when painting against the background, T3D only takes into account the alpha value of the colour being painted, not that of the colour behind.

I need to change this so that pixels being drawn take into account the target colour as well as the paint colour. In this example, painting 1,0,0,0.5 onto 0,0,0,0 should result in 1,0,0,0.5.

I know this may sound crazy, but I do honestly need this functionality.

Any help or tips would be really appreciated,

Thanks,
Ian

#1
09/29/2009 (1:46 pm)
I think you can do that just by adjusting the blend-mode and maybe the clear color.

For example, I think in that particular example a blend mode of dstInvAlpha, dstAlph would give you 1,0,0,0.5