Toribash
Prev Previous Post   Next Post Next
Original Post
[Rel]Poor Shaders for non-shaders people
Hey, I took a little break in the developement of the atmospheres script, and I made this : a "cheap shaders" script for people who cant' handle shaders. It can have colourful floor, sky, and sun.

If someone want to make a nice interface with save/load/shader editor, feel free to use this piece of code. I have little time these days to work on this...


For now, calling the script as it is won't have any effects because all the variables are set to '0'. You have to edit the shaders variables by yourself, in the lua code, with, for example, one of the two settings I give you below.

I will code a "poor-shaders" loader, later, please be patient.

Here I give you an example for setting a nice sunrise :

-- shaders variables, edit them to change the "non-shaders shaders"
-- the floor
local floor_on = 1 -- 0 : Off | 1 : On
local floor_r = 0.00 -- Floor "Red" : 0.00 to 1.00
local floor_g = 0.60 -- Floor "Green" : 0.00 to 1.00
local floor_b = 0.90 -- Floor "Blue" : 0.00 to 1.00

-- the sky
local sky_on = 1 -- 0 : Off | 1 : On
local sky_r = 1.00 -- Sky "Red" : 0.00 to 1.00
local sky_g = 0.20 -- Sky "Green" : 0.00 to 1.00
local sky_b = 0.70 -- Sky "Blue" : 0.00 to 1.00

-- the sun
local sun_on = 1 -- 0 : Off | 1 : On
local sun_r = 1.00 -- Sun "Red" : 0.00 to 1.00
local sun_g = 0.90 -- Sun "Green" : 0.00 to 1.00
local sun_b = 0.00 -- Sun "Blue" : 0.00 to 1.00

-- the sun "aura"
local sunlight_r = 1.00 -- Sun Light "Red" : 0.00 to 1.00
local sunlight_g = 0.10 -- Sun Light "Green" : 0.00 to 1.00
local sunlight_b = 0.00 -- Sun Light "Blue" : 0.00 to 1.00

-- the sun position
local sun_u = 0.05 -- "latitude"  : 0.00 to 2.00
local sun_v = 0.50 -- "longitude" : 0.00 to 2.00

-- the sun radius
local sun_rad = 50

-- the sunlight power
local sun_power = 800
Should give :



Another example : Grassland at night :

-- the floor
local floor_on = 1 -- 0 : Off | 1 : On
local floor_r = 0.00 -- Floor "Red" : 0.00 to 1.00
local floor_g = 0.10 -- Floor "Green" : 0.00 to 1.00
local floor_b = 0.00 -- Floor "Blue" : 0.00 to 1.00

-- the sky
local sky_on = 1 -- 0 : Off | 1 : On
local sky_r = 0.00 -- Sky "Red" : 0.00 to 1.00
local sky_g = 0.00 -- Sky "Green" : 0.00 to 1.00
local sky_b = 0.20 -- Sky "Blue" : 0.00 to 1.00

-- the sun
local sun_on = 1 -- 0 : Off | 1 : On
local sun_r = 1.00 -- Sun "Red" : 0.00 to 1.00
local sun_g = 1.00 -- Sun "Green" : 0.00 to 1.00
local sun_b = 1.00 -- Sun "Blue" : 0.00 to 1.00

-- the sun "aura"
local sunlight_r = 1.00 -- Sun Light "Red" : 0.00 to 1.00
local sunlight_g = 1.00 -- Sun Light "Green" : 0.00 to 1.00
local sunlight_b = 1.00 -- Sun Light "Blue" : 0.00 to 1.00

-- the sun position
local sun_u = 0.05 -- "latitude"  : 0.00 to 2.00
local sun_v = 0.50 -- "longitude" : 0.00 to 2.00

-- the sun radius
local sun_rad = 50

-- the sunlight power
local sun_power = 80
Attached Files
poor_shaders.lua (2.0 KB, 114 views)
Last edited by Melmoth; Feb 24, 2010 at 08:58 AM.