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 Chat / APPGAMEKIT Shader Pack

Author
Message
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 13th Jul 2018 09:36
Just want to say the Shader Pack is great packed full of allot of Shaders all with examples
At first glance I thought they were all encrypted so we couldn't see the code behind them but
in the "/Templates/ShaderPack/Shader Raw" folder are the .ps and .vs files. This makes for a
very valuable resource for those that want to see the inner workings of the shaders. Another
benefit if an update changes something in the way the shaders work the code is there so people
can make there own changes while they wait for a shader pack update The two reasons I was
a little concerned about purchasing them.

The ability to encrypt your own shaders is also a very good addition to the pack

The only thing i think could be added is 2D shaders but there is already a thread that has been
stickied with many of them so maybe not so neccesary

Ide give it a thumbs up and review but ive already given a review to AppGameKit and whenever I try to
review any individual product of TGC it all goes under the review of AppGameKit if there was some way of
setting that ide be happy to give some of the other expansions to AppGameKit a positive review.
fubar
PartTimeCoder
AGK Tool Maker
3
Years of Service
User Offline
Joined: 9th Mar 2015
Location: Londinium
Posted: 14th Jul 2018 13:58
Quote: "The only thing i think could be added is 2D shaders but there is already a thread that has been
stickied with many of them so maybe not so neccesary "


I appealed to Janbo severial times for a 2D shader pack and he did say it would be considered, I know there are many 2D shaders to be found in the forums but an all in one pack like the 3D stuff would make a great DLC, I'd buy it for sure.
janbo
9
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 15th Jul 2018 14:58
Hey thanks for the kind words,

What would you like to see in a 2D shader Pack then ?
Also I can't see how a second shader library could work with the existing one, without some changes from the Game developer.
I mean, I have one command SP_Sync() where all the rendering happens and if someone wants 3D and 2D shader effects for some reason, they would need to change stuff in the SP_Sync() command.
Off course I could just write a little example code or something but thats not the kind of quality I was thinking off
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th Jul 2018 21:25 Edited at: 16th Jul 2018 21:49
Quote: "What would you like to see in a 2D shader Pack then ?"


Well like all shaders that's on a need to use basis. With that said there are many already created that could be added with authors consent
Like water ,fire, fog, snow, rain, sun and oldskool game effects reproduced. etc Im sure there are ones people may like to see


Ide particularly like a snow effect that builds up ive tried this with code without much success perhaps it could be achieved better as a shader
I have a game effect that was used on the old Atari ST in mind that two players competed against each other by deflecting snow to from falling
on there side to the other players side. Not so sure how much could be reproduced as a shader as it may be better particle effect but snow that
would build up on any color it meets as being the same color it was set at. This could then be used for rain snow hail etc
fubar
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th Jul 2018 22:20 Edited at: 17th Jul 2018 23:36
Edited

I was thinking a Disintegrate Shader
but I already created one this version dissolves pixels and alpha



Shifting UVs can be quite a complex process and ive seen failed attempts at doing this in real time
Perhaps a shader that shifted the vertical UVs horizontally on a curve and or visa versa on a sine curve

one example of this would be a 2D driving game where the road UVs shifted on a sine curve that was
Set with each call. People may find very useful and because I didn't manage to get a UV process that
did this was part of the reason My Night Driving used 3D
fubar
janbo
9
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Jul 2018 16:32
Uh I really like that uv deformation shader idea.
Well I guess a shadow,normalmapping and dissolve shaders are a must have.
I thought i could somehow manage to create text shaders
Ill need to alter every shader to match each others setup anyways.
Im in hospital right now and have no clue when i can come home... but I wanted to buy a laptop anyways, so i might defeat the boringness with some shader programming.
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 21st Jul 2018 23:43
Quote: "Im in hospital right now and have no clue when i can come home."

Sorry to hear that Janbo hope nothing too serious
fubar
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 22nd Jul 2018 03:13 Edited at: 24th Jul 2018 01:26
I also been toying with the idea of neon overlays etc
for example texture0 normal lighting but texture1 could be a mask layer where whatever is
visible in the texture1 layer given full brightness and replaces that coordinate in the texture0
layer. I have been trying this one myself with the hope i can add neon lights etc around the
rims of wheels etc but i was getting some strange errors incompatible types was the first then
some rather undescriptive errors so ive set that aside and its in my todo list lol

fubar
janbo
9
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Jul 2018 07:06
Good one
I think I know exactly what you mean: Lighting a 2D game

Actually its pretty serious: I'll need a new hart in the future
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 22nd Jul 2018 07:42
Prayers that everything goes well
Mum had to go through similar many years ago shes now 81 so stay positive
fubar
janbo
9
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Jul 2018 09:37
Aww many thanks !
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 24th Jul 2018 01:27

NEON shader will be something like this (at present I got rid of the errors but its showing nothing and not sure if I got the mix command right)
fubar
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 24th Jul 2018 16:38
No, I think you have the mix command mixed. Should it not read more like:

mix(vec4(color),vec4(colorB), vec4(colorA,1.0));

But I think the issue is that you've defined the two colours as vec3 variables, which would have no alpha. Then you're mixing them by the alpha of the first colour by stating it as a vec4, but that would make it zero.....so no Mix. I think at least. Try setting a manual value at the end of mix, for example 0.5.

Why don't you declare the colours as vec4? Also you've done this:
vec3 colorB = texture2D(texture1, uvVarying1).rgb*vec3(1.0,1.0,1.0)

