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/AppGameKit Studio Showcase / App Shader Kit (3D Shader Pack)

Author
Message
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 20th Apr 2021 17:10
Sorry guys for my absence

@blink0K:
The parameters inside SP_Terrain_SetHeightBlending are control values which adjusts how sharp the edges of the blend will be.
A smaller blending factor will result in sharper edge.

@James H:
The Terrain shader gets 1 Splatmap and 5 textures with the Albedo in RGB chanels and the Height in the Alpha chanel from which the blend factor and the Normals are calculated from.
I had to put the height into the alpha channel cause of the texture channel restriction since we only have 8 channels and the last one being used by AppGameKit for shadows in Mode 1 and 2.

Point Lights and Ambient is done inside AGK's GetXXLighting functions and we dont have acces to it if we want to use AGK's lighting system and commands.
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 5th May 2021 02:47
I cannot seem to get the glass shader to work correctly, always resulting in a dark shadow? I have the shield and water shader working correctly in same program.

In my program I am using a simple sphere to get this working. I have added a bunch of background objects with SP_AddObject(objectID), thinking that is what would get reflected in the glass. So far it just turns a transparent sphere into a shadow.
SP_Glass_AddObject(myGlassObject, img_glassBump, -1)
SP_Glass_SetNormalSize(myGlassObject, 0.1)

The glass image is set for UV wrapping. Was hoping to emulate a bit of a mirror effect using this. Any ideas?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 6th May 2021 21:58 Edited at: 6th May 2021 22:07
Hi,

so the last parameter the -1 is so the SP_Glass_AddObject should generate an environment map and fix it to the object.
Now what happens if you instead of the -1 give the glass object an custom SP_Environment_AddDualParabolic(X#,Y#,Z#,Width#,Height#) ?

It can also be something clashing with the water effect and its "special needs", so also try take out the water effect for testing if you use it in the same project
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 7th May 2021 02:46
Tried replacing the -1 without success:

paraVal <float> = SP_Environment_AddDualParabolic(GetObjectX(myGlassObject),GetObjectY(myGlassObject),GetObjectZ(myGlassObject), <object width> , <object height>
SP_Glass_AddObject(myGlassObject, img_glassBump, paraVal)
SP_Glass_SetNormalSize(myGlassObject, 0.1)

The water shader is used in my project but not in this particular level so it is not being called.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th May 2021 16:39 Edited at: 9th May 2021 16:40
Finding the problem remotely is quite hard for this, i might be able to help you if I get your project/ more code.
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 11th May 2021 00:00
This is complicated program, even the textures are using a custom database to load and store in memory. It can be summarized with these basic two commands to turn an object into glass:
SP_Glass_AddObject(myGlassObject, img_glassBump, -1)
SP_Glass_SetNormalSize(myGlassObject, 0.1)

With my main screen controller I can set if a level has 3D physics, and a separate flag if using the shader pack in that level to run SP_Sync(). This method works fine for water and shield.

I guess question is if you can clarify the usage as the documentation doesn't have a Shader Details section for Glass. Am I understanding correctly that objects I want reflected in the glass need to be added SP_AddObject(objectID) ?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th May 2021 18:15 Edited at: 13th May 2021 18:20
Quote: "Am I understanding correctly that objects I want reflected in the glass need to be added SP_AddObject(objectID) ?"

Absolute correct

Does the Galss effect in the Collection Demo work for you ?

Can you try to add TempLocal.Visible=GetObjectVisible(ObjectID) inside the SP_Glass_AddObject function of my library, this might be a bug.
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 15th May 2021 17:07
I tired adding TempLocal.Visible=GetObjectVisible(ObjectID) but no change. There are no errors just a black sphere, all the shaders are located in the media\Shaders folder.

Here is a simple demo I tried to get going for glass with same result as my existing program:



janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st May 2021 13:01 Edited at: 22nd May 2021 00:02
Hey,
I think i know what heppened here.
The Dualparabolic shader can only handle texturised objects and nobody can see black objects on a black background


There is a problem with relatively large objects wich have only a few verices.
Thats cause the Dualparabolic shader streches the objects in the vertex shader to map them to the halfspheres of the DB map.

I could also offer you to test my parralax corrected environmentmapping which i have half implemented into the shaderpack.

Messy test code for you:


Sorry for ansering so late, im currently distracted by 3D Printing, Arduino Programming and homeautomation so i only check here occasionally
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 22nd May 2021 01:03
I'm afraid that throws error message that it could not find DualParabolicMap.vs :



I found the file in the Shader Raw folder and tried copying into my media\Shaders folder but it doesn't find it. My intent was to have simple glass windows in the background which would reflect the foreground objects, in this case I don't want to use the skybox as it is an indoor setting.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd May 2021 20:41
you may have got it working by now

but it looks as if its looking in a totally different path, so it wont find the file

but I believe there is an example of individual shaders in the pack well most of them and it may help to run the examples
and see if the issue still exists.

goodluck, (shaders can be hard to problem solve but fantastic when they work)
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd May 2021 17:13 Edited at: 23rd May 2021 17:14
I used SP_SetReadRawFiles(1) which you did not initially.
So just removing the command should fix your problem as you use the encrypted shader files.
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 24th May 2021 01:05
Ah ok after removing the debug stuff it appears that the following is required to use the glass shader:

(1) All objects you want reflected need to have a texture applied (SetObjectColor() will not be reflected in the glass)
(2) Add all objects you want reflected with SP_AddObject(ObjectID)
(3) Set up the Environment map:


(4) Create object and add to glass shader:


(5) Add this to main loop:


Can you please clarify if a new DPEnvironmentID is required for each GlassObject? I'm assuming in the demo there must be something that is updating the environment it when you drag the glass around? What is the difference between what I have and the demo supplied with the shader pack?

Thank you!

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th May 2021 14:51 Edited at: 24th May 2021 15:34
Pretty much, yeah but you dont aktually need to setup the environment thing yourself.
It should work with the last parameter in SP_Glass_AddObject set to -1 too, but you wouldn't get back an EnvironemtID to later update in the main loop that way.
So i guess the only problem here was the objects wasn't setup with textures, wich I too didn't really think of.

If you set up your object with the last parameter being -1 except of an custom EnvironmentID provided by SP_Environment_AddDualParabolic, the system then generates an Environment Point automatically for you.
It also fixes the Environment Point to the object like you would using SP_Environment_FixToObject, so that the system is able to check if the object, the environment is linked to, has moved or not.
If the object in question has moved since the last frame it automatically calls the SP_Environment_Update function for you.
So you have the choice between letting the system setup the Environmet Point and loose some controll over it or set up the Environment Point your self and do whatever you like with it.

For now you pretty much need one Environment Point for every object to get correct reflections.
But im tinkering with parralax corrected environment mapping which pretty much lets you generate a few environment points scattered around the level which then the objects can switch to wether the environment point is in range or not and get correct reflections for any positon inside the Environemnt's bounding box.
Cause Environment maps by them selfe only look good for either fragments that are very far away or only for the point the environment is taken from, like it is explained here:

My aproach.

But this isn't a new method and has been around for some jears now ^^

Also if you want to make mirrors you probably want screenspace refelctions that areent horizontal like my implementation for the specular or water reflection effect.
You could change it tho...

Happy coding !
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 24th May 2021 17:38
Wow that is impressive!

Ok so I am learning now that for game design I should really approach general reflectiveness for my static objects, as an enhancement to the environment. Anytime I would want a dynamic object (player character, etc) reflected on a mirror surface I can handle that outside the shader with a proper mirror object (which I have a working type thing going on here https://forum.thegamecreators.com/thread/227615 .)

Thanks Janbo!
tDawg123
2
Years of Service
User Offline
Joined: 1st Jul 2021
Location:
Posted: 5th Aug 2021 00:40
How can you set up the Shader Kit in Tier 2, i.e., using C++? Any help on this would be great!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Aug 2021 06:08 Edited at: 13th Aug 2021 06:17
Fixed width Glowing Outlines along unwelded edges
Is that possible?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 20th Sep 2022 20:29 Edited at: 20th Sep 2022 20:31
Scribble just came across a problem relating the SP_Specular_AddObject.
The SP_Specular_AddObject command doesn't assign the correct ShaderID to the object provided to the command as soon as you call it a second time because of a tiny mistake i made which now resulted in a big problem.
I think i helped somone with this already but just to be sure I made this post and provided a correct SP_Specular.agc file in the FAQ section here: FAQ
Scribble
6
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 20th Sep 2022 20:44 Edited at: 20th Sep 2022 21:58
Thanks a lot, Janbo. That new SP_Specular.agc fixed the issue with Dual Parabolic environmental map not applied for multiple specular-shaded objects.
Glad to see you're still around to help with our shaders need.

Just in case I wasn't being clear:

WE NEED YOUR SHADER
WE HUNGER FOR IT
WE WANT THEM SHINY TEXTURED PLANES

So please keep on developing it

Login to post a reply

Server time is: 2024-03-29 01:57:12
Your offset time is: 2024-03-29 01:57:12