Dynamic shadows.. now possible?

Get help using Construct 2

Post » Thu Aug 30, 2012 5:45 pm

Hello ladies and gentlemen.

I come for a question that is really interesting to know if it is possible now or not. The Dynamic Shadows.

At least for me, the Dynamic Shadows make a game magic, for the horror games, or anything similar..

So I want to know if it is possible to create Dynamic Shadows, realtime shadows with WebGL Shaders.

It is?
B
17
S
4
G
4
Posts: 104
Reputation: 3,950

Post » Thu Aug 30, 2012 5:54 pm

Most likely if you wrote it yourself. With the supplied shaders I am not sure, but I tend to doubt it.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Aug 30, 2012 7:58 pm

They've been possible but there is no plugin to make it simple.

Here is a way to implement it using the canvas object to draw the shadows.
http://dl.dropbox.com/u/5426011/examples14/shadow_cast.capx
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Thu Aug 30, 2012 10:11 pm

I would love to see a plugin for that, like good old shadow caster in CC ;)
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Aug 31, 2012 5:44 am

@R0J0hound Thanks! I don't even seen that plugin, that's really awesome. Is exactly what I mean. I will se how it works really thanks!

@shinkan I don't have the required experience on writting in Javascript to write a plugin that does that :(
B
17
S
4
G
4
Posts: 104
Reputation: 3,950

Post » Fri Aug 31, 2012 7:27 am

@R0J0houndv Where can I get this "Canvas" plugin I seem to be missing when I run your capx?

I would..
Pin a black Shadow object to the caster object. and set its angle to the opposite of the light object, set its opacity based on distance(light.x,light.y,caster.x,caster.y) and use a blur plugin or shader. :P
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Fri Aug 31, 2012 8:00 am

Referring to this one?
- Diji
B
23
S
4
G
4
Posts: 54
Reputation: 3,996

Post » Fri Aug 31, 2012 11:32 am

The Canvas plugin makes it really easy for shadow casting. Thanks @R0J0hound. Can anyone attempt a distance blur shader? Where at a designated point the blur is none and then increases with distance from the designated point. That would make shadows look really good (attenuation I think). I want to attempt this when I have time and learn more about GLSL..
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Tue Sep 11, 2012 11:12 am

I found this video

[TUBE]http://www.youtube.com/watch?v=fsbECSpwtig&feature=related[/TUBE]

and here is a *.fx

[CODE]uniform vec2 lightpos;
uniform vec3 lightColor;
uniform float screenHeight;
uniform vec3 lightAttenuation;
uniform float radius;

uniform sampler2D texture;

void main()
{          
     vec2 pixel=gl_FragCoord.xy;          
     pixel.y=screenHeight-pixel.y;     
     vec2 aux=lightpos-pixel;
     float distance=length(aux);
     float attenuation=1.0/(lightAttenuation.x+lightAttenuation.y*distance+lightAttenuation.z*distance*distance);     
     vec4 color=vec4(attenuation,attenuation,attenuation,1.0)*vec4(lightColor,1.0);     
     gl_FragColor = color;//*texture2D(texture,gl_TexCoord[0].st);
}[/CODE]

maybe someone will find it useful and do something with that

Have fun :)
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Tue Sep 11, 2012 11:19 am

Awesome !
B
40
S
9
G
5
Posts: 127
Reputation: 6,609

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Braus, supreme676, Yahoo [Bot] and 8 guests