Ranking
Original Post
How To Make World Shaders (Pictures Included)
NOTE: your computer should have a powerful graphics card capable of running shaders on toribash. They won't load if you have a bad graphics card.

To make a good shader, you need to know what every setting in the code actually does.

First off, copy a paste this code into a new notepad document.

background_color 0.00 0.00 0.00
mirror_color 0.00 0.00 0.00
floor_color 0.0 0.00 0.00
sunshine_color 0.00 0.00 0.00
ambient_color 0.00 0.00 0.00
fog_distance 0.00
sharp_shadow 0
sky_on 1
ambient_light_dir 0.00 0.00 0.00
sun_light_dir 0.00 0.00 0.00
sunbeam_color 0.00 0.00 0.00
sun_color 0.00 0.00 0.00
sky_color 0.00 0.00 0.00
polar_light_color 0.00 0.00 0.00
polar_light_dir 0.00 0.00 0.00
sky_blend_power 0.00
This is the default code of every shader.

When you are finished with a shader, save it as "name.inc" (replacing "name" with the name of your shader) in the "c:\games\toribash #\data\shaders" folder. It needs to be in here if you want to be able to run it in toribash.

To load a shader in toribash, type "/lws shadername.inc" in the chat box and it will load if shaders are enabled. (replace “shadername” with the name of your shader.)


I’ll be going through each and every option and what it does, but first notice how after each selection there's 3 numbers behind it. This is the RGB code, each number represents either Red, Green, or Blues values in the setting. Different from a 255 value, it uses decimals that can go up to 1. So say we wanted a red background, we would have "background_color 1.00 0.00 0.00". The 1.00 represents that reds value in the background is full. We will get a bright red background in the shader. Say you wanted a more complex color, like orange?
"background_color 1.00 0.50 0.00" is the code we would put in, because it tells the program that red has a value of 1, and green has a value of .5, which will combine the values to make an orange colour. If you want a specific colour and it uses a 255 base, divide the value by 255 and you’ll get the decimal value.

If the values for an option are something other than RGB, I will let you know.


"background_color 0.00 0.00 0.00" It's the background colour that is used in the shader. It can also be used as a mid-colour (also known as the “fog” or “mist”) if you have "sky_on" set to "1".
-----------------
"mirror_color 0.00 0.00 0.00" The mirror colour.
-----------------
"floor_color 0.0 0.00 0.00" The floor colour.
-----------------
"sunshine_color 0.00 0.00 0.00" The sunshine colour, if you have a certain colour you want the light to be, use this. It will tint the tori's lighted body parts. SHARP SHADOWS HAVE TO BE ON FOR THIS OPTION TO WORK.
-----------------
"ambient_color 0.00 0.00 0.00" The ambient setting colours all of the tori's body. It's best to use slightly tinted values for this option.
-----------------
Sunshine: [Value of 1.00 0.0 0.00] The shadow color is a negative version of the RGB value.


Ambient: [Value of 1.00 0.00 0.00]

-----------------
"fog_distance 0.00" this is the fog distance. It sets how large the floors circumference is before it starts fading to the the background colour. It does not need to be set as an RGB code, for it is not a colour. Simply set it at around 30 - 60 for best results.
-----------------
"sharp_shadow 0" Can be set to "1" or "0", "1" enables sharp shadows, which creates a shadow for the tori on the floor, rather than a darkened blob (ambient occlusion/soft shadows FTW)

Sharp Shadows:

-----------------
"sky_on 1" Can be set to "1" or "0". "1" enables the sky to be on, which allows a sun, and polar colours which will add more variety to the shaders look.

Sky_On: [Values: background_color 1.00 1.00 1.00, mirror_color 1.00 1.00 1.00, floor_color 1.00 1.00 1.00, ambient_light_dir 1.00 0.50 0.50, sun_light_dir 1.00 0.50 0.50, sunbeam_color 0.00 1.00 0.00, sun_color 1.00 0.00 0.00, sky_color 0.00 0.00 1.00, sky_blend_power 4.00]


