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 / Useful Community Shaders Project

Author
Message
OminusPrime
8
Years of Service
User Offline
Joined: 30th Jun 2015
Location:
Posted: 2nd Apr 2016 02:17
Im still new to Shaders although i know C++ so im slowly getting there, this thread is a great help.
Just like most of you ive been trying to Learn the interface that Open GL used to talk with the Shader code Like the Uniform Variables agk_View agk_Proj and agk_World
although agk_World Confused me.
After some further study it appears the Model matrix as it is known in OpenGL is the same as the World Matrix as its known in Direct X.
Kinds of strange we are using OpenGl but agk is calling the Model matrix by DirectX Termanology..??
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 4th Apr 2016 22:33 Edited at: 15th Jul 2017 01:29
Hello,

I converted an FXAA shader to see if it can beat the build in MSAA shader.
I didn't made many tests but MSAA is slightly faster
Not good for me but also not bad, as MSAA is fast then... I think : )

FXAA vs MSAA Demo
Download

And I add here my Water shader with reflection, refraction and specular highlights
soft edges and darker color for deeper water will come in the new AppGameKit version.
I updated my first post on the first site also, take a look and try what you like : )

3D Water shader
Forum Thread

Using AGKv2 Tier1

Attachments

Login to view attachments
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 10th May 2016 06:38 Edited at: 10th May 2016 11:21





Tiled animated texture:
This shader loads a tiled texture and can play the textures in a row.
Dude, it's texture animation directly on the GPU for AppGameKit!
You won't belive the speed difference by using this shader...

There are some out-of bounds errors that I try to fix, so it should be possible to use this shader without activating the imageUV
scrolling. Still, this shader is the most powerful solution for texture animation...

GLSL shaders are very powerful. I never realised, that we could actually build our games in GLSL and use AppGameKit as a GLSL Player
It is very creepy, that you can even build editors in glsl.. :S
I would really like to see more math commands like matrix4 in AppGameKit, so I could create some serious GLSL shaders for AppGameKit with it.


This code does require a 4x4 tiled texture called test.png in the media folder, it's in the attachments.

AGK2 T1:


ps:


vs:



