Catalin 的个人资料Catalin 's Blog日志列表 工具 帮助

日志


8月31日

Mass Effect Release Date Announced!

The release date for my most anticipated game has just been announced. It's November 20 for U.S. and November 23 for Europe.

For those who don't know, Mass Effect is a Sci-Fi Roleplaying Game made by none other than BIOWARE, the company that gave us Baldur's Gate, Neverwinter Nights, Star Wars: KOTOR, and Jade Empire.

For more information about the game, go to the official page, where you can see some screenshots, or watch some videos.

Can't wait to get my hands on this one. 

8月25日

XNA Gamefest Videos Online!

The videos from the first day of Gamefest are online! Check them out here.

8月24日

Introduction to Vertex Textures

 

Ever since the appearance of programmable GPUs, there has been a significant difference between the capabilities of vertex and pixel shaders. Shader Model 3.0 took the first steps in providing common functionality between the two, and DirectX 10 took the final step and unified the Instruction Set between all types of shaders (Pixel, Vertex and the new Geometry Shaders). Since this is a XNA blog, and I didn't have the chance to experiment with DirectX10, I will focus on one feature of Shader Model 3.0 that builds towards this unification, which is Vertex Texture Fetch ( VTF ). This article will only be introductory, with little to no actual code. But a full tutorial will follow, covering several effects that can be achieved using VTF.

As you probably know by now, traditionally, Vertex Shaders deal with transforming the vertices, and manipulating or setting properties like position, color, normal, texture coordinates. After this, vertices define triangles, which are then transformed into pixels. At this step, Pixel Shaders come into play, and can be used for texturing, bump mapping, normal mapping, and lots of other effects we all love.

Vertex Texture Fetch allows us to read data from textures inside a Vertex Shader, just like Pixel Shaders do. Actually, not EXACTLY like Pixel Shaders do, there are some limitations, but I'll come back to that in a moment.

To use VTF, you will need either an Xbox 360 (which has an unified shader architecture), or a NVIDIA graphics card from the GeForce 6 series, or greater. For those owning ATI GPUs there is another technique called Render To Vertex Buffer (R2VB), which can be used to achieve similar results.

The assembler function used to read textures in a Vertex Shader is texldl. However, since I like HLSL more, and never wrote a shader in asm, I'll talk about the HLSL version. So, in HLSL, the most important instruction used for VTF is tex2Dlod.

The usage is tex2Dlod( s , t ), where s is a 2D texture sampler, and t is a 4 component vector. The instruction reads a texture, using an user-defined mipmap level. This mipmap level is specified through the 4th component of the texture coordinate vector ( t.w ).

Depending on the application you might get to use the mipmap level, or not. In most cases, I've used the default level 0, so a usual call took the form:

tex2Dlod( textureSampler, float4( uv, 0, 0) );

Different mipmap levels can be used when you intend to simulate water or terrain using VTF, but the levels have to be computed manually.

Vertex Textures behave like Pixel Textures except for the following restrictions:

    • Bilinear and Trilinear filtering are not supported directly in hardware. However, these can be implemented manually in the Vertex Shader
    • Anisotropic Filtering is not supported in hardware
    • Level of detail (mipmap level) is not available, and has to be computed manually

Implementing bilinear filtering in vertex textures is not too complicated, and most times, the performance hit will not be too high, since neighboring pixels are usually present in the cache. Other types of filtering (trilinear, bicubic) can also be implemented, but they need more texture fetches, and use several mipmaps levels, so the performance hit is much higher. I will cover bilinear filtering in one part of the tutorial that will come soon.

Keep in mind that a vertex texture fetch is not as fast as a pixel texture fetch, so using vertex textures carelessly can yield some serious performance hits. Some tips on improving performance when using VTF are:

    • Use dynamic branching in shaders to avoid vertex texture fetching when it may not be necessary.
    • When using VTF for displacement mapping, use grids of different granularities for things close to the viewer or far from the viewer (see geometry clipmaps)
    • do no use a Vertex Texture as a way to pass constants to the vertex shader, since VTF is much slower than reading constants

That concludes the introduction to vertex textures. The tutorial will continue, and show some examples of what can be done using vertex textures.

You can find a small sample that morphs terrain between two heightmaps, using vertex textures, here. It is for Windows, so you'll need a NVIDIA GeForce 6 series video card, or higher. Here is the Xbox 360 version, but I didn't get to test this before uploading it, since my Xbox is not available, at the moment.

Note: the downloads are .ccgame packages, so you'll need to have XNA GSE 1.0 Refresh installed.

I hope this was interesting enough. If you have any suggestions, or if there are any mistakes in my facts, please point them to me.

8月23日

First entry in my blog

Hi there!

I've been thinking for a while to get my own blog started, but I just didn't have the time. I begin today, with this post.

My name is Catalin Zima, and I am a student in Computer Science, at the Technical University of Cluj Napoca, Romania.

"What will this blog be about?"

Mainly, it will be about Microsoft's XNA Framework, XNA Game Studio, and game development, but from time to time, you will see posts about certain games or books that interest me most, like Mass Effect, or George R.R. Martin's "A Song of Ice and Fire".

"What? Another XNA blog?"

My intentions are not reinventing the wheel, nor saying what lots of others have said. Instead, I'll try to post about interesting techniques that I use in my games, or troubles I run into that others might run into themselves. My code may not always be of top-performance (unless it's a post on performance :) ), but it will try to illustrate ideas as clear as possible.

First, some resources for those that want to start XNA:

  • creators.xna.com is the official XNA Framework and XNA Game Studio page. There you'll find lots of resources, like tutorials, samples, starter kits, which will help you on your way to learn XNA. In the Partners section, they also have links to other companies supporting XNA, with products like the TorqueX engine, or XSI ModTool. Also, the forums there host a great, helpful community, where almost any question gets answered, many times by the guys working on XNA themselves ( All hail Shawn Hargreaves! ).
  • There are other XNA blogs, which have lots of interesting articles regarding performance, good practices, and common problems. You can find some of these on the right side of this page.
  • Some useful XNA sites are Ziggyware, XNA Resources, Riemers, XNA Tutorial. There are many others, which you can find on various Links sections of these ones.
  • Some XNA Games examples can be seen on the Dream Build Play competition page, and played on XNA Post or BigToeSoftware or GameProjects

That's about it, for now. My next entry (in a few days) will be a short introduction about a very cool feature of Shader Model 3.0, namely Vertex Texture Fetch, followed by a tutorial on several uses of VTF, sometime in the following weeks.

Suggestions? Comments?