ok i will post the whole code here.

There are some pass, first it takes the ent texture and blurs it horizontal and vertical. Then it renderes that blur outpput to a render target that then will be merged on the buffer screen, so you can thee that the object has a glow blur coming out.

Will the render target work in A6?
THIS is the Glow shader. HSLS.

the tecnique part is not fully complete since i tested pass by pass.


// 3ds max effect file
// Glow Effect - updated to support 3ds max autoui.
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Note: This effect file works with EffectEdit.
//

// texture
texture entSkin1;

matrix matWorldViewProj;
matrix matWorld;
matrix matWorldView;
matrix matView;


// light direction (view space)
float3 LightDir : Direction = normalize(float3(0.0f, 0.0f, 1.0f));

// glow parameters
float4 GlowColor = {0.5f, 0.2f, 0.2f, 1.0f};

float4 GlowAmbient = {0.2f, 0.2f, 0.0f, 0.0f};
float GlowThickness= 0.015f;

struct VSTEXTURE_OUTPUT
{
float4 Position : POSITION;
float4 Diffuse : COLOR;
float2 TexCoord : TEXCOORD0;
};

// draws unskinned object with one texture and one directional light.
VSTEXTURE_OUTPUT VSTexture
(
float4 Position : POSITION,
float3 Normal : NORMAL,
float2 TexCoord : TEXCOORD0
)
{
VSTEXTURE_OUTPUT Out = (VSTEXTURE_OUTPUT)0;

float3 L = -LightDir; // light direction (view space)
float3 P = mul(Position, matWorldView); // position (view space)
float3 N = normalize(mul(Normal, (float3x3)matWorldView)); // normal (view space)

Out.Position = mul(float4(P, 1), matWorldViewProj); // projected position
Out.Diffuse = max(0, dot(N, L)); // diffuse
Out.TexCoord = TexCoord; // texture coordinates

return Out;
}

struct VSGLOW_OUTPUT
{
float4 Position : POSITION;
float4 Diffuse : COLOR;
};

// draws a transparent hull of the unskinned object.
VSGLOW_OUTPUT VSGlow
(
float4 Position : POSITION,
float3 Normal : NORMAL
)
{
VSGLOW_OUTPUT Out = (VSGLOW_OUTPUT)0;

float3 N = normalize(mul(Normal, (float3x3)matWorldView)); // normal (view space)
float3 P = mul(Position, matWorldView) + GlowThickness * N; // displaced position (view space)
float3 A = float3(0, 0, 1); // glow axis

float Power;

Power = dot(N, A);
Power *= Power;
Power -= 1;
Power *= Power; // Power = (1 - (N.A)^2)^2 [ = ((N.A)^2 - 1)^2 ]

Out.Position = mul(float4(P, 1), matWorldViewProj); // projected position
Out.Diffuse = GlowColor * Power + GlowAmbient; // modulated glow color + glow ambient

return Out;
}



technique TGlowOnly
{
pass PGlow
{
// glow shader
VertexShader = compile vs_1_1 VSGlow();
PixelShader = NULL;

// no texture
Texture[0] = NULL;

// enable alpha blending
AlphaBlendEnable = True;
zWriteEnable = true;
//SrcBlend = ONE;
//DestBlend = ONE;

// set up texture stage states to use the diffuse color
ColorOp[0] = SELECTARG2;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = SELECTARG2;
AlphaArg2[0] = DIFFUSE;

ColorOp[1] = DISABLE;
AlphaOp[1] = DISABLE;
}
}


Last edited by MMike; 05/28/08 15:16.