EDIT:
Found the lines to stay in bounds:
(if you don't want to use SetImageWrapU/ V and want have precise calculations over a longer period of time )
update in vs:



BTW: Has anyone a normal map shader for AppGameKit, that works with the new light and fog functions mentioned in "Shaders in AGK"?
https://www.appgamekit.com/documentation/guides/13_shaders.htm

Feel free to see my little advert/ demonstration for more GLSL shaders in this thread:

[/url]

Attachments

Login to view attachments
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 11th May 2016 22:31 Edited at: 12th May 2016 04:21



AGK 3d Billboard shader

AGK Source:


vs:


ps:


tree billboard texture attached!

You can use this to fill your terrain in the distance, without any serious coding or effort.



Good to know:

Model Matrix
AGK_World*AGK_View is the model matrix, but dont forget to change agk_ViewProj in agk_Proj in the gl_position line

[/url]

Attachments

Login to view attachments
Harlequin
14
Years of Service
User Offline
Joined: 22nd Mar 2010
Location: Melbourne (AU)
Posted: 3rd Jun 2016 06:39
Hi Jack,

I got the shader to work, but I do not understand what you mean by the statement "AGK_World*AGK_View is the model matrix, but dont forget to change agk_ViewProj in agk_Proj in the gl_position line", do I need to change anything (seems like I don't to make it work).


From what I now understand about billboards, they basically rotate a sprite plane (or even an 3d object) to face the camera view, so is it possible take a group of 3d objects (eg: trees in a forest) and convert them to billboards on the fly? I am guessing this would be done in a shader that would take a range from the camera, make an image of the object(s) then replace the object with it's billboard.


Thanks
It\'s late, I\'m tired, out of coffee and now I\'m wet.
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 3rd Jun 2016 07:11
Hello Harlequin, thank you for your interest in billboard shaders!

Quote: "do I need to change anything (seems like I don't to make it work)"

No, you don't have to change anything, this is just a global information how to get the model matrix in the glsl shader code, just in case someone needs this information to write another awesome shader.

Quote: "group of 3d objects"

I bet if you create a forrest, you will use some original models for the trees, and then instance each tree in the forrest from an original tree model.
The best method would be to have the billboards of each original tree already rendered and crawling in the media folder by the tree model.
If you create a tree instance in the forrest, also create a billboard on the same position, then you have to create a distance checking function in real time for each tree,
once the distance is over your cull limit, the instance tree will be hidden and the billboard at the point will be shown and vice versa.
This method is way more common for your task.

Greetings, Jack

[/url]
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Jul 2016 10:57 Edited at: 11th Jul 2016 10:58


Hi,
i want to present my shaders inspired by Jack's billboard and animation shader. I put it together and ad some changes, now it works better for me. The second shader is a normal-mapping shader. the shader that was alrady presented calculates the normal not correctly because of the missing TBN-Matrices. So, after hours of searching the internet, I have found a way to calculate this TBN matrix without precalculated vertex-tangent's. I think the result does not look bad.
A disadvantage is there. This shader does not work under AppGameKit WebGL. Because AppGameKit apparently not initialized some extensions, to use the functions 'dFdx and dFdy'.
So, tested and functioning of shaders on Windows and Linux.

Program control:
A/D = strafe left/right
W/S = move forward/backward
press left mouse button and move mouse to look.

Download Content:
Billboard-Shader with animation and a kind of arbitrary axis.
Normalmapping-Shader
Media-Files
Source code
Windows-Executable
Linux-Executable

have fun with this
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine

Attachments

Login to view attachments
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 11th Jul 2016 14:12 Edited at: 15th Jul 2017 01:30
Hey, well done!
You have found the same source for the TBN as I did
I only found that you could divide L by dist as you have the length already and don't need to calculate it again in normalize(L)


Maybe I post my Normalmapping shader here too

Using AGKv2 Tier1
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 12th Jul 2016 01:20
So I have a shader request for some talented young lad out there
Literally just as simple as duplicating the shadow effect in Thomas was Alone. Choosing the angle/alpha is essential and things like fade-out would be nice but defs not particularly important.

Audacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android
130,000 installs with AppGameKit and counting
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jul 2016 01:30
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jul 2016 02:50
I'm trying a couple of the older shaders (Specifically the 3D toon shader and 3D water shader) and i just get a blank window. Is there something else i need to do?
Harlequin
14
Years of Service
User Offline
Joined: 22nd Mar 2010
Location: Melbourne (AU)
Posted: 12th Jul 2016 06:05
Hi Blink0k,

I had the same issue, there were changes in build 2.0.15 to the light sources (if I understand it all correctly).
Here is a link to the forum post about it and the fix you need to make to the shader
https://forum.thegamecreators.com/thread/216523
It\'s late, I\'m tired, out of coffee and now I\'m wet.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jul 2016 06:41
Thanks Harlequin! Worked a treat
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 12th Jul 2016 09:46
@MadBit : your example is great !! Thanks a lot.
But on my pc, the billboard doesn't work properly :
AGK2 tier1 - http://www.dracaena-studio.com
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 12th Jul 2016 19:44
@All:
Thank you for your comments.

@Janbo:
Hey that's good. Thanks for that. I always look where can I optimize something.

@Blendman:
Hmm, that's hard to reproduce this error. The image what we see is from the executable that I have posted? Or have you compiled it again.
I notice also that your colors are different. And the frame rate is very low.
Has anyone the same error?
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jul 2016 23:51
quick question;
Is there any documentation that describes shader values like agk_MeshDiffuse?
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 13th Jul 2016 11:46
Shorts answer:no.

i have not found anything.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 13th Jul 2016 14:34
Quote: "Or have you compiled it again."
I have compiled it again with agk 2.020.


Quote: "I notice also that your colors are different. "
For the colors it's normal, I have just add a second light (with red colors ) ^^. So no matter here

Quote: "And the frame rate is very low."
Yes, I don't know if it's possible to optimize the shader more. My Pc is very slow (processor AMD E1-1200 dual core 1.4 Ghz, 5Go ram), so it's good for my test (my android tablet is much better ^^) but not to play some 3D games ^^.
AGK2 tier1 - http://www.dracaena-studio.com
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 13th Jul 2016 18:39 Edited at: 13th Jul 2016 18:41
MadBit wrote: "inspired by Jack's billboard and animation shader"

whohoo! I've infected you with the shader sharing virus! Great work

Currently I have not the time to check your code but is the normal mapping shader based on the standard AppGameKit lights? This would be awesome.

[/url]
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 13th Jul 2016 20:48 Edited at: 13th Jul 2016 20:59
@Jack:
Jack wrote: "... is the normal mapping shader based on the standard AppGameKit lights?"

Yes, indeed.

The only additional variable is for specular lighting.

First three values = how much the rgb values are reflected. Fourth value is hard the specular is. 1.0 very soft > 100.0 very hard.

And thank you for your virus,

@Blendman:
Please send me your executable and your changed source code. So i can test it.


EDIT:
uuups shader update
normal shader vs:


So, with the performance .... I have tested it with an Intel E8400 Duo under Linux and runs at just over 200 FPS.

Maybe a driver problem ???

Please test this - by the billbord creation for the flam. Comment the line 'SetObjectShader' out. Have you the same fragments?
And check the line 'SetObjectUVScale' there must 1.0 divided by 8.0 and 1.0 divided by 4.0. (8 frames horizontal and 4 frames vertical).

normal shader ps:


use now agk material (agk_MeshDiffuse and agk_MeshAmbient).
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 14th Jul 2016 11:33
@MadBit :
I think the matter for the billboard is the size of your images sprite-flame2.png or sprite-flame2.jpg which are 900*451.
Some card (like mine) need a squared image (512*512 for example).
I have converted sprite-flame2.jpg in 512*512 and the billboard is now ok .


For The code, it's exactly the same as yours + those 2 lines :


For the performance, if I use (and the new shader vs/ps) :

The FPS are from 60 (near the scene) to 230 (far the scene)

I use don't use SetSyncRate(0, 0), the performance are from 30 (near the scene like your screenshot) to 60 fps (far the scene) ^^.
AGK2 tier1 - http://www.dracaena-studio.com
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 26th Jul 2016 15:18 Edited at: 31st Jul 2016 14:08
Hello chaps. I've just recently picked up AppGameKit again and started working on a project that I never finished, my latest update is 2.0.14b and as I understand it some stuff has changed in shader code since then.

To put it shortly, is there any collected info/thread on what I need to change in my old shaders to make it work with the latest AGK2 update?

I realize I could probably have found this eventually by trawling the threads in the forum but, hey ho. Give some, receive some right


My hovercraft is full of eels
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Jul 2016 22:31 Edited at: 27th Jul 2016 10:30
[Mod Edit: spam]
JohnnyMeek
10
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 27th Jul 2016 14:33 Edited at: 27th Jul 2016 14:36
Gray Scale Shader..



Use SetShaderConstantByName(ID , "_Grey_Scale",1.0,0,0,0) to set the scale of the grey from 0.0 - 1.0
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 18th Sep 2016 12:57
@MadBit : your example is great !! Thanks a lot man.
but ones I open it on my phone I received this error (attached image)

Attachments

Login to view attachments
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 19th Sep 2016 08:41
Thank you.

To the problem:
OpenGL ES provides these functions available from version 3.0. Mobil devices initialized obviously a smaller version.
The solution is that the tangents and bi-tangent are pre computed for each vertex. Then passed together with the vertex buffer.

Or Paul allows the programmer to choose which GL version is supported.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 20th Sep 2016 10:01


@MadBit :Thanks for your reply ...
But ..Kindly post modified code ... because I'm very noob in Shaders programming '
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 22nd Sep 2016 09:16
@Blendman normalmap2D

---------------------------
Message
---------------------------
Pixel shader 3D_NM.ps failed to compile: ERROR: 0:53: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:53: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:53: '+' : wrong operand types no operation '+' exists that takes a left-hand operand of type 'const int' and a right operand of type '4-component vector of float' (or there is no acceptable conversion)
ERROR: 0:53: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:53: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:53: '*' : wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)


---------------------------
OK
---------------------------

than

---------------------------
Message
---------------------------
Pixel shader 3D_NM1.ps failed to compile: ERROR: 0:40: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:40: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:40: '*' : wrong operand types no operation '*' exists that takes a left-hand operand of type '3-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:40: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:40: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:40: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type '3-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:43: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:43: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:43: '/' : wrong operand types no operation '/' exists that takes a left-hand operand of type 'const int' and a right operand of type 'float' (or there is no acceptable conversion)
ERROR: 0:43: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:43: '=' : cannot convert from 'const int' to 'float'
ERROR: 0:59: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:59: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:59: '+' : wrong operand types no operation '+' exists that takes a left-hand operand of type 'const int' and a right operand of type '4-component vector of float' (or there is no acceptable conversion)
ERROR: 0:59: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:59: 'assign' : implict conversion between types allowed from GLSL 1.20
ERROR: 0:59: '*' : wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)


