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.

Newcomers AppGameKit Corner / Can the "Motion Sickness" Shader from FPSC Be used in App Game Kit?

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 27th Nov 2017 04:29
I'm not an expert on Shader Compatibility. I believe at some point I saw someone saying that one engine was OpenGL based while another one was DirectX Based but I don't know.

I'm looking for a motion sickness full screen shader. I know that FPSC had a motion sickness shader what did what it had to do pretty damn well. Just wondering of that can still be used with App Game Kit?
If not, are you aware of a Motion Sickness-like shader available compatible with App Game Kit?
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 27th Nov 2017 15:47
Do you mean Motion Blur ?
Also GameGuru is DirectX 11 I think.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 27th Nov 2017 18:59 Edited at: 27th Nov 2017 19:04
You know what, it could very well be motion blur if you set the blur to be pretty sensitive to small movements and move the camera constantly.

Although if it's motion blur then I could probably achieve the effect by copying the final render pass to a blank image and drawing it to the screen with transparency , think the slower I clear the images to refresh the contents, the longer the motion blur would act. Makes sense?
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 27th Nov 2017 21:12 Edited at: 27th Nov 2017 21:22
I'm experimenting with the idea now.

Do you have the ability to copy what's being rendered to the screen (like an application surface) and copy it to a newly declared blank image? Or is the only way to do it is to SetRenderToImage to your custom image and then reset it to be drawn back onto the application surface?

I also seem to have Depth order issues with the image. I've applied it to a block to test and see what is being drawn and the depth ordering is messed up on just that one (see attached image)

EDIT:

The depth had to be set to -1 in the SetRenderToImage AND I had to apply the image to the object before I called the SetRenderToImage function. alright well that's now sorted out.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Nov 2017 12:43
Can you post a screen shot or better a video of what you want to achieve ?
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 28th Nov 2017 13:56 Edited at: 28th Nov 2017 14:14
This particular effect was called MotionSickness.fx and was made by a user for FPSC a long while back. It is technically a motion blur effect with long exposure time (so to speak)

https://www.youtube.com/watch?v=DqFFUCIJA5Y

I'm pretty sure that you can crate this effect without the use of a shader. You'd just have to display the last 3 to 6 frames of the screen renders at a 25% - 50% opacity to create a trail of the entire screen.

I've already managed to create blank image, render the screen to it and apply it to a quad (or a cube for testing) It works.
All I'm missing now is setting the Image Alpha of that rendered image. Only functions I can find is the SetSpriteColorAlpha( iSpriteIndex, iAlpha ) But for whatever reason it doesn't seem to be working for Images created with CreateRenderImage( width, height, format, mipmap ) I have tried to apply the image to a new defined sprite but for some reason when I use the variable name that stores this image index, some other texture I loaded at the beginning of the game code gets loaded into the sprite.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 28th Nov 2017 14:33 Edited at: 28th Nov 2017 14:44
You know what, I have a sneaking suspicion that sprites are actually objects in of themselves and are not actually texture types of other formats. I come from a bunch of different engines where sprites actually contained imagery data which could be used on 3D objects. So I need to figure out how to add transparency to an Image now actually. There's a function to do so for a sprite but not for an image.

Something tells me I'm going to have to write a tiny shader for transparency stages.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Nov 2017 15:04 Edited at: 28th Nov 2017 15:08
Sprites get rendered like objects they have vertices like objects and you can have a vertex shader and fragment shader for them like for objects the only difference is they are using quads instead of triangle strips and they are rendered using orographic projection matrix instead of perspective projection.
I'm pretty sure transparency works for RenderImages... did you try SetSpriteTransparency ?
[Edit]This should be possible with the same approach the bloom example is reducing and combining the renderimages... so just render the last few frames and apply them with the ping pong method from the example.[/Edit]
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 28th Nov 2017 15:05 Edited at: 28th Nov 2017 17:07
Yeah this is what I am doing at the moment, the only problem is that the only way I can get the 6 or so images/ quads with ping ponged images to blend together is to use
SetObjectTransparency( objID, mode )

which makes the quads transparent BUT it blows out all the brights because it also does additive blending. I feel that there isn't a function to set the transparency value of an image and the only way to do it is to write a shader that adjusts the pixel transparency and apply it to the quads.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 28th Nov 2017 17:43
Basically the question I have now is this.

This is the default Fullscreen shader which you apply to a quad:

Quote: "
uniform sampler2D texture0;
varying mediump vec2 uvVarying;

void main()
{
gl_FragColor = texture2D(texture0, uvVarying);
}
"


How do I half the alpha of the texture0? I think that is a vec4 value so how do you pass through the RGB colors but modfy the alpha?
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Nov 2017 18:09
The syntax is:
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 28th Nov 2017 18:20 Edited at: 28th Nov 2017 19:38
Ah, thank you. Would have never found it myself.


I got it to work.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 28th Nov 2017 18:30 Edited at: 28th Nov 2017 19:39
Also on a side note.

How do you go about getting a handle on a shader property?
In Game Maker I could set up a handle on a varying shader variable and adjust stuff using game code. Like I could adjust the effect intensity.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Nov 2017 22:41 Edited at: 28th Nov 2017 22:42

Doc Shaders in AGK
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 29th Nov 2017 01:05
Alright, thanks for the help!
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net

Login to post a reply

Server time is: 2024-11-24 13:01:40
Your offset time is: 2024-11-24 13:01:40