Blending across entire render-target

Started by
5 comments, last by Namethatnobodyelsetook 18 years, 8 months ago
-What should I do if I have two textures of size exactly as render target, and I want to blend them into the render target? Well, I could draw a (-1,-1)x(1,1) quad, but I guess this would not give me pixel-wise precission, would it? Hmm... maybe with NEAREST sampling I could simulate it, but I'm not sure if I won't need to tweak with half-pixel-wide texture cordinate bias a little. Anybody got an idea? Or... maybe there's a more direct way of doing this? (doubt that, but can't blame a guy for try) ~def
Advertisement
I'd use RHW coordinates to position the quad (0,0), (width, height), and set the uvs to the texel centers (0.5/width, 0.5/height) (1 + 0.5/width, 1 + 0.5/height). Should be perfect that way.
You can do 1 quad, and it would be pixel perfect. You can ensure this by doing a non-transformed quad.

ace
Quote:Original post by Namethatnobodyelsetook
I'd use RHW coordinates to position the quad (0,0), (width, height), and set the uvs to the texel centers (0.5/width, 0.5/height) (1 + 0.5/width, 1 + 0.5/height). Should be perfect that way.


Thanks.
Hem, I've had this feeling it should go somehow that way.

But shouldn't it be:
(0.5/width, 0.5/height) (1 - 0.5/width, 1 - 0.5/height)
?
~def
Nope. MS always specifies rects in a form where the last row isn't used, for example.

Rect.left = 0
Rect.right = 800
Rect.top = 0
Rect.bottom = 600

would defined an 800x600 rect (for window, D3D viewport, etc), not an 801x601 rect.
Well.. to be honest I didn't quite get the implications of that ;/

Could you elaborate on an example?
This picture should represent vieport pixels. Which of the color rectangles may represent my quad coordinates?
viewport
And how about texture coordinates? Should they be similar (only scaled)?

Thanks.
~def
I guess green represents both quad coords, and texels.

If your quad is to cover an 800x600 screen, your non (0,0) coords would be (800,600), even though the last pixel is 799,599. Same thing with texel coords. Since DX won't actually draw on column 800, or row 600, it won't actually sample these out-of-bounds UV coordinates either. I know it looks odd specifying a UV higher than 1 when you don't want wrapping, but that's how it works out.

This topic is closed to new replies.

Advertisement