|
Implementation NotesIn this page, we will describe the issues that we have encountered during the development of our program. We would like to thank everyone in XNA Creators Club Online forum who have helped us to solve some issues. The forum is very active and provide quick responses in all our questions.Developing in PC and Deploying in both PC and XBOX360 This is the dream that we have when we first encounter XNA. We develop the code in PC and deploy it in PC and XBOX360. However, we need to be aware of the differences between PC and XBOX360. PC supports more feature than XBOX360. The XNA documentation provides clearly which features are supported in XBOX360 and/or Windows. The most convenient way to develop in PC and deploy in both PC and XBOX360 is by creating a single solution with 2 projects, i.e. Windows game project and XBOX 360 game project. The only glitch is that every time we add a new file to the windows game project, we also need to add it to the XBOX 360 game project. This does not mean that we will have two different files, they will share the same files. Below is step-by-step guide to create single-solution-two-projects which is ready for deployment in PC and XBOX360:
XNA Animation Component Library XNA natively supports loading .X and .FBX models; however, there are little support to do skeletal animating/skinning. XNA Creators Club Online has released a sample on how to process and render a skinned character model using the XNA Framework Content Pipeline (link). We opt for simpler approach by using XNA Animation Component Library found in CodePlex. Coordinate System and Polygon Winding Order If we are using different kinds of Graphics API/Framework, we need to be careful with the coordinate system, polygon winding order and order of vector-matrix multiplication. OpenGL, DirectX and XNA use three different conventions regarding those matter. The table below summarizes the differences between them:
Render Target In order to store the shadow map and occluder information used to generate hard shadow/soft shadow, we wanted to use 32-bit Vector4 RenderTarget2D. However, it turns out that XBOX360 does not support 32-bit Vector4 RenderTarget2D, so we are forced to use 16-bit HalfVector4 RenderTarget2D, this results in some precision problems, thus lower shadow quality. JFA Cut off The implementation is based on the algorithm provided from the paper. We use 1+JFA to generate the penumbra map to get slightly better result. 1+JFA is known to be able to reduce the error of JFA. Since our texture has high resolution, 2048x2048, it will require 11 passes of JFA to fully propagate the occluder information. We do not perform full JFA, instead we use only 7 passes of JFA, specifically, the step lengths are 1, 32, 16, 8, 4, 2, 1. We have some artifact which is sudden cut-off of smooth transition of soft shadows. However, generally we get convincing enough soft shadows. Tree Rendering Our scene rendering consists of two parts:
Fog in XNA In Shader Model 3.0 and XBOX360, there is no dedicated fog hardware at all. So, it is entirely up to the developers to compute and apply whatever kind of fog that you like in the shader. There are two kinds of approach which may work:
|
||||||||||||||||||