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 / Basic Shader Exmple

Author
Message
Mambazo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 9th Jun 2020 22:03 Edited at: 9th Jun 2020 22:06
Hi,

Getting started with shaders in AppGameKit can be a bit daunting (at least it was quite the challenge for me).
Eventually figured it out and there has been some interest expressed in a small demo for people to pull apart and learn a bit from.
The shaders here are modified from the output of GetObjectMeshVSSource() and GetObjectMeshPSSource() which is created when calling SetObjectNormalMap().
I found this very helpful for getting an idea of how AppGameKit interfaces with GLSL. Also the guide on Shaders here.

Here is a very simple implementation of normal mapping using a custom shader.

Main source:-


normalmap.vs (modified from the auto-generated vertex shader, put this into the media folder)


normalmap.ps (modified from auto-generated pixel shader, put this into the media folder)


The two images used in this demo are attached to this post.

Hope this helps someone looking for a way into custom shaders for AGK.
If at first you don't succeed, sky-diving isn't for you.

Attachments

Login to view attachments
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 10th Jun 2020 04:42
@Mambazo

thanks for posting

by chance would you know the language name for the shading code is created in ?

would think it would be possible for use it in a way
ware the person who runs the a program from inside of it

To change things on the fly as the program is running

I'm not talking high end AI but very basic set of rules ?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jun 2020 07:43
works great and wouldn't mind seeing the uniform changes that were used on facebook to show the glow
if this is from the same person

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Mambazo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 10th Jun 2020 09:56 Edited at: 10th Jun 2020 10:01
Quote: "by chance would you know the language name for the shading code is created in ?"


The language is OpenGL Shader Language (GLSL).

Quote: "would think it would be possible for use it in a way
ware the person who runs the a program from inside of it

To change things on the fly as the program is running

I'm not talking high end AI but very basic set of rules ?"


I would use Lua for something like that. I'm not sure if AppGameKit Tier 1 has native Lua support but it is certainly possible in Tier 2.

Quote: "works great and wouldn't mind seeing the uniform changes that were used on facebook to show the glow
if this is from the same person"


I'm not sure which one is the glow. Do you mean the environmental reflections, or perhaps the specular highlights?
If at first you don't succeed, sky-diving isn't for you.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Jun 2020 10:43
Note that this shader does not work with Vulkan. Not sure what's going on there
It would be nice to see some doco on using shaders for vulkan
Mambazo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 10th Jun 2020 11:25 Edited at: 10th Jun 2020 11:43
blink0k wrote: "Note that this shader does not work with Vulkan. Not sure what's going on there"


I wasn't even aware that AppGameKit Tier 1 had Vulkan support! How do I enable/disable that?
Was there an error message?
Is there a way I can test for that?
If at first you don't succeed, sky-diving isn't for you.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jun 2020 20:57
Quote: "'m not sure which one is the glow. Do you mean the environmental reflections, or perhaps the specular highlights?"

was thinking the specular highlights

Quote: "It would be nice to see some doco on using shaders for vulkan"

indeed but I wonder if grabbing the auto made shaders with vulkan would help show differences

Quote: "I wasn't even aware that AppGameKit Tier 1 had Vulkan support! How do I enable/disable that?"

vulkan support is one of the features of the studio version and yes the rendering engine can be set

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Jun 2020 21:05
Quote: "indeed but I wonder if grabbing the auto made shaders with vulkan would help show differences"

Excellent idea

Login to post a reply

Server time is: 2024-11-25 04:07:16
Your offset time is: 2024-11-25 04:07:16