|
GAME PROGRAMMING RESOURCES
<< BACK
|
|
|
PORTING YOUR PROJECTS FROM 3IMPACT v4 TO 3IMPACT v5
Version 5 of 3Impact Game Engine was completely rewritten from the ground up,
to support programmable .fx shaders, advanced bone-based animation management,
hi-quality rendering and many other features.
Still, we have done our best to support backward compatibility, with very good results!
Version 5 allows you to port your existing projects with little or zero changes.
The new version will install to a separate folder (Program Files/3impact5)
and it will not affect previous engine installations that can coexist.
One of the biggest changes is about skinned meshes.
They are now the main interface you should use to render your 3d models.
The iSkinMeshCreate() function will now work with both static and animated meshes
supporting multiple textures and materials.
Rendering is based on a custom .fx shader. Please see the example source code called
BallGameV5 for an example of static mesh rendered by using the default .fx shader.
Due to low-level technical issues however, not all old skinmesh functionality could be ported unchanged.
The following functions are no longer supported:
iSkinMeshAnimationCopy()
iSkinMeshBuffersShare()
iSkinMeshTexturesShare()
iSkinMeshAnimationKeysShare()
iSkinMeshSpecularSet()
iSkinMeshFogSet()
iSkinMeshLocalLightsEnable()
iSkinMeshEnvMapReceiverAdd()
iSkinMeshEnvMapBlendSet()
iSkinMeshAlphaSet()
iSkinMeshEnvMapGlassSet()
iSkinMeshShadowCasterCreate()
iSkinMeshShadowCasterCreateFromMemory()
iSkinMeshTextureChange()
Where possible, we have replaced the old functionality with something
similar or better, but old rendering features are no longer built-in for
skinmeshes and can only be achieved by .fx shader programming.
For example, you can now apply environment maps to a skinmesh only by writing a custom shader.
WRITING YOUR OWN .FX SHADERS
All visual effects, except those we ported from the previous version for backward compatibility,
must be made by using an HLSL based, programmable effect (.fx/.fxo) shaders now.
Because you can specify the .fx/.fxo effect file to use for a mesh in its
iSkinMeshCreate() function, you can make your own effect files for each
mesh.
The effect file can be provided in compiled form (.fxo), which allows you to protect your own work.
Note that the custom .fx shader must include code for both skinned and non skinned meshes.
For examples of code using this new functionality, please see the
demo projects named BallGameV5 and SkinnedRagdollShaders.
Effect shaders require some parameters (like transformation
matrices, textures and effect-specific factors) to be passed run-time.
To support this, we have added iSkinMeshEffectValueSet(),
iSkinMeshEffectTextureSet(), iSkinMeshEffectEnvTextureSet(), iSkinMeshEffectDefaultEnable().
Please see the API reference documentation for details.
By default, the engine passes the factors that are required by the default
.fx shader. By calling iSkinMeshEffectDefaultEnable() you can enable/disable
groups of factors, should you want to pass your own instead. However, the
default shader was designed to only perform common rendering, which is
usually kept when creating more complex shaders. It means that you usually
will not have to disable default shader factors, and simply add your own.
If you need a specific effect, the best is seeking for a similar effect
among the samples included to free shader programming tools like FXComposer and RenderMonkey.
Once you get the hang of the technique, making a custom .fx shader for 3Impact should be easy.
Please note that, to program custom .fx shaders, some knowledge of shader
programming is required. You can use tools like RenderMonkey and FX
Composer, but you will have to understand how the shader in these tools uses
the passed factors in order to successfully port the shader to 3Impact.
|
|