Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Anti alias blit to render surface  (Read 10257 times)
mansie
Customers
Community Member
*****
Posts: 57


« on: August 15, 2007, 01:20:53 PM »

I realise that AntiAliasing with render surfaces doesn't happen... but could I render to the main buffer, and then blit the filtered scene to a rendersurface? (obviously, the main buffer is the same size as the rendersurface)

Most importantly - will it still blit properly if the rendersurface has been initialised with CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_A8R8G8B8? which I have had to do.

Ultimately - I'm trying to create a pixel array of the anti aliased mainbuffer with

            rendersurface.BltFromMainBuffer
 
            TextureFactory.LockTexture rendersurface.GetIndex(), True
            TextureFactory.GetPixelArray rendersurface.GetIndex(), 0, 0, 720, 576, array(0)
            TextureFactory.UnlockTexture rendersurface.GetIndex()

The array() should (in theory) contain the bit pattern of the main buffer - but it doesn't. If I render directly to the rendersurface it all works but without the anti aliasing. I suspect the texture format is messing things up -  Any suggestions?  Wink

Thanks as always chaps!
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #1 on: August 15, 2007, 01:27:12 PM »

I've used BltFromMainBuffer in my bloom sample to get an anti-aliased render. I think that's how most games do Bloom+FSAA too...

But your problem is probably that you should use GetTexture(), not GetIndex(). Smiley
Logged

Zarkow
Customers
Community Member
*****
Posts: 342


WWW
« Reply #2 on: August 15, 2007, 07:43:45 PM »

Zak>> I have been thinking about doing the same but am unsure of the speed-penalty in doing so - what is your experience?
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #3 on: August 15, 2007, 08:00:35 PM »

The only other choice when doing full-screen post shaders is to render the whole scene on a RenderSurface, then use that RS to do your shader work and output the result as a fullscreen quad. Then you lose FSAA and it makes the code structure a bit wierd...

I don't think framerate is an issue when blitting, though I haven't really compared. Anyway I assume all games use main buffer blitting for post shaders.
Logged

Zarkow
Customers
Community Member
*****
Posts: 342


WWW
« Reply #4 on: August 15, 2007, 08:19:43 PM »

One fast question then:

If I first render to the main buffer and blitt from it, then do the render on the rendersurface as needed for the multipass-render of the shader, I get error that I shouldn't render to render-surfaces inside the main render. So how do I temporarly exit the main render without performing a present or...something like that?
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #5 on: August 15, 2007, 08:30:01 PM »

What I do is work with the last frame. The main loop looks like this :

- Compute shaders using last-frame-rendersurface
- TV.Clear
- Render everything
- Blit to last-frame-rendersurface
- Draw shader output using a Draw_Texture
- TV.RenderToScreen

It may sound odd, but it's the only way I've found. The mouse/gamepad input appears slightly less responsive (one frame off), but all the draw calls are synched, i.e. the bloom isn't one frame late.
A sample of this in my bloom sample, it's on my blog and buried somewhere in Showcase.
Logged

Zarkow
Customers
Community Member
*****
Posts: 342


WWW
« Reply #6 on: August 15, 2007, 08:34:21 PM »

Ah, right, 1 frame-delay, roger. Was hoping there was a more immediate solution due to the chance of very low fps by some clients in the game...oh-well, guess I could always do it the other way to some extent: viewframe*AAsize will be the rendersurfaces size.
Logged
Zarkow
Customers
Community Member
*****
Posts: 342


WWW
« Reply #7 on: August 16, 2007, 07:06:53 PM »

Btw, has been informed that this isn't the normal behaivor under DX. Is this a limitation in TV3D?
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #8 on: August 16, 2007, 07:24:57 PM »

You're right, even in OpenGL with Frame Buffer Objects (ogl's render surfaces), I have no problem writing to a render surface in the middle of the main buffer render calls.
Probably something with TV3D's structure, though I'd like to have Sylvain's input on this.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks