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 / changing the colour of the pixels shader (creating .ps file)

Author
Message
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 19th May 2013 19:01 Edited at: 19th May 2013 19:07
to write a .PS file:

1- open the note pad:

2- write the following:
Quote: "#ifdef GL_ES
precision highp float;
#endif

uniform sampler2D texture0;
uniform sampler2D texture1;

varying vec2 uv0Varying;
varying vec2 uv1Varying;

float red = .5;
float green = .5;
float blue = .5;

void main()
{
gl_FragColor = (texture2D(texture1, uv1Varying)+vec4(red,green,blue,1))*texture2D(texture0, uv0Varying);
}
"

3- save the file as .PS

so the values; red, green, blue can be modified to change the shader pixels colour and it varies between [0.0, 1.0]

now comeback to the 3d sample given by TGC. if you want to turn the room into a hazardous room, just set the red to 1, green to 0 and blue to 0.

for flashing room, put two .PS files with different colours values and create two shaders then set the object to change the shader.

basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 19th May 2013 19:05 Edited at: 19th May 2013 19:06
---

lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 19th May 2013 20:17 Edited at: 20th May 2013 00:10
Rather than using two shaders, use "SetShaderConstantByName".

Edit:

Quote: "---"


Also, not really how shaders are generally used I feel, and perhaps that is why you're not getting the response you appear to want from this post.

A shader is generally supposed to do something automatically to alter the appearance of objects. At most usually there is a timer variable that you send with "SetShaderConstantByName" to the shader for generating sin/cos values.

Good thread about shaders in AGK:
http://forum.thegamecreators.com/?m=forum_view&t=201508&b=41

My hovercraft is full of eels

Login to post a reply

Server time is: 2024-11-24 15:09:44
Your offset time is: 2024-11-24 15:09:44