How to use FullFrameQuad?

rated by 0 users
This post has 5 Replies | 3 Followers

Top 10 Contributor
Posts 1,214
SunBurn_Community_Licensee
SunBurn_Contributor
SunBurn_Pro_Licensee
Philippe Da Silva Posted: 04-07-2010 12:33 PM

Hi,

Could anyone come up with a small Update/Draw sample code on how to use FullFrameQuad? I've been trying to use it for the whole afternoon with no success... and can't get any idea on what I'm doing wrong...

Just for some clarification: I'm simply creating a Fade In / Fade Out effect using Alpha blending but nothing is rendered on the screen...

Thanks

Philippe

Top 10 Contributor
Posts 4,854
Employee
SunBurn_Studio_Licensee

Hi Philippe,

The full-frame quad vertices are positioned to overlay the entire viewport, so a couple of things to check when rendering:

Make sure your vertex shader simply outputs the vertex position without transforming it.  Or if you're using a built-in effect like BasicEffect then make sure the World, View, and Projection transforms are all set to Identity.

Other unrelated gotchas that affect full-screen rendering:

  • Make sure depth testing is disabled
  • Make sure alpha blending and testing is disabled
  • Make sure cull mode is set to None
  • Make sure to use the Render() overload that accepts your effect, or to call Render() (without the effect argument) between calls to Begin / End on your effect and effect pass

Let me know if this helps!

 

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 10 Contributor
Posts 1,214
SunBurn_Community_Licensee
SunBurn_Contributor
SunBurn_Pro_Licensee

Yes it helped ;)

But for the FadeIn effect, I set the RenderState differently than what you suggested:

RenderState renderState = this.Application.GraphicsDeviceManager.GraphicsDevice.RenderState;
renderState.CullMode = CullMode.None;
renderState.AlphaBlendEnable = true;
renderState.SourceBlend = Blend.SourceAlpha;
renderState.DestinationBlend = Blend.InverseSourceAlpha;

And here is how I setup the BasicEffect if anyone is interested :p

__FadeShader = new BasicEffect(this.Application.GraphicsDeviceManager.GraphicsDevice, null);
__FadeShader.World = Matrix.Identity;
__FadeShader.View = Matrix.Identity;
 __FadeShader.Projection = Matrix.Identity;
__FadeShader.DiffuseColor = Color.Black.ToVector3();
__FadeShader.VertexColorEnabled = false;

Top 100 Contributor
Posts 31
SunBurn_Community_Licensee

hey Philippe, since you've solved this fade in/out functionality, i don't suppose you could share your code?  i was just about to start when i found this post.  thanks in advance.

Top 10 Contributor
Posts 1,214
SunBurn_Community_Licensee
SunBurn_Contributor
SunBurn_Pro_Licensee

Hi secluder,

I don't have source code ready at the minute because it worked on 1.3.2 and I would need to go through porting it to 2.0

That makes me think that this should be a feature of IGF for the next release ;)

Top 100 Contributor
Posts 31
SunBurn_Community_Licensee

understood.  having this built-in would be a really good addition.

thanks for the quick reply.

Page 1 of 1 (6 items) | RSS