Which is literally multiplying it by 1. So you've said the image red value is the image red value *1.0. Is there a reason for that?
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 24th Jul 2018 16:47
Also, the two images seem to be using the same texture UV coordinates, so not sure why you have defined two sets within the vertex shader?
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 24th Jul 2018 19:21 Edited at: 24th Jul 2018 20:39
thanks Santman.
What im trying to do is have two images one normal and the second only with certain parts showing
the second one will have full light and I want to mix that with the first but I wasn't using the alpha
I thought perhaps I could mix on the rgb channels to



fubar
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 24th Jul 2018 19:52
I'm on a phone right now, will test it when I get home. I get what your trying to do I think. Can you upload the test images?
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 24th Jul 2018 20:10 Edited at: 24th Jul 2018 20:37
These are quick mocked up images as I couldn't use the others they weren't mine to share
http://users.tpg.com.au/subarpk/A.png
http://users.tpg.com.au/subarpk/B.png

basically A is normal texture and B I just want to be able to use as a kind of full neon glow lol I still have so much to learn
about shaders I thought that would be so much easier

Last time I worked with the mix command I had to use 3 textures the second being a kind of map for the 3rd but I cant see why that
would be needed this time and I more than likely have code that aint necessary. It may be I have fuzzy logic lol
fubar
Golelorn
1
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Jul 2018 01:47 Edited at: 25th Jul 2018 02:17
You're not separating( or defining?) the colors. How does the shader know how to give more weight to one texture than another?

Also, noticed ColorB is using UVvarying1? I think that needs to be UVvarying0.

The third value for mix is not mixed. Its an interpolation. I believe you are missing code to either give weight to your texture or take away weight. Plus, it looks like your interpolation value is not correct. Mix may need to be applied multiple times, since you can only mix two textures/colors.

Mix the textures. Then redefine the colors with fog.

For instance, a splat map takes the RGBA channels, and gives weight to each texture based off the RGBA to know which textures have the greatest strength( maybe I missed it in your code ). Then these are mixed together, with an interpolation(how much weight is given) that blends them.

That is my understanding, which could be totally wrong and I have added nothing to the conversation.
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 25th Jul 2018 09:25 Edited at: 25th Jul 2018 09:27
Golelorn is right, you've not grasped the mix I don't think. Essentially it work like this:
Mix THISVALUE with SECONDVALUE by THISPERCENT

Remeber it doesn't need to be images, it's all data. So your example before where you said you needed a third, the third images isn't being mixed in, it's being used to determine the strength of the mix, probably through an alpha channel. So in my trees, the tree has two textures and a mask, but only where the mask alpha is above 0 is the second texture mixed in. In your example your using the alpha of a vec3 image as the mix percentage, which is always going to be zero, creating no Mix. So there's that.

The UVvarying thing.....confident you don't need it. Remember this is a % from 0.0 to 1.0 of the image X and Y coords to sample.....so even if they are utterly different sizes unless you are tiling something your stock UVvarying will still work, and I think that may be why you're seeing nothing. So there's that too.

I'm not sure why your applying fog?

Still no touched a pc, but I'm still unsure from your images.....are you trying to creates lights on a sprite that don't ever dim (I.e. rest of the sprite gets dark but the lights dont)? Or are you trying to create like a self illumination effect for lights?

Your mix usage is set wrong (the method you are using would just merge the textures, only by a 0% mix right now) but I think you may have gone too complex with your UV data also, and if that's wrong then you won't even draw a sprite. Also, you used meshdiffuse.....again not great with 2d, but does that apply to a sprite?
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 25th Jul 2018 09:54 Edited at: 25th Jul 2018 10:51
Quote: "Mix THISVALUE with SECONDVALUE by THISPERCENT"

ok that makes more sence thanks I thought the percent was more like where you would set alpha channel etc
In effect I thought I needed
vec4 colorResult =mix(color,colorB,colorA); which ignores the colors in color B which I want full light with

Quote: "The UVvarying thing.....confident you don't need it. "

Thanks i thought it was just that ide doubled up

Quote: "Still no touched a pc, but I'm still unsure from your images.....are you trying to creates lights on a sprite that don't ever dim "

Have a full glow effect merged with regular shading of a 3d object


fubar
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 25th Jul 2018 11:05
Oh is it 3d? That makes sense, I thought it was a sprite. Getting my threads muddled.

If it's a good on a 3d object your after it's more complex I think, screen shader territory I think....though Janbo had the self illumination example.

Tonight I'll get to the pc and get to look at the code.....sure we can all work it out
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 25th Jul 2018 15:42
I even tried




Where it replaces the alpha in first texture with the second texture color with no success
fubar
janbo
9
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th Jul 2018 17:27 Edited at: 25th Jul 2018 17:31
Hey, I guess you just want the "Neon" texture to "shine" through the other texture.
For that you want to work with the raw texture data for the second texture without adding Lighting from AGK. (also no agk_meshdiffuse)

For this to work you would need a completely transparent neon texture except the light itself.
Also, I have to mention, there is a self illumination shader in my shader pack, which can cooperate with a glow fullscreen shader.
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 25th Jul 2018 22:21
So it's basic....and I needed to use a TurboiSquid free model.....but is this the kind of thing?

Attachments

Login to view attachments
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 25th Jul 2018 23:16
Thanks that's perfect Santman

fubar
Santman
6
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 26th Jul 2018 00:11
No worries......you were 98% there anyway.

Login to post a reply

Server time is: 2018-08-14 10:17:31
Your offset time is: 2018-08-14 10:17:31