Sky_Off:

-----------------
"ambient_light_dir 0.00 0.00 0.00" This is setting the direction in which the ambient light comes from. though it has three values it is a direction setting, meaning it has an XYZ configuration rather than RGB.

Let's take a little pause and I'll show you what XYZ is.
XYZ configurations are directions which allow for an object to be placed at a specific location using the three values. It's sort of like a 3D grid, X is left/right, Y is forward/backward, Z is up/down.

XYZ origin in toribash (MSPaint \o/):

The X (red), Y (green), and Z (blue) axis are all pointing in the direction of their positive value.


Back to the tutorial now.
-----------------
"sun_light_dir 0.00 0.00 0.00" This controls where the sun is or where the sunlight is coming from. If we had a value of "1.00 0.00 0.00", the sun would be located to the left of tori. The sun is half in the ground here, so we need to add a "Z" value. Making the value "1.00 0.00 0.50" would result in the sun being on the left and half way up in the sky. Now we need a "Y" value to make the sun seem more naturally placed. "1.00 0.25 0.50" as a value makes the sun move behind tori slightly. It's still to the left, but now it's 25% from being exactly at the left. If we had a negative value such as "-1.00 0.00 0.50", the sun would be to the right of tori.
-----------------
IMPORTANT: Now for some reason the next four options have their colour code reversed. If we had the value as 1.00 0.00 0.00, we'd expect a red colour right? WELL NO WE GET BLUE. Green remains the same, but red and blue are switched. Why? I have no fucking idea. But it is how it is, just watch out for that on these next four options.

-----------------
"sunbeam_color 0.00 0.00 0.00" This controls what colour the aurora around the sun is.

If we had the sky red, and the sunbeam colour green, the result would be yellow. Why? Contrasting colours mix their values. If the sky was black and we had green, it would be green but contrasting colour combinations such as red/blue, red/green, blue/green end up mixing to create the secondary form of the RGB code. (cyan, yellow, magenta)
-----------------
"sun_color 0.00 0.00 0.00" What colour the sun is.
-----------------
"sky_color 0.00 0.00 0.00" What colour the sky is.
-----------------
"polar_light_color 0.00 0.00 0.00" This pretty much determines what color half the sky is. If we had the sky as 1.00 0.00 0.00, and the polar colour as 0.25 0.00 0.00, we would get a dark blue on one side and a full blue on the other side.
-----------------
"polar_light_dir 0.00 0.00 0.00" This uses an XYZ code. This decides the location of the polar light. It’s best to have it beside or opposite of the sun’s location. (sun is “1.00 0.25 0.50” then polar_dir would have to be “-1.00 -0.25 0.50” to be exactly opposite of the sun. the Z option is not inverted so that the polar light isn‘t underground.)
-----------------
“sky_blend_power 0” How smooth the gradient between the colours is. 0 = sharp, >0 = smoother as it gets higher.
-----------------
"text 0.00 0.00 0.00" Pretty much the only text colour that needs to be changed. It's the default colour of text. Usually black. If you have your shader black and you need to have the colours inverted, just copy and paste the text/msg/menu segment of “inverted.inc” and add it to your shader.

If you really want to customize the text colours, here’s a link to Blam’s tutorial which states them.


And that's about all I can do. Thanks for reading and feel free to post things I should change or a shader you just made with help from this tutorial.
Last edited by Diealready; Jul 20, 2010 at 06:30 AM.
Wow, that was a really cool tut how to make shaders with Notepad. +rep
OSHI - AM - TRG
RAKU
there should be a program for it no ? it seems easy and btw you can use photoshop for the colorblending to know what color its gona be
Wow nice tut dude it could really help us
[insert name here] [insert name here] [insert name here]
Nice tutorial, will help me out in my new vids.
+Rep
"Never think you're the only one at something" - VictorTB

4 haters only