Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a746267
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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! |