Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [AGK v2] Look what i have done! (dynamic light and blured shadow)

Author
Message
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Sep 2014 19:49 Edited at: 1st Oct 2014 18:13
Hey,

Since AppGameKit made so much progress and i have a bit more time now, i worked on my
Realtime 2D Shadow code.

I like to see others progress and what cool techniques they made with DBPro or AppGameKit, and now i want to contribute to it

Basicaly it is just my fixed version with working render to image,additive blending and a Blur shader added to the result.

Donwload
2DShadow.zip

The Blured one


Without Blur

Without the Blur shader and only one Light it runs with 500-800 fps for me.


And the Blur
Vertexshader

load it with loadshader and not with loadspriteshader

Pixelshader


So what do you say?

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 22nd Sep 2014 20:53
Looks great! Can't wait to try it
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 22nd Sep 2014 21:05
well done looks nice
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Sep 2014 21:07
Cool - I have something similar but far lower resolution in AGK1 - uses a memblock. One thing I did do though, is alter the UV coordinate, like took the vertex position and added the normal multiplied by the Y position - can't remember exactly how I did it but I use the alpha channel as well to signify light density/height. Anyway it extends the UV coordinate more at the bottom of a mesh - so rather than a 2D straight up and down colour map, it gives sloped lines on vertical surfaces - as if the light is coming from above. I'll upload a screenie later so you can see what I mean - but I think it would be pretty cool to see it work at a decent speed.

I am the one who knocks...
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 22nd Sep 2014 23:54
That looks pretty cool

fog
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 23rd Sep 2014 00:33
Nice effect.

You could modify your pixel shader to only blur "light" pixels that border the black background, That way the pixels that border the grey objects wont get blurred and the lights wont appear to bleed into solid objects.

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd Sep 2014 01:05 Edited at: 23rd Sep 2014 01:21
Thank you all for your kind words

@baxslash
It has become part of a bigger project(Counterstrice 2D like Zombieshooter) and the code is messi right now but when I refined it, im sure I post it sometime.
Actually i want to finish something with it, before i give the code away, you know

@Van B
I have several light codes, some of them use memblocks some of them use plugins from dbpro, but the fastest is the draw to image methot in AGKv2.
I wish someone shines in and shows me his lightshadow made by only a Shader.

@fog
One way could be to draw the "wall" objects over the light.
The other way i wish to do, is to make a shader that blurs the light more in the distance.
The problem is, that it is one huge render image right now, wich is layered and blended together for the other lights, and you don't have the objects in the image wich I pass to the shader.
So the shader don't know when to blur or not.

By the way you said objects ..that remembers me of the Shadow code for objects where you define the corners so you can have polygon "objects".
It sorts the corners by angle and takes the min and max corner for the shadow..
maybe I dig that out too.

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 1st Oct 2014 18:10 Edited at: 1st Oct 2014 18:17
I persuaded me to give it to you, because I probably will not work a long time on that project.

You can find the File in the first Post.

I hope, you guys will post your extension



Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-03-28 23:31:56
Your offset time is: 2024-03-28 23:31:56