[Request] Drop Shadow Plus

Share your Construct 2 effect files

Post » Tue May 09, 2017 7:18 am

@Gigatron Nevermind! My Fault! I had my own shadow system when i no had shadows and was making this weird thing. NOw no weird thing around the player and the opacity works fine.

But i found a problem, and is that the shadow rotates with the player changing the point of the light. I mean if i set XY ofset of the shadow this have to be always the same no matter the player rotation, i will give you an example:

Image

Now, the shadow position rotates with the player, and the shadow always should be in an offset/angle of the light that appears in the second case that is always at offset X+1 and y+1. But now when player rotates the shadow also does :S .

Maybe i'm requesting an imposible, but can you make a "static shadow" in a offset no matter the player sprite rotation?(i guess will have to update every tick)

Using sprites for shadow i clone the player gfx, set tint to black and every tick set the postion to player X+1 and Y+1, so no matter the player sprite rotation the shadow will always appears in the same offset, X+1/Y+1.

Is possible do that in the shader?
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Tue May 09, 2017 7:32 am

@matriax
You can simply use switch case like javascript.
var left,right,up,down
if left x=.. y=..
if right x= .. y= ..
this is the best way , assign x,y for every player direction state...
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Tue May 09, 2017 7:38 am

@gigatron

I want to use the shader to have shadows without use events. Doing what you say i will have more events like if i do in my own way using sprites.

Also have in mind the player has 360 rotation and also using the mouse when you aim you can walk to left and the player looking to right, so i need a ways the shadow position is updated every tick to the offset i set on parameters so no matter any condition will appears in that values. I don't know if i explained well :P
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Tue May 09, 2017 8:41 pm

@matriax
I understand well... so when the player rotate don't forget vTex rotate too (logic) , this is the reason why the shadow rotate...
the only way for now is for this is checking the direction of player and adjust x or y offset ...
The other way is an fx for entire static layout...not rotating and the we can place Shadow light on the left for example
and all object placed on the right of light will have shadow at fixed position depending the light shadow... Shadow cast do this i think//

Regards

PS: i must explain Vtex fx and layout layer fx.
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Wed May 10, 2017 7:08 am

@Gigatron So, at the moment no way to have the shadows working correctly only using the shader(without events) right? :(
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Fri May 19, 2017 10:45 am

The shader works perfect if is added to the layer you want to cast shadow and will works with spritesheeting, rotations and will appear in the bottom of the sprites without overlaps due Z-Order. ( http://gigatron3k.free.fr/html5/C2/FX/dsp.rar)

So @Gigatron maybe start a topic releasing this .FX .

Last improvement in case is easy to do is add a parameter to blur. I tried make a blur for sprite or layer but also makes blur/glow the sprite, so a param inside the shader to get the blur for the shadow will be awesome.
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Fri May 19, 2017 9:43 pm

Is this ok for you ?

http://gigatron3k.free.fr/html5/C2/FX/dsp/

Rules : When for loop inside glsl main() ; so while loop is running you can not change parameters inside For Loop iteration on the fly;
This mean you can not change sample iteration on the fly; but manually before running shader;
To make a sort of blur i ve done many times iteration inside for loop;
txs += texture2D(samplerFront,uv-vec2(p1,p2)-ii/250.0,1.0); You can not change 250.0 value on the fly with uniform parameter;

PS : Again you made a donation for my work..Thank you very much @matriax
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Sat May 20, 2017 7:33 am

@Gigatron

I'm looking for a Gaussian blur to do things like this:
Image

If i understood well, are you saying is not possible change the blur param on C2 to adjust and only can be added in the .FX?, i mean, then how the Blur, GLow and things like that do it in the scirra shaders? Maybe for shadow do something out the Main to do the blur and then copy in the main the result i don't know XD.

So, if for some reason you can't achieve a blur like that to be edit by param then leave it, as i said the actual shadow fx works for the game i'm working.

-
PS: Thanks to you! you deserve it! my game is looking better every time you release a shader ;)
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Sat May 20, 2017 9:28 am

@matriax
I talked about values inside for loop in the demo above..

Would you like blur fx (another shader ?) .. or you would like blur for this shader ?
if i understand the circle above is shadow ?
English is very hard.... :)

Regards
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Sat May 20, 2017 10:12 am

Gigatron wrote:@matriax
I talked about values inside for loop in the demo above..

Would you like blur fx (another shader ?) .. or you would like blur for this shader ?
if i understand the circle above is shadow ?
English is very hard.... :)

Regards


Yes, blur for the shadow shader, actually with the shadow on the shader will works great on pixeled games like my actual one but for other style games, me or other people may need the shadow blured instead pixeled.

In your example you can see the "steps". The idea is made a gausian blur like my above picture even if is only 4 or 8 pixels but without visible steps like in the star to look soft. That will be great ;) .
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

PreviousNext

Return to Effects

Who is online

Users browsing this forum: No registered users and 1 guest