Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iangilman committed Jan 11, 2018
0 parents commit a746267
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Inverter/shaders/final.fsh
@@ -0,0 +1,24 @@
#version 120

varying vec4 texcoord;
uniform sampler2D gcolor;

void main() {
// Get the location of the current pixel on the screen.
// point.x ranges from 0 on the left to 1 on the right.
// point.y ranges from 0 at the top to 1 at the bottom.
// Change the numbers to grab values from other parts of the screen.
vec2 point = texcoord.st;

// Get the color of the pixel pointed to by the point variable.
// color.r is red, color.g is green, color.b is blue, all values from 0 to 1.
vec3 color = texture2D(gcolor, point).rgb;

// You can do whatever you want to the color. Here we're inverting it.
color.r = 1 - color.r;
color.g = 1 - color.g;
color.b = 1 - color.b;

// Here's where we tell Minecraft what color we want this pixel.
gl_FragColor = vec4(color, 1.0);
}
9 changes: 9 additions & 0 deletions Inverter/shaders/final.vsh
@@ -0,0 +1,9 @@
#version 120

varying vec4 texcoord;

void main() {
// Here we're just setting up things we'll need in final.fsh
gl_Position = ftransform();
texcoord = gl_MultiTexCoord0;
}
11 changes: 11 additions & 0 deletions README.md
@@ -0,0 +1,11 @@
# Simple Minecraft Shaders

If you want to play with shaders in Minecraft, here's the simplest possible shader to get started with, along with some hints on how to make your own.

## Installing

You'll need the shaders mod, but then you can take the `Inverter` folder and drop it in the `shaderpacks` folder in your Minecraft resources folder.

## Coding

Take a look at `Inverter/shaders/final.fsh` and play around!

0 comments on commit a746267

Please sign in to comment.