vendredi 27 mai 2011

As was expected, here's a video showing the material system of "rebirth engine" built in Arx Fatalis. The material is very simple (just diffuse). The decor is managed as a static object with about 70 different materials. I applied on every texture a B-Spline pixel filtering" for each mipmap. In addition, I enabled the anisotropy for minification. The result is rather encouraging.

Here an example of the rebirth engine shader system:

#include "../public/declare_effect.h"

BEGIN_DECLARE_SHADER

BEGIN_SHADER( DX8_Flat, true )
    DECLARE_SHADER_PARAM( DIFFUSE, "TEXTURE", "0" )
    DECLARE_SHADER_PARAM( NORMAL, "TEXTURE", "1" )
END_SHADER( DX8_Flat )

STATIC_SHADER( DX8_Flat )
    SHADER.Commit_RenderState( RS_FILLMODE, FILL_SOLID );

    const std::string& sDiffuseValue = GET_SHADER_VALUE("DIFFUSE");

    ITexture_* pTexture = ASSET_MANAGER.Get_TextureByName( sDiffuseValue );
    if( pTexture )
    {
        SHADER.BindTexture( 0, *pTexture );
    }
    SHADER.Commit_TextureStageState( 0, TSS_COLOROP, TOP_SELECTARG1, 0 );
    SHADER.Commit_TextureStageState( 0, TSS_COLORARG1, TA_TEXTURE, 0 );
    SHADER.Commit_TextureStageState( 0, TSS_ALPHAOP, TOP_DISABLE, 0 );

DYNAMIC_SHADER( DX8_Flat )

END_DECLARE_SHADER



Here a new video:

mardi 24 mai 2011

Material and Texture integration part #1

Sorry for not writing sooner. I'm currently finishing a prototype with Unity (a 2.5d platformer) and I am preparing a big move. I have almost completed the integration of simple materials in Arx Fatalis (like wireframe and diffuse material). I took the opportunity to review the material system in the "rebirth engine": I added macros to quickly make new shader and I improved the transfer of materials parameters of the game to the shader system. Hopefully I can post a video or at least screen-shots very quickly.