Shadows! :D

Everything related to the code /
Tout ce qui touche au code
Post Reply
Flashbang232
Posts: 155
Joined: Tue Aug 03, 2010 6:59 pm
Location: Behind LOIC

Shadows! :D

Post by Flashbang232 » Fri Aug 12, 2011 7:03 pm

I do not know if anything was updated while I was gone, but I have finally got my shadows right! :D
I think they are improved, I see no visual pixellation/blockiness on Anisotropic filering (set to 0 - no filtering) and it also runs fine, no lag. :)

3do_shadow.frag

Code: Select all

uniform sampler2DShadow shadowMap;
uniform sampler2D       tex0;
varying vec4            light_coord;
varying vec3            normal;

void main()
{
	float fog_coef = clamp( (gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0 );

    float shaded = shadow2D( shadowMap, light_coord.xyz ).x;
    vec2 test = abs(light_coord.xy - vec2(0.5, 0.5));
    if (test.x > 0.15 || test.y > 0.15)
        shaded = 1.1;

    float diffuse_coef = clamp( dot( normalize(normal), gl_LightSource[0].position.xyz ), 0.0, 1.0 );
    vec4 light_eq = diffuse_coef * shaded + gl_LightModel.ambient;
    vec4 texture_color = texture2D( tex0, gl_TexCoord[0].xy );

    gl_FragColor = vec4(light_eq.rgb, 1.0) * gl_Color * texture_color;
    gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_Fog.color.rgb, fog_coef);
}

3do_shadow.vert

Code: Select all

varying vec4 light_coord;
uniform mat4 light_Projection;
varying vec3 normal;

void main()
{
    gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
	gl_Position = ftransform();
	gl_FrontColor = gl_Color;
    light_coord = light_Projection * (gl_ModelViewMatrix * gl_Vertex);
    gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
	gl_FogFragCoord = gl_Position.z;
	normal = gl_NormalMatrix * gl_Normal;
}
So yeah, Idk exactly how the integer thing goes in this here line:

Code: Select all

if (test.x > 0.15 || test.y > 0.15)
In other words, I assumed a smaller number would be better, so I lessened it down from I believe .5 to .15 and so far ta3d is running good. Shadows look really nice for me B).

EDIT: Going to make an updated version, please stay tuned.....


Im also editing the particles with GIMP.
Pimpin' my ta3d install.
Reminds me of when I screwed up minecraft except that this isn't screwin' up. 8)
When you cannot trust your government to lead the nation to better times is when you know the ship is sinking

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Shadows! :D

Post by zuzuf » Mon Aug 15, 2011 10:09 pm

Can you post a screen shot :mrgreen: ?
=>;-D Penguin Powered

Flashbang232
Posts: 155
Joined: Tue Aug 03, 2010 6:59 pm
Location: Behind LOIC

Re: Shadows! :D

Post by Flashbang232 » Tue Aug 16, 2011 3:47 pm

I don't know the screenshot key. :P
Also, I just updated my version so i cannot. :P
They now look wierd with the new version, i edited the integer to be a ten thousandth of 1, maybe a bit too small ? :)

Thanks Zuzuf.

Also, just did a test, unit control is a bit whack. I selected all my peewees on The Desert Triad to move around a hill, they kept frozen until I clicked for the sixtieth time :P.
Unit queue is a BIT wierd, dont remember naming all my peewees to category "1" :O

SHADOWS :idea:

Particles look better. No more giant green circles :P

Whats up with the shading ? 0o
When you cannot trust your government to lead the nation to better times is when you know the ship is sinking

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Shadows! :D

Post by zuzuf » Tue Aug 16, 2011 9:11 pm

Use the console: "screenshot()" will do the job.
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Re: Shadows! :D

Post by Balthazar » Thu Aug 18, 2011 12:32 pm

Screenshot ))) screenshot ))) !!

Flashbang232
Posts: 155
Joined: Tue Aug 03, 2010 6:59 pm
Location: Behind LOIC

Re: Shadows! :D

Post by Flashbang232 » Sat Aug 20, 2011 6:49 pm

I do not know how, still a noob at handling ta3d.
Can I just upload the particle? I am still working on the shadows. 8)
oh well. Im uploading.

here you go.

http://www.fileswap.com/dl/l9wbz1/part.tga.html

it even has glowy outer layer and shine effect! look at it zoomed in!
If you use LCD look at it sideways :3
It turns purple.

Won't be able to bug fix some more ta3d until I get my mouse situation fixed, this damned touchpad is freaking on me so sorry if ther is any typos.
When you cannot trust your government to lead the nation to better times is when you know the ship is sinking

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests