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 Studio Chat / [SOLVED] outline shader

Author
Message
ruckertheron
7
Years of Service
User Offline
Joined: 12th Nov 2016
Location:
Posted: 14th Jun 2020 20:48
I purchased the 3D shader kit and I'm thinking you can convert some of those to 2D??? Maybe alter the vertex shader somewhat?? I surprised I haven't seen an outline 2D shader on the forum yet that works with AppGameKit and after experimentation and a few GLSL classes, I don't know what I doing still because there is a gray area between AppGameKit and GLSL that I'm not making the connection about.. thoughts anyone?

The author of this post has marked a post as an answer.

Go to answer

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 14th Jun 2020 22:15 Edited at: 14th Jun 2020 22:30
I've only written one 2D shader (this one) but it was by converting a Unity Shader Graph YouTube tutorial.
There's one for an outline shader here, so if you don't get an answer soon, I might have a go at this tomorrow. It looks easy enough.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 15th Jun 2020 18:37 Edited at: 15th Jun 2020 18:44
There are two methods i know of which are working fine for a 2D outline effect.
Ther first one being basically cloning the texture scaling it up a bit and positioning it with a slight offset around the sprites center.
This method is used in the video Scraggle suggested, and does the job fine as long as the sprite isn't to complex or the outline being to thick.
Resulting in gaps between the "cloned" texture. one can counter this with more clones/samples, but it'll get slow and messy.
In the image below you can see the error for a too large outline.

(don't be confused about the Dropshadow title its the same method)

The other method is to color all nighbouring pixels as long as the alpha value isn't zero being fully transparent but ignoring the original sprite pixels.
I thinks this is the superior method but also gets slow as the outline size increases ofcourse.


But actually the first method is probably just fine most of the time.

Also one could convert the fullscreen Edgedetection shader to 2D using the derivative of neighbouring color shanges instead of the 3D Depth

Attachments

Login to view attachments
ruckertheron
7
Years of Service
User Offline
Joined: 12th Nov 2016
Location:
Posted: 2nd Mar 2021 19:11
I have been having problems with the 11.12.2020 build when it comes to implimenting Janbos AppGameKit Shader Pack. I will try to update later but I have been reluctant to do so as a last resort. I was creating a VR app and I figured the sync() and SP_Sync() wasn't playing nice. I took out the VR plug in and Im still having issues. I have included ".\..\Templates\ShaderPack\Includes\ShaderPack.agc" and SP_Init() before the main loop and SP_Sync() towards the end of the loop.. It says Have you forgot to copy or use setrawread or something like that.. I know encrypted files need the readraw function but I have used both and decrypted the files. It worked when I last used it
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 3rd Mar 2021 14:10
This post has been marked by the post author as the answer.
You need to copy the 'Shader' folder to your projects media folder.

Shader Pack\Templates\ShaderPack\Shader
ruckertheron
7
Years of Service
User Offline
Joined: 12th Nov 2016
Location:
Posted: 4th Mar 2021 02:56
Thanks part time I felt like your avatar!!!
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 7th Mar 2021 22:08
This is a pixelshader that might help, if not used in realtime:


Login to post a reply

Server time is: 2024-04-16 21:10:13
Your offset time is: 2024-04-16 21:10:13