The ZBuffer - Managed DirectX resources
Search ZBuffer
Links


 

As promised here are some screen shots I took of Mitch's talk. They will give you a few more details of what code changes to expect in the beta 2.

Part 2 - Content Pipeline and Content Pipeline components

This shows how you add content to your XNA projects. Once you add the items into the project structure you can check out the properties. For most of them XNA will determine the type and set the correct importers and processors for you. The Asset Name property is how you will refer to it in your code and it needs to be unique. It defaults to the file name without the extension but you can change it.The result of the RenderTarget demo.

The 1st part of writing your own content pipeline component is to define an importer.

...then a Processor...

...This object represent the object in the Content Pipeline. My memories are a little vague on how this fits in but I think this is the actual object that the Content Pipeline knows about. In this case its a Pixel Shader (remember XNA only knows about effect files by default it can't load individual shaders).

The reader is what reads in the .XNB file from within your application.

The writer is what is run at compile time to write the XNB file. XNB files are simply serialized files containing your content.

Once you have your Content Pipeline Component compiled you add it into Visual Studio in project options.

This is the pixel shader Mitch used in his demo. It just 'wobbles' the y texture coordinate based on a time input.

Sorry for the bad image here, a fading drop down plus it was over the edge of the screen. However you can see sprite.psh (the pixel shader) has been added to the content and the properties has matched it to the new component.

Here Mitch loads the Shader in the LoadContent over load. This uses the same Load syntax as all the rest of the content pipeline. Then he sets the Pixel Shader after setting up the Sprite. Note there is a line missing here when he passes in the timer. Its a little cruder than handling effects.

And the results of the pixel shader affecting a sprite. Just to be clear this scene is created by adding 3 components to a game - FPS, Grid and Model Viewer. Then then scene is rendered as normal to the back buffer. Then the contents of the backbuffer are grabbed into a texture and that texture is drawn using the SpriteBatch API to a quad that fills the screen. As the Sprite is being drawn a custom pixel shader is used to post process the texture coordinates of the sprite. Pretty cool effect for a small amount of code (not including the Content Pipeline component which is a one off of course).

Updated 10/29/2006 10:01:00 PM by Zman