LDV Posted April 9, 2004 Posted April 9, 2004 Hi Guys, Any ideas how to create a full screen fadein / fadeout in Managed DirectX3d? Thanks. Quote
DrunkenHyena Posted April 12, 2004 Posted April 12, 2004 use gamma correction No! The Gamma functions are very poorly supported in drivers. Just use a quad. It's very fast and efficient. You can also do much cooler effects than you can with Gamma. And it works on anything. Quote
LDV Posted April 12, 2004 Author Posted April 12, 2004 Hey, Thank you all guys... as i understood correctly.. I'm building a black full screen texture and paste it over the current screen playing with it's alpha value. I haven't tried it yet - but it should work. Thanks. Quote
DrunkenHyena Posted April 12, 2004 Posted April 12, 2004 You can save memory by skipping the texture. Just use a quad (2 triangles) and set their diffuse colour to black. Fiddle with the alpha and you're set. Quote
LDV Posted April 13, 2004 Author Posted April 13, 2004 You can save memory by skipping the texture. Just use a quad (2 triangles) and set their diffuse colour to black. Fiddle with the alpha and you're set. Pardon me for asking, but how do i do that. I mean creating the traingles. Untill now i used only Textures and Surfaces with the Sprite class or UpdateSurface. :-\ I have the Device3D, and i have the back buffer surface. Thanks, LDV. Quote
Kavan Posted April 13, 2004 Posted April 13, 2004 Create a VertexBuffer, an array of vertices. Fill the vertices with data and set data to the VertexBuffer. Check the documentation. Although it's scarce I think there's a howto about this. Quote
LDV Posted April 20, 2004 Author Posted April 20, 2004 More problems ... Ok, Guys, Thanks i did it. But there is still a problem. If i draw somethings uding .UpdateSurface or .StrechRectangle the quad shows transpernet on them. - that's OK. But if i draw something using the Sprite object (Yes - with Alpha flags) it draw over the Quad, and i can not see the transpernt quad. Maybe it's something for the order i do the: m_sprite.Begin(SpriteFlags.AlphaBlend);?? Or maybe it's something using the .Z property?? Here is some code: The Vertex: m_device.RenderState.CullMode = Cull.None; m_device.VertexFormat = CustomVertex.PositionColored.Format; m_vertexFade = new VertexBuffer(typeof(CustomVertex.PositionColored), 6, m_device, 0, CustomVertex.PositionColored.Format, Pool.Default); CustomVertex.PositionColored[] fverts = (CustomVertex.PositionColored[]) m_vertexFade.Lock(0, 0); fverts[0] = new CustomVertex.PositionColored(0, 0, 1, m_clrFade.ToArgb()); fverts[1] = new CustomVertex.PositionColored(0, 768, 1, m_clrFade.ToArgb()); fverts[2] = new CustomVertex.PositionColored(1024, 768, 1, m_clrFade.ToArgb()); fverts[3] = new CustomVertex.PositionColored(0, 0, 1, m_clrFade.ToArgb()); fverts[4] = new CustomVertex.PositionColored(1024, 0, 1, m_clrFade.ToArgb()); fverts[5] = new CustomVertex.PositionColored(1024, 768, 1, m_clrFade.ToArgb()); m_vertexFade.Unlock(); The drawing of the obeject with Sprite object: sprite.Draw(m_texture, m_rect[num], new Vector3(0, 0, 0), new Vector3(x, y, 0.5F), Color.FromArgb(255, 255, 255, 255)); Thank you all in advance, LDV Quote
DrunkenHyena Posted April 20, 2004 Posted April 20, 2004 Try : 1)Setting the Z to 0 2)make sure you draw the Quad as the last thing. Quote
LDV Posted April 21, 2004 Author Posted April 21, 2004 First, DrunkenHyana i want to thank you for your truely help. I tried to set them all Z to 0, and i checked i draw the Preimitve after i draw the Sprite and it didn't help. I found another thing that was the problem. I called Sprite.Flush() before i draw the primetives - that made it almost ok. There are two new problems now: 1. Somehow i don't get the full fae out now, i set it all to Alpha-255,RGB 0,0,0 and still it looks darker but now totally black - before - it was all black, except for the Sprite object ofcousre. 2. The program is much slower now. Thanks, LDV Quote
DrunkenHyena Posted April 21, 2004 Posted April 21, 2004 You should be doing something like this: device.BeginScene() sprite.begin() //Draw all sprites here sprite.end() //Draw quad here device.endscene() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.