---------------------------
OK
---------------------------

Intel HD 3000, but most of the other Shaders worked fine. What do I have to change to get it work?
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 22nd Sep 2016 09:19 Edited at: 22nd Sep 2016 09:20
@GolWofael:
Ehmm, this is not a trivial task.

I mean, it is not a big deal to change the shader code. But the AppGameKit code is another thing.

1. First you need to copy the vertex buffer from your 3D object in a MemBlock, so you can read it.

2. Create a new MemBlock buffer. Which is large enough to hold, the vertex-coordinates (3 float), vertex normals (3 float), vertex UV coordinates (2 float), Vertex Tangents (3 float) and Vertex bi Tangents (3 float).

3. Copy the coordinates, normals and uv-coordinates in the new buffer and calculate the tangents and write them also in the buffer.

4. Bind the new buffer to your 3d-object.

I have already made Buffer manipulations in Tier 2 but not in Tier 1. I have currently not much time so I can't do it for you.

Sorry.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Sep 2016 20:17 Edited at: 15th Jul 2017 01:30
You don't have access to OpenGL/Buffer in Tier1.

1 .So in Tier1, I would create a memblock from the object
2. Read the Vertex and UV data from it
3. Calculate the tangent and Bi-tangent
4. Leave everything as it is but pass the result as an array to the vertex shader
5. And access the current tangents Index with gl_VertexID as it is available in GLSL 1.10

I don't have time also

Using AGKv2 Tier1
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 24th Sep 2016 14:18
@MadBit & @janbo : Thanks for your help ... I will try I have time to learn some thing new
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 29th Sep 2016 11:12
@Harlequin thanks for "#version 120"
no it works on Intel HD 3000

@blendman thanks for your work on the normal-shader and thanks to Janbo
have to figure out, how to setup the lights to get more than only a black object

@OminusPrime, did you tried also some of the "FX"-Shaders from FPSC Classic?

Thanks to all of you for your work
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Oct 2016 12:55
Scanline effect fullscreen shader I just made for someone on the newcomer forum. Pixelshader (save as "scanline.ps" in your media folder):


...and below is an example project:


... and this is the effect:
Using AppGameKit V2 Tier 1
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 6th Oct 2016 10:58
@baxslash the pixel shader looks awesome!
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 10th Oct 2016 05:10
Thanks, Baxslash...

One question for the scanline effect, can it be use to achieve this effect also? i mean by changing the scanline texture to diagnol pencil sketch texture?( im on travel cant try)

As in https://www.youtube.com/watch?v=5aKMdsxV0fU,

Im really like NPR games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th Oct 2016 14:06
That's a very different shader I'm afraid. Edge detection for a start.
Using AppGameKit V2 Tier 1
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 23rd Oct 2016 14:58
Ok,baxslash...thanks for the scanline shader

BTW, anybody got any shader for black outline of 3d mesh? i know its normally come with toon shader, but im doing 3d model with pixel art texture(almost altho not perfect) and black outline for mesh and scanline effect(cough) will make it look better


Thanks
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 23rd Oct 2016 23:29
@madbit: I have been playing with your normal/specular shader, but it breaks if I switch fog on in AGK. I would want to fog / drop off the lighting on the shader with distance but at the moment I would have to calculate distance to object from camera in AppGameKit code and update the diffuse colour via the shader parameters.
How can the shader be altered to have light strength fall off or work with AppGameKit fog settings?
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 28th Oct 2016 09:34
Sorry for the late answer.

