Jump to content
  • Advertisement
Sign in to follow this  
deffer

Blending across entire render-target

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

-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

Share this post


Link to post
Share on other sites
Advertisement
You can do 1 quad, and it would be pixel perfect. You can ensure this by doing a non-transformed quad.

ace

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!