Answer Questions
cpurick Best coding practises with ContentManager and GraphicsDeviceManager ?
I hope someone can give me a decent explanation of this as it's something which I would of thought is pretty essential to writing anything in GSE but makes no mention of it in the documentation. I'm trying to understand the best way for any game elements to access the main games graphics and device, these need to be written in a way that I can give this routine to someone else and they work without the other person having to hard code aynthing in the code I give them. I believe there may of been a more obvious way to do this in beta 1 but I picked things up from beta 2 so some of the examples and documentation is referencing things which have since been taking out. My main confusion comes from the differences in the Windows Game and Spacew ...Show All
Wysek Radiosity Light Maps Generator
Hello, I wish to light my worlds (about 200k triangles) with light maps computed by a radiosity processor. However, radiosity calculation is incredibly slow for medium/large worlds and so acceleration technique are needed. Computing lightmap on the GPU is a way to speedup the process, but I haven't found any far decent tool on internet (I have tried FSRad, but run on CPU and can't handle so much triangles). Any suggestions Thanks. P.S.: XNA include tools like this You should probably send these questions directly to the developer. Hi, Lightsprint computes radiosity on both GPU and CPU, and has no problem with 200k triangles, however it is commercial. ...Show All
Kitz Drawing into the ZBuffer
I wish to "clear draw" a perimitive into the ZBuffer. What I mean is, I want to draw the geometry of a mesh or perimitive into the ZBuffer, where in each place a pixel should be drawen, the ZBuffer value in that place will be set to 1. How can I accomplish this Thanks. I didn't understand that you were speaking about rendering a mirror. Be carreful, nothing can not be shared between devices. The Z buffer and the texture you're speaking must belong to the same device. Anyway, it's possible to create a texture that can also be redered to (offscreen render target). You should create the texture wtih IDirect3DDevice9::CreateTexture and usage flag D3DUSAGE_RENDERTARGET. The Z buffer will be ...Show All
Muhammad Usman Khalid Getting the Device and Content Manager
Now that things have changed with the Device and the addition of the Content Manager I have no clue of the proper way to get access to these in my GameComponents... Right now I am passing them in as arguments, but this is getting kind of rediculous. Is there a more correct way to go about getting references to these objects I searched the help but all the examples use the Game class and thus have direct access to them. Thanks, John Just to clarify, ContentManager instances are very lightweight, so there is no problem with each component creating its own local ContentManager. For the graphics device, you can do what you did in Beta1. game.Services.GetService(typeof(IGraphicsDeviceService)). The content manager ...Show All
Lars Bratt Triangle strips Vs. ordered index buffers
Triangle strips are fast, but why exactly Is it because they never have a cache miss, or is it because the cards have some special optimization just for triangle strips (and fans) If I, instead of a triangle strip, have a vertex buffer and en ordered index buffer so that the indices mimics the order of a triangle strip, will this be just as fast as a strip .. or is there something else to it I have a mesh where a triangle strip can not easily be built, but I can however order the indices in such a way that each triangle reuses two vertices of the previous triangle. Each primitive only introduces a single new vertex (index). How would the performance be I could test this, but I would like to have a theoretical answer first and then make ...Show All
dbcuser Using Multiple Texture Coordinates with VertexFormats.Texture'n' C#
hi, i have the following vertex struct: //------------------------------------------------------ public struct Vertex { public static VertexFormats Format = VertexFormats.Position | VertexFormats.Normal | VertexFormats.Texture8; // public Vector3 position; public Vector3 normal; public Vector2 tex0; public Vector2 tex1; public Vector2 tex2; public Vector2 tex3; public Vector2 tex4; public Vector2 tex5; public Vector2 tex6; public Vector2 tex7; public Vector2 tex8; // public void SetPosition(Vector3 Position) { position = Position; } public void SetNormal(Vector3 Normal) { normal = Normal; } // public void SetTexCoords(Vector2 Tex0, Vector2 Tex1, Vector2 Tex2, Vector2 ...Show All
ziman DrawUserPrimitives in B2?
I've created a new project, and I've moved all my code over from B1 to B2 in the new project. It compiles, but it's not actually showing anything when run. Is there anything that lists what all the changes are from B1 to B2 I suspect my problems lie in that the DrawUserPrimitives has changed considerably, and the XNA docs now show an entirely different (and more complex it seeems) way of drawing 3D objects. An example of DrawUserPrimitives working in B2 would be great if possible, or should I just bite the bullet and change over to DrawPrimitives and IndexBuffer Sample effect pass: textureEffect.Parameters["WorldViewProj"].SetValue(cubeSRotate * playerRot * m_effect_b.View * m_effect_b.Projection); textureEffect.Begin();//Effec ...Show All
EntDev XNA Demos Released
Hi All, I've just started a new series of XNA demos on my website. So far I have 3 demos: XNA Per-Pixel Lighting Demo, XNA Normal Mapping Demo, and XNA Parallax Normal Mapping Demo. I haven't included any pre built executables with the demos, so you'll have to build them yourself from the source provided with each demo. The demos target the Windows platform, but should run with little or no modifications for the Xbox 360. I chose to only target Windows to reduce the complexity of the source code. The per-pixel lighting demo implements per-pixel Blinn-Phong lighting (including specular lighting). The normal mapping demo implements tangent-space normal mapping. The demo also shows you how to calculate the tangent space basis vectors ...Show All
code_junkie Radiosity Light Maps Generator
Hello, I wish to light my worlds (about 200k triangles) with light maps computed by a radiosity processor. However, radiosity calculation is incredibly slow for medium/large worlds and so acceleration technique are needed. Computing lightmap on the GPU is a way to speedup the process, but I haven't found any far decent tool on internet (I have tried FSRad, but run on CPU and can't handle so much triangles). Any suggestions Thanks. P.S.: XNA include tools like this Not real-time... I means classical precomputed lightmaps (offline), but... with a radiosity processor able to handle large worlds and fastttttt... in order to permit a fine tuning of lights... Can I use D3DX PRT library to do this ...Show All
arcliner Go to the next character
This sounds like a simple enough thing to do, but I can't seem to figure it out. Say you have a char 'a' and you want it to go to 'b' if you push right. How do you do that Gracias Take your pick: char next = ( char )(( int ) 'a' + 1); or char next = ( char )( 'a' + System. Convert .ToChar(1)); Good point, Molt. I noticed that there are a lot of gaps, so I'll add that in once I figure out what each character value is. The XGameLineInput would have been nice to know about before but since I already put in my own code, I'll just add to what I've got. If you're doing this to allow people ...Show All
TJ2007 Working with buffers in 2D
Hello all, I've been trying to figure out how the system with backbuffers work. In all examples I have found people are clearing the buffer before they draw something new. graphics.GraphicsDevice.Clear(Color.Black); ...draw some sprites... graphics.GraphicsDevice.Present(); I guess that when you enter the Draw method you are working with the backbuffer, so the clear() and the sprite draw() will affect the backbuffer. After that you call the Present() to draw the recently made backbuffer on the screen. My problem is that this is not how I would like to do it in my case. Everytime I enter the Draw() method I would only like to add some new things, and not clear anything. The easiest way to do this is to not have any backbuffer at all, but I ...Show All
zocmer SpriteBatch Vs Sprite : 0 - 1
I have created my own TiledLayer class, converting my old code. I have noticed that the new SpriteBatch class is more slow than old Sprite class. Someone Knows why I use 16 x 16 tile in a 640x480 screen. With new class the render is very slow, while with the old one I have also to reduce the animations' speed. The game is slow in windowed ad fullscreen mode. Ok, I'm using a great number of tile (1200 for each TiledLayer and I use 2 layer), but with the old sprite I don't have any problem. (Obviously I call 2400 times only the SpriteBatch.Draw). ector wrote: Have you guys checked your framerate Are you sure you aren't simply hitting the vertical syn ...Show All
Gideon Kane Translating an old Bitmap...
This actually sounds fairly easy to do but, I'm not exactly sure how I would do it in windows or XNA. The basic thing is this, I have these series of Bitmap's that are 24 bit based. No Alpha channel information. (Or at least no useful Alpha Channel info) But, for some of the files, the color 0xFF00FF was used as the 'transparency' color. I would like to translate this information somehow so that the color 0xFF00FF gets translated to 0x000000 but with full transparency. While leaving all other colors alone. I bet their's even some paint programs that can do this for me, but Lord if I now about them or what they call the feature. Any ideas Tony The default texture processors actually do color keying off ...Show All
NSWhite Defining vertices as screen coordinates.
Is there a way to define a vertex to use screen coordinates I know there is a way in DirectX to do this [source] // This one const DWORD D3DFVF_TLVERTEX = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1; [/source] But looking through the documentation, I can't seem to see a way to do this in XNA. Basically what I want to do is to be able to draw sprites but use shaders also. Yes, I have seen SpriteCache at http://www.codeplex.com/SpriteCache/ but it doesn't actually emulate SpriteBatch exactly like it should so I was wanting to create my own. Any help appreciated... thanks! Edit: Well the "// This one" is not lining up as I thought, I was refering to the D3DFVF_XYZRHW. I think you should ...Show All
dpuza Dependent Content Builds with Custom ContentProcessor
So I'm trying to understand how to customize the content pipeline by building my own content processor for a fictional filetype (.tlf). This filetype is merely a list of relative paths to textures separated by newlines. Unfortunately, the sample in the docs only shows how to make a custom processor for something with no dependencies. However, thanks to our good friend reflector, I came across the BuildContent api in the ContentProcessorContext class. According to the docs, it can be used to (for example) "replac e the original TGA file references with new references to the converted texture files". This seems like the perfect candidate ... however, I'm not really sure what to do with the returned ExternalReference object which ...Show All