The automatic code generator from agk does not to check if certain variables (agk_CameraPos) are already set or not. Either Paul changes it so that the code generation is searched for already set variables. Or you give the schader the Camera position in its own uniform variable and change the code accordingly. Or you can of course also write your own Fog function. I suggest you read this page (http://in2gpu.com/2014/07/22/create-fog-shader/).
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 29th Oct 2016 16:48
Hi Blendman,

I am trying to do something with your mix 2 texture with alpha mask.

I wanted to be able to UVOffset the alpha mask, but it appears to be locked in place by the shader. I can offset texture0 but both the other textures also offset when I do this.

I have tried a few things, but I can't figure out how to separate them.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 29th Oct 2016 16:49
Thanks MadBit. I think that is still beyond me at the moment. I am still figuring out some basics at the moment!
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Oct 2016 00:17
Actually Blendman, I managed to get the UV of the texture 2 moving. I see another problem now which requires me to be able to rotate the UV of texture 2 independently on X and Z axis, which seems to be a much more complex issue.
I would guess that it may not even be possible?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 1st Nov 2016 13:29 Edited at: 15th Jul 2017 01:30
I would like to create a Cubemapping shader for reflection/refraction.
Now it seems that there is no way to bind 6 textures as a Cubemap to an Object.
Beware that I can't just manipulate the UV coordinates of the Object/Skybox.

Can someone confirm that ?

Using AGKv2 Tier1
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 9th Nov 2016 04:09 Edited at: 9th Nov 2016 04:17
@ MadBit
I can't get the normal mapping shader running on mobile devices, are there any limitations? When my scene contains more than 3 lights, which lights will be passed to the shader? The first declared, or the nearest lights to the camera?

@jambo
I've attached you one. Just create a box, apply 6 textures to the 6 stages of the object and apply the shader to it.

[/url]

Attachments

Login to view attachments
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th Nov 2016 20:25 Edited at: 15th Jul 2017 01:30
I forgot that I even helped on one
Cube Mapping Problem Tier 1

Thanks anyway

Using AGKv2 Tier1
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 10th Nov 2016 09:52
@Jack:
Jack wrote: "I can't get the normal mapping shader running on mobile devices, are there any limitations?"

This has already been answered here.

Jack wrote: "When my scene contains more than 3 lights, which lights will be passed to the shader? The first declared, or the nearest lights to the camera?"

This question can only be answered by Paul. The shader uses the light sources passed by AGK.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
Wilf
Valued Member
17
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 9th Feb 2017 11:41 Edited at: 9th Feb 2017 11:48
I have a small addition to Janbos excellent [2D] Normal map code from page 1. This adds the alpha channel to the normal map (I changed only the last line of the .ps file).
Be sure to change SetSpriteTransparency on your sprite to 1 to enable alpha in AppGameKit, and change the arguments in Norm2D_Init() from integers to floats

AGK code:



Shader code:


I'm sure someone can optimise it.
Ched80
13
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 10th Feb 2017 21:18 Edited at: 10th Feb 2017 21:18
Hi all,

I've been working on a simple tiltshift shader for 2D projects.

here's a screenie of it in action:



It uses the two blur shaders in the AppGameKit shaders example, but slightly modifies them with a y-axis variable blur.

I also made a simple 3rd shader that combines the tilt-shifted image with any HUDs that you don't want blurred. The tier 1 code for the rendering would be like this:



Enjoy!

Attachments

Login to view attachments
haliop_New
User Banned
Posted: 12th Feb 2017 06:53
Ched80 it looks amazing
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 12th Feb 2017 15:30 Edited at: 12th Feb 2017 16:03
The normal map shader is great ! (thanks janbo and MadBit !)

Just 2 little bugs in the version provided by MadBit :
:
1. with animated models, when the normal shader is applied, animations no longer works
2. Fog activation make the shader to throw an error with the agk_CameraPos declaration (previously declared ? i don't see where)

some ideas ?

@Paul,
it seems that a SetObjectMeshShaderConstantByName() command is missing (or shader constants are global to the multi-meshes objects ? it should not due to the per-mesh SetObjectMeshShader() command
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit

Login to post a reply

Server time is: 2024-04-16 21:01:43
Your offset time is: 2024-04-16 21:01:43