Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to embed a effect file to XFile

1 view
Skip to first unread message

akira32.microsoft.public.directx

unread,
Dec 7, 2007, 3:31:39 AM12/7/07
to
I install the DirectX SDK November 2007.
There is a xFile called DwarfWithEffectInstance.x and its directory as
below:
Microsoft DirectX SDK (November 2007)\Samples\Media\Dwarf
\DwarfWithEffectInstance.x

When I double click the DwarfWithEffectInstance.x, I will see the
model with lighting (seem to be with effect file)
How do I export the XFile with effect file in 3ds max?
Can Panda plugin export the format of XFile embedded a effect file?

The part of the conetent of DwarfWithEffectInstance.x as below:

EffectInstance {
"reflect.fx";
EffectParamString {
"g_txScene";
"Weapons.dds";
}


The part of the conetent of reflect.fx as below:

void VertScene( float4 vPos : POSITION,
float3 vNormal : NORMAL,
float2 vTex0 : TEXCOORD0,
out float4 oPos : POSITION,
out float4 oDiffuse : COLOR0,
out float2 oTex0 : TEXCOORD0,
out float3 oViewPos : TEXCOORD1,
out float3 oViewNormal : TEXCOORD2,
out float3 oEnvTex : TEXCOORD3 )
{
// Transform the position from object space to homogeneous
projection space
float4x4 g_mWorldView= mul(g_mWorld, g_mView);
float4x4 g_mWorldViewProjection= mul(g_mWorldView, g_mProj);
float4 lightInView= mul( g_vLight, g_mView);

oPos = mul( vPos, g_mWorldViewProjection );
// oPos = mul( vPos, g_mWorldView );
// oPos = mul( oPos, g_mProj );

// Compute the view-space position
oViewPos = mul( vPos, g_mWorldView );

// Compute view-space normal
oViewNormal = normalize( mul( vNormal, (float3x3)g_mWorldView ) );

// Compute lighting
oDiffuse = float4( dot( oViewNormal, normalize( lightInView -
oViewPos ) ) * Diffuse.xyz, 1.0f);;

// Just copy the texture coordinate through
oTex0 = vTex0;

// Compute the texture coord for the environment map.
oEnvTex = 2 * dot( -oViewPos, oViewNormal ) * oViewNormal +
oViewPos;
oEnvTex = mul( oEnvTex, transpose((float3x3)g_mView) );
}

0 new messages