1 registered members (AndrewAMD),
959
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Tron effects :
[Re: MasterQ32]
#415594
01/20/13 22:08
01/20/13 22:08
|
Joined: Apr 2008
Posts: 2,488
ratchet
OP
Expert
|
OP
Expert
Joined: Apr 2008
Posts: 2,488
|
In fact i redone the level and tried all one time again and used your models. In fact the material file you've done must be place in the project folder also. Thanks for the material, i htink i'll find a use of it , even if it is some sort of self illuination ! But for that case i work on i really needed : REAL GLOW I mean GLOWING STUFF : like this one : example code
Last edited by ratchet; 01/20/13 22:08.
|
|
|
Re: Tron effects :
[Re: 3run]
#415596
01/20/13 22:23
01/20/13 22:23
|
Joined: Apr 2008
Posts: 2,488
ratchet
OP
Expert
|
OP
Expert
Joined: Apr 2008
Posts: 2,488
|
I think you mix self illumination and Glow efffect Glow is somewhat like some slef illumination + bloom effect. Anyway i have made a better example for your shader : YEs this is self illumination, perhaps adding some bloom on full scene i had some glow ??
|
|
|
Re: Tron effects :
[Re: ratchet]
#415597
01/20/13 22:34
01/20/13 22:34
|
Joined: Apr 2008
Posts: 2,488
ratchet
OP
Expert
|
OP
Expert
Joined: Apr 2008
Posts: 2,488
|
Well your illumination shader do some Glow if i add HDR to the scene : The problem it doesn't work on non illuminated 3D faces as you can see. Because it's just the HDR effect taking on illuminated parts, not a real bloom
Last edited by ratchet; 01/20/13 22:36.
|
|
|
Re: Tron effects :
[Re: txesmi]
#415631
01/21/13 13:25
01/21/13 13:25
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
double post, interesting info. Here is a quick working example:
#include <acknex.h>
#include <default.c>
VIEW *camGlow;
VIEW *camMix;
BMAP *bmpGlow;
BMAP *bmpCamera;
MATERIAL *mtlObject =
{
effect = "
float4x4 matWorldViewProj;
Texture entSkin1;
sampler entSkin1Sampler = sampler_state { Texture = <entSkin1>; MipFilter = Linear; };
void VS (
in float4 inPos : POSITION,
in float2 inTex : TEXCOORD0,
out float4 outPos : POSITION,
out float2 outTex : TEXCOORD0 )
{
outPos = mul ( inPos, matWorldViewProj );
outTex = inTex;
}
float4 PS ( in float2 inTex : TEXCOORD0 ): COLOR0
{
float4 Color = tex2D ( entSkin1Sampler, inTex );
Color.a = 1.0f;
return Color;
}
technique Solid
{
pass one
{
ZWriteEnable = true;
AlphaBlendEnable = true;
VertexShader = compile vs_2_0 VS ();
PixelShader = compile ps_2_0 PS ();
}
}
";
flags = PASS_SOLID;
}
MATERIAL *mtlGlow =
{
effect = "
float4x4 matWorldViewProj;
Texture entSkin1;
sampler entSkin1Sampler = sampler_state { Texture = <entSkin1>; MipFilter = Linear; };
void VS(
in float4 inPos : POSITION,
in float2 inTex : TEXCOORD0,
out float4 outPosition : POSITION,
out float2 outTex : TEXCOORD0 )
{
outPosition = mul ( inPos, matWorldViewProj );
outTex = inTex;
}
float4 PS ( in float2 inTex : TEXCOORD0 ): COLOR
{
float4 Color = tex2D ( entSkin1Sampler, inTex );
Color.rgb = lerp ( 0, Color.rgb, Color.a );
Color.a = 1;
return Color;
}
technique Glow
{
pass one
{
ZWriteEnable = true;
AlphaBlendEnable = false;
VertexShader = compile vs_2_0 VS ();
PixelShader = compile ps_2_0 PS ();
}
}
technique fallback { pass one { } }
";
}
MATERIAL *mtlMix =
{
effect = "
float4 vecViewPort;
float4 vecSkill1;
static const float fWeights[4] =
{
0.133333,
0.066666,
0.033333,
0.016666
};
Texture TargetMap;
Texture mtlSkin1;
sampler ColorSampler = sampler_state { Texture = <mtlSkin1>; MipFilter = Linear; };
sampler GlowSampler = sampler_state { Texture = <TargetMap>; MipFilter = Linear; AddressU=Clamp; AddressV=Clamp; };
float4 PS ( in float2 inTex : TEXCOORD0 ): COLOR
{
float2 Coord = inTex * vecSkill1.xy;
float4 Color = tex2D ( ColorSampler, Coord );
float3 Glow = 0.0f;
float2 vOffset = vecViewPort.zw * 2;
for ( int i=1; i<5; i++ )
{
float3 Glow2 = tex2D ( GlowSampler, Coord + vOffset * i ).rgb;
Glow2.rgb += tex2D ( GlowSampler, Coord - vOffset * i ).rgb;
vOffset.x = -vOffset.x;
Glow2.rgb += tex2D ( GlowSampler, Coord + vOffset * i ).rgb;
Glow2.rgb += tex2D ( GlowSampler, Coord - vOffset * i ).rgb;
vOffset.x = -vOffset.x;
Glow.rgb += Glow2.rgb * fWeights[i-1];
}
Color.rgb += Glow.rgb;
return Color;
}
technique Mix
{
pass one
{
AlphaBlendEnable = false;
VertexShader = null;
PixelShader = compile ps_2_0 PS ();
}
}
";
}
function main ()
{
wait(1);
level_load ( "" );
you = ent_create("techcont_5.mdl", vector(128, 0, -32), NULL);
you.material = mtlObject;
bmpCamera = bmap_createblack ( screen_size.x, screen_size.y, 24 );
bmpGlow = bmap_createblack ( screen_size.x*0.25, screen_size.y*0.25, 24 );
mtlMix.skill1 = floatv ( 0.25 );
mtlMix.skill2 = floatv ( 0.25 );
mtlMix.skin1 = bmpCamera;
camMix = view_create ( 1 );
camMix.material = mtlMix;
set ( camMix, PROCESS_TARGET );
camGlow = view_create ( 1 );
camGlow.bmap = bmpGlow;
camGlow.material = mtlGlow;
set ( camGlow, CHILD );
camera.bg = pixel_for_vec ( nullvector, 100, 8888 );
camera.bmap = bmpCamera;
camera.stage = camGlow;
camGlow.stage = camMix;
while ( !key_esc )
{
DEBUG_BMAP ( bmpCamera, 0, 0.125 );
DEBUG_BMAP ( bmpGlow, 130, 0.5 );
wait (1);
}
sys_exit ( NULL );
}
|
|
|
Re: Tron effects :
[Re: ratchet]
#415634
01/21/13 13:48
01/21/13 13:48
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
The problem it doesn't work on non illuminated 3D faces as you can see. Because it's just the HDR effect taking on illuminated parts, not a real bloom The "problem" is that the sunlight is adding even more brightness to the "glowing" parts which makes them bright enough to affect the bloom shader. If you want to I can create an object shader with all the stuff you need (also lighting / normalmapping). Let me know if you're interested.
Last edited by Kartoffel; 01/21/13 13:54.
POTATO-MAN saves the day! - Random
|
|
|
|