Rain / Snow / Dust etc., with cheap GLSL.
Moderator: Moderators
Rain / Snow / Dust etc., with cheap GLSL.
OK... basically, I totally fixed up Trepan's original precipitation script (it's a lot faster now), then wrote a new variant that gives us computationally-cheap yet reasonably effective rain snow or various particle effects (dust storms, for example), depending on how it's configured.
I do lightning / thunder with a totally different Gadget, and I haven't yet figured out how to deliver cheap reflections on the map surface, so the rain's still pretty much like you'd see in an older game engine, not the latest / greatest. Still, it's really cheap (it's a lot cheaper than my last attempt at rain, to put it another way), and looks just fine with a little fog, imo.
Does anybody want this but me?
I do lightning / thunder with a totally different Gadget, and I haven't yet figured out how to deliver cheap reflections on the map surface, so the rain's still pretty much like you'd see in an older game engine, not the latest / greatest. Still, it's really cheap (it's a lot cheaper than my last attempt at rain, to put it another way), and looks just fine with a little fog, imo.
Does anybody want this but me?
Re: Rain / Snow / Dust etc., with cheap GLSL.
YES,ARGH!!!PLEASE,WE BEG OF YOU.LET US USE IT.IT IS AWESOME!!!
XD
On a more serious note,none of the maps that are actually played on a steady basis have any such effects.
It's a shame.
It would be cool ot have a dust storm that randomly starts at some point than goes away after a while and may or may not start again during the game...
random appearance of the visual effect.sometimes it would appear sometimes not at all and would vary in intensity.
XD
On a more serious note,none of the maps that are actually played on a steady basis have any such effects.
It's a shame.
It would be cool ot have a dust storm that randomly starts at some point than goes away after a while and may or may not start again during the game...
random appearance of the visual effect.sometimes it would appear sometimes not at all and would vary in intensity.
Re: Rain / Snow / Dust etc., with cheap GLSL.
I would love it on one condition: make it work for ATI too. Half the ppl cant even see my effects
Re: Rain / Snow / Dust etc., with cheap GLSL.
Pfff my ati 4850 drivers fucking crash when i play/load/alttab from spring.
Re: Rain / Snow / Dust etc., with cheap GLSL.
I need an ATi user to give me an infolog, and I can probably get it debugged, just like the normalmap shader. I'm not getting any warnings, though, which usually a good sign.I would love it on one condition: make it work for ATI too. Half the ppl cant even see my effects
That said, the snow shader's basically just Trepan's original, but with a ton of cleanups and speedups. The rain is basically like the rain in my previous experiments with this technology, but using GLSL to handle the lines, which sped it up a lot.
Anyhow, I'll make a quick test-map to demo a few things, I have (finally) gotten the snow code back to full function.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Okie doke. Here the first tester. Has rain / fog turned on by default, but the precipitation Gadget's fairly well documented, should be fun to play with. The clouds don't work yet, period. If you have crashes, problems, etc. please post your infologs.
I haven't converted the snow to use OpenGL 1.X, which is probably what's wrong with ATi users. That's going to be fun, I'll probably have to grab jK's LUPs billboards and use them instead.
Anyhow, give it a go, let me know what (if anything) is broken atm.
Click here to download.
I haven't converted the snow to use OpenGL 1.X, which is probably what's wrong with ATi users. That's going to be fun, I'll probably have to grab jK's LUPs billboards and use them instead.
Anyhow, give it a go, let me know what (if anything) is broken atm.
Click here to download.
- 1v0ry_k1ng
- Posts: 4656
- Joined: 10 Mar 2006, 10:24
Re: Rain / Snow / Dust etc., with cheap GLSL.
ati is satan
Re: Rain / Snow / Dust etc., with cheap GLSL.
Anybody with an ATi card tested it yet?
Re: Rain / Snow / Dust etc., with cheap GLSL.
EDIT: Testing done. Result: Sorry, but FAIL.
snow fails, and use the fog gadget with baczek's fix instead. My map has it: http://www.springfiles.com/show_file.php?id=1958
BTW: I semi-fixed beherith's version of the snow widget for ati, but nobody could help me with the last part. You want the code?
snow fails, and use the fog gadget with baczek's fix instead. My map has it: http://www.springfiles.com/show_file.php?id=1958
BTW: I semi-fixed beherith's version of the snow widget for ati, but nobody could help me with the last part. You want the code?
Last edited by MidKnight on 05 Sep 2009, 03:24, edited 4 times in total.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Sure, I'll be happy to look at it. According to ATi's specs, the shader should compile OK on anything newer than a 9600 (i.e., anything that can play Spring at a reasonable speed), but there is always that gap between what ATi says and what GLSL actually compiles, on this engine, which is why I need some Infologs from people having problems, to know what's causing the bork.
The snow is built into the Gadget, btw. I want to (eventually) put all of the types of weather effects into one place, for efficiency's sake.
Just open it up and select option 2 instead of 1 in the Lua. Ignore 3, I haven't gotten it working yet and I don't think I'm going to finish it anyhow. I got moving on dynamic systems that will work better in the long run anyhow.
The snow is built into the Gadget, btw. I want to (eventually) put all of the types of weather effects into one place, for efficiency's sake.
Just open it up and select option 2 instead of 1 in the Lua. Ignore 3, I haven't gotten it working yet and I don't think I'm going to finish it anyhow. I got moving on dynamic systems that will work better in the long run anyhow.
Re: Rain / Snow / Dust etc., with cheap GLSL.
I need the Infolog. If the snow shader's not compiling, I need to know what line it stops on. The question is whether it's choking on gl_PointSize, or whether it's just some minor bork.
And did the rain version work? It shouldn't have failed at all, it's really simple...
And here... try this version. ATi's GLSL compiler gets easily confused, this is a cleanup of the minor problems.
And did the rain version work? It shouldn't have failed at all, it's really simple...
And here... try this version. ATi's GLSL compiler gets easily confused, this is a cleanup of the minor problems.
- Attachments
-
- precipitation_particles.lua
- (13.68 KiB) Downloaded 38 times
Last edited by Argh on 05 Sep 2009, 03:34, edited 1 time in total.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Here you are:
PS: ATi doesn't like consts
Also, rain version? Is there a toggle inside the lua gadgets?
Code: Select all
[ 0] Creating sky
[ 0] Loading LuaRules
[ 0] Doesn't count initialized
[ 0] LUARULES-DRAW (GADGETS)
[ 0] Vertex shader failed to compile with the following errors:
ERROR: 0:6: 'assign' : cannot convert from 'attribute 4-component vector of float' to 'default varying 3-component vector of float'
ERROR: compilation errors. No code generated.
[ 0] Bad shader, reverting to non-GLSL gadget.
[ 0] height:50
[ 0] [Weather Particles:Initialize] particle shader compilation failed
[ 0] Vertex shader failed to compile with the following errors:
ERROR: 0:7: '=' : assigning non-constant to 'const 3-component vector of float'
ERROR: 0:11: '=' : assigning non-constant to 'const 3-component vector of float'
WARNING: 0:15: implicit cast from int to float
WARNING: 0:16: implicit cast from int to float
ERROR: 0:22: '=' : assigning non-constant to 'const 4-component vector of float'
WARNING: 0:24: implicit cast from int to float
WARNING: 0:24: implicit cast from int to float
ERROR: compilation errors. No code generated.
Also, rain version? Is there a toggle inside the lua gadgets?
Re: Rain / Snow / Dust etc., with cheap GLSL.
Yes, rain / snow is a toggle, see local particleType = 1.
Rain is on by default, but snow GLSL crashes result in a bork for the whole application. Which is OK, that needed to get fixed anyhow, and when it works on newer ATi, a dump should mean a poor soul trying to use a GeForce 5 or Intel 945, etc..
Here, try this version, all the const junk removed, floats are all made clear, etc. Stupid strict compiler...
Rain is on by default, but snow GLSL crashes result in a bork for the whole application. Which is OK, that needed to get fixed anyhow, and when it works on newer ATi, a dump should mean a poor soul trying to use a GeForce 5 or Intel 945, etc..
Here, try this version, all the const junk removed, floats are all made clear, etc. Stupid strict compiler...
- Attachments
-
- precipitation_particles.lua
- (13.64 KiB) Downloaded 31 times
Re: Rain / Snow / Dust etc., with cheap GLSL.
Much better!
Also: have a fog gadget!
Also: have a fog gadget!
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: gui_dualfog_gadget.lua
-- brief: fog drawing gadget both with and without shader(s)
-- author: Dave Rodgers, user, aegis
--
-- Copyright (C) 2008.
-- Licensed under the terms of the GNU GPL, v2 or later.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function gadget:GetInfo()
return {
name = "DualFog",
desc = "Fog Drawing Gadget",
author = "trepan, user, aegis",
date = "Jul 22, 2008",
license = "GNU GPL, v2 or later",
layer = 9, -- draw early
enabled = true -- loaded by default?
}
end
if (gadgetHandler:IsSyncedCode()) then
else
local enabled = true -- Spring.GetMapOptions("fogeffect",true)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----edit GLSL renderer settings here:
local fogHeight = 180
local fogColor = { 0.50, 0.55, 0.60 }
local fogAtten = 0.01 --0.08
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local GroundFogDefs = {
Color = {0.55,0.45,0.045,0.01},
Height = 180,
Layers = 8,
LayerSpacing = 10,
MapSized=0,
FogMaxStrength = 0.3,
FogLowHeight = 40,
}
local forceNonGLSL = false -- force using the non-GLSL renderer
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----"global" variable list
----no need to edit this.
local height = GroundFogDefs["Height"]
local foglayers = GroundFogDefs["Layers"]
local lsp = GroundFogDefs["LayerSpacing"]
local mapsized = GroundFogDefs["MapSized"]
local tex = GroundFogDefs["Texture"]
local fr,fg,fb,fa = unpack(GroundFogDefs.Color)
local mapy = Game.mapY
local mapx = Game.mapX
local mx = Game.mapSizeX
local mz = Game.mapSizeZ
local e = Spring.Echo
local fog
local FogLowStrength = GroundFogDefs["FogMaxStrength"]
local FogLowHeight = GroundFogDefs["FogLowHeight"]
local x,y
local CurrentCameraY
local timeNow, timeThen = 0,0
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
if (adh == 1) then
local a,b = Spring.GetGroundExtremes()
height = b
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Automatically generated local definitions
local GL_MODELVIEW = GL.MODELVIEW
local GL_NEAREST = GL.NEAREST
local GL_ONE = GL.ONE
local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA
local GL_PROJECTION = GL.PROJECTION
local GL_QUADS = GL.QUADS
local GL_SRC_ALPHA = GL.SRC_ALPHA
local glBeginEnd = gl.BeginEnd
local glBlending = gl.Blending
local glCallList = gl.CallList
local glColor = gl.Color
local glColorMask = gl.ColorMask
local glCopyToTexture = gl.CopyToTexture
local glCreateList = gl.CreateList
local glCreateShader = gl.CreateShader
local glCreateTexture = gl.CreateTexture
local glDeleteShader = gl.DeleteShader
local glDeleteTexture = gl.DeleteTexture
local glDepthMask = gl.DepthMask
local glDepthTest = gl.DepthTest
local glGetMatrixData = gl.GetMatrixData
local glGetNumber = gl.GetNumber
local glGetShaderLog = gl.GetShaderLog
local glGetUniformLocation = gl.GetUniformLocation
local glGetViewSizes = gl.GetViewSizes
local glLoadIdentity = gl.LoadIdentity
local glLoadMatrix = gl.LoadMatrix
local glMatrixMode = gl.MatrixMode
local glMultiTexCoord = gl.MultiTexCoord
local glPopMatrix = gl.PopMatrix
local glPushMatrix = gl.PushMatrix
local glResetMatrices = gl.ResetMatrices
local glTexCoord = gl.TexCoord
local glTexture = gl.Texture
local glTexRect = gl.TexRect
local glUniform = gl.Uniform
local glUseShader = gl.UseShader
local glVertex = gl.Vertex
local glTranslate = gl.Translate
local spEcho = Spring.Echo
local spGetCameraPosition = Spring.GetCameraPosition
local spGetCameraVectors = Spring.GetCameraVectors
local time = Spring.GetGameSeconds
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Extra GL constants
--
local GL_DEPTH_BITS = 0x0D56
local GL_DEPTH_COMPONENT = 0x1902
local GL_DEPTH_COMPONENT16 = 0x81A5
local GL_DEPTH_COMPONENT24 = 0x81A6
local GL_DEPTH_COMPONENT32 = 0x81A7
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local depthBits = glGetNumber(GL_DEPTH_BITS)
if ((not depthBits) or (depthBits < 24)) then
spEcho("Ground Fog disabled, needs at least 24 bit depth buffer")
return false
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local worldPass = false -- let's other DrawWorld() gadgets be unfogged
local gndMin, gndMax = Spring.GetGroundExtremes()
local debugGfx = false
local GLSLRenderer = true
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local depthShader
local depthTexture
local uniformEyePos
local uniformWP11
local uniformWP15
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----a simple plane, very complete, would look good with shadows, reflex and stuff.
local function DrawPlaneModel()
height=GroundFogDefs["Height"]
height=height+10*(math.sin(time()/1)) + 30*(math.sin(time()/7.3))
Spring.Echo('height:'..height)
glBeginEnd(GL_QUADS,function()
for i = 0,foglayers,1 do
if (mapsized == 0) then
glVertex(-mapx*4096,height-(i*lsp),-mapy*4096)
glVertex((mapx*4096)+mapx*512,height-(i*lsp),-mapy*4096)
glVertex((mapx*4096)+mapx*512,height-(i*lsp),(mapy*4096)+mapy*512)
glVertex(-mapx*512,height-(i*lsp),(mapy*4096)+mapy*512)
elseif (mapsized == 1) then
glVertex(0,height-(i*lsp),0)
glVertex(mx,height-(i*lsp),0)
glVertex(mx,height-(i*lsp),mz)
glVertex(0,height-(i*lsp),mz)
end
end
end)
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----fog rendering
local worldPass = false -- let's other DrawWorld() gadgets be unfogged
local gndMin, gndMax = Spring.GetGroundExtremes()
local debugGfx = falsepass
local function Fog()
h=8*(math.sin(time()/1.2)) + 30*(math.sin(time()/7.3)) -30
--Spring.Echo('height:'..(height+h))
glResetMatrices()
glColor(fr,fg,fb,fa)
glDepthTest(true)
glBlending(true)
glPushMatrix()
glTranslate(0,h,0)
glCallList(fog)
glPopMatrix()
glResetMatrices()
glDepthTest(false)
glColor(1,1,1,1)
glTexture(false)
glBlending(false)
end
local function FogLow()
x,y = glGetViewSizes()
glColor(fr,fg,fb,FogLowStrength)
glTexRect(0,0,x,y)
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-----------------------------------------------------------
-- Springs default gadget:ViewResize(viewSizeX, viewSizeY)
-- IS BROKEN!
-- Also, dual screen with minimap on left is wierd, using non glsl fog for it.
-----------------------------------------------------------
local vsx, vsy
function gadget:ViewResize(viewSizeX, viewSizeY)
--vsx = viewSizeX
--vsy = viewSizeY
vsx, vsy,_,_ = Spring.GetWindowGeometry()
if (Spring.GetMiniMapDualScreen()=='left') then
vsx=vsx/2;
end
if (Spring.GetMiniMapDualScreen()=='right') then
vsx=vsx/2
end
if (depthTexture) then
glDeleteTexture(depthTexture)
end
if(type(vsx)~='number') then
-- Spring.Echo('not number:',vsy,'more:',vsy[2]);
else
depthTexture = glCreateTexture(vsx, vsy, {
format = GL_DEPTH_COMPONENT24,
min_filter = GL_NEAREST,
mag_filter = GL_NEAREST,
})
end
--end
if (depthTexture == nil) then
spEcho("Removing fog gadget, bad depth texture")
gadgetHandler:Removegadget()
return
end
end
gadget:ViewResize(glGetViewSizes())
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local vertSrc = [[
varying vec3 eyeDir;
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
eyeDir = gl_MultiTexCoord1.xyz;
gl_Position = ftransform();
}
]]
print ("dualfog vertex shader")
print (vertSrc)
--fogHeight=(GroundFogDefs["Height"])*(Spring.GetGameSeconds()%5+1)
--Spring.Echo(fogHeight)
local fragSrc = ''
fragSrc = fragSrc .. 'const float fogAtten = ' .. fogAtten .. ';'
fragSrc = fragSrc .. 'float fogHeight = ' .. fogHeight .. ';'
fragSrc = fragSrc .. 'const vec3 fogColor = vec3('
.. fogColor[1]..','..fogColor[2]..','..fogColor[3]..');'
fragSrc = fragSrc .. [[
uniform sampler2D tex0;
uniform float wp11;
uniform float wp15;
uniform vec3 eyePos;
varying vec3 eyeDir;
void main(void)
{
vec2 txcd = vec2(gl_TexCoord[0]);
float z = texture2D(tex0, txcd).x;
float d = wp15 / (((z * 2.0) - 1.0) + wp11);
vec3 toPoint = (d * eyeDir);
vec3 worldPos = eyePos + toPoint;
#ifdef DEBUG_GFX // world position debugging
const float k = 100.0;
vec3 debugColor = pow(2.0 * abs(0.5 - fract(worldPos / k)), 6.0);
gl_FragColor = vec4(debugColor, 1.0);
return; // BAIL
#endif
// fogHeight= 255*(time()%5);
float h0 = clamp(worldPos.y, 0.0, fogHeight);
float h1 = clamp(eyePos.y, 0.0, fogHeight); // FIXME: uniform ...
float attenFactor = 1.0 - (0.5 * (h0 + h1) / fogHeight);
float len = length(toPoint);
float dist = len * abs((h1 - h0) / toPoint.y); // div-by-zero prob?
float atten = clamp(1.0 - exp(-dist * attenFactor * fogAtten), 0.0, 1.0);
gl_FragColor = vec4(fogColor, atten);
return;
}
]]
if (debugGfx) then
fragSrc = '#define DEBUG_GFX 1\n' .. fragSrc
end
print('dualfog fragment shader:')
print(fragSrc)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function gadget:Initialize()
if (enabled==true) then
if (forceNonGLSL == false and Spring.GetMiniMapDualScreen()~='left') then
if (glCreateShader == nil) then
spEcho("Shaders not found, reverting to non-GLSL gadget")
GLSLRenderer = false
else
depthShader = glCreateShader({
vertex = vertSrc,
fragment = fragSrc,
uniformInt = {
tex0 = 0,
},
})
if (depthShader == nil) then
spEcho(glGetShaderLog())
spEcho("Bad shader, reverting to non-GLSL gadget.")
GLSLRenderer = false
else
uniformEyePos = glGetUniformLocation(depthShader, 'eyePos')
uniformWP11 = glGetUniformLocation(depthShader, 'wp11')
uniformWP15 = glGetUniformLocation(depthShader, 'wp15')
end
end
else
GLSLRenderer = false
end
if (GLSLRenderer == false) then
fog = glCreateList(DrawPlaneModel)
end
else
gadgetHandler:RemoveGadget()
end
end
function gadget:Shutdown()
if (GLSLRenderer == true) then
glDeleteTexture(depthTexture)
if (glDeleteShader) then
glDeleteShader(depthShader)
end
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Vector Math
--
local function cross(a, b)
return {
(a[2] * b[3]) - (a[3] * b[2]),
(a[3] * b[1]) - (a[1] * b[3]),
(a[1] * b[2]) - (a[2] * b[1])
}
end
local function dot(a, b)
return (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3])
end
local function normalize(a)
local len = math.sqrt((a[1] * a[1]) + (a[2] * a[2]) + (a[3] * a[3]))
if (len == 0.0) then
return a
end
a[1] = a[1] / len
a[2] = a[2] / len
a[3] = a[3] / len
return { a[1], a[2], a[3] }
end
local function scale(a, s)
a[1] = a[1] * s
a[2] = a[2] * s
a[3] = a[3] * s
return { a[1], a[2], a[3] }
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local worldProjection = {}
local worldModelview = {}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
if (worldPass) then
function gadget:DrawWorld()
if (GLSLRenderer == true) then
worldModelview = { glGetMatrixData(GL_MODELVIEW) }
worldProjection = { glGetMatrixData(GL_PROJECTION) }
DrawFog()
else
end
end
else
function gadget:DrawWorld()
if (GLSLRenderer == true) then
worldModelview = { glGetMatrixData(GL_MODELVIEW) }
worldProjection = { glGetMatrixData(GL_PROJECTION) }
--Spring.Echo(fogHeight)
else
Fog()
end
end
function gadget:DrawScreenEffects()
if (GLSLRenderer == true) then
DrawFog()
else
_, CurrentCameraY, _ = spGetCameraPosition()
if (CurrentCameraY < FogLowHeight) then
FogLow()
end
end
end
end
function DrawFog()
if (worldProjection == nil) then
return
end
local cpx, cpy, cpz = spGetCameraPosition()
local cv = spGetCameraVectors()
local f = cv.forward
local ts = cv.top
local bs = cv.bottom
local ls = cv.leftside
local rs = cv.rightside
local vtl = normalize(cross(ls, ts))
local vtr = normalize(cross(ts, rs))
local vbr = normalize(cross(rs, bs))
local vbl = normalize(cross(bs, ls))
local s = 1 / dot(normalize(f), vtl)
vtl = scale(vtl, s)
vtr = scale(vtr, s)
vbr = scale(vbr, s)
vbl = scale(vbl, s)
-- copy the depth buffer
glCopyToTexture(depthTexture, 0, 0, 0, 0, vsx, vsy)
-- setup the shader and its uniform values
glUseShader(depthShader)
cpy=cpy+10*(math.sin(time()/1)) + 30*(math.sin(time()/7.3))
-- Spring.Echo(cpy)
glUniform(uniformEyePos, cpx, cpy, cpz)
glUniform(uniformWP11, worldProjection[11])
glUniform(uniformWP15, worldProjection[15])
if (debugGfx) then
glBlending(GL_SRC_ALPHA, GL_ONE)
end
-- easy way to setup the vertex coords
glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity()
glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity()
-- render a full screen quad (could also use a tailored shape)
glTexture(depthTexture)
glBeginEnd(GL_QUADS, function()
glTexCoord(0, 0); glMultiTexCoord(1, vbl); glVertex(-1, -1);
glTexCoord(1, 0); glMultiTexCoord(1, vbr); glVertex( 1, -1);
glTexCoord(1, 1); glMultiTexCoord(1, vtr); glVertex( 1, 1);
glTexCoord(0, 1); glMultiTexCoord(1, vtl); glVertex(-1, 1);
-- glTexCoord(0, 0); glMultiTexCoord(1, vbl); glVertex( 0, 0);
-- glTexCoord(1, 0); glMultiTexCoord(1, vbr); glVertex(vsx, 0);
-- glTexCoord(1, 1); glMultiTexCoord(1, vtr); glVertex(vsx, vsy);
-- glTexCoord(0, 1); glMultiTexCoord(1, vtl); glVertex( 0, vsy);
end)
glTexture(false)
glMatrixMode(GL_PROJECTION); glPopMatrix()
glMatrixMode(GL_MODELVIEW); glPopMatrix()
glUseShader(0)
cpx, cpy, cpz = spGetCameraPosition()
if (debugGfx) then
glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
end
Last edited by MidKnight on 05 Sep 2009, 04:07, edited 1 time in total.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Kick ass! And that also means that the other stuff I'm working on will work, too, hehe...
I'll include that version of the fog Gadget in all future releases, thanks for pointing it out.
I'll include that version of the fog Gadget in all future releases, thanks for pointing it out.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Awesome!
PS: you may want to do some work on the raindrop colors. I'm thinking less alpha, darker colors. I'd do it myself, but I can't figure out which of the 3 configs in the createraindrops function does what.
PS: you may want to do some work on the raindrop colors. I'm thinking less alpha, darker colors. I'd do it myself, but I can't figure out which of the 3 configs in the createraindrops function does what.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Actually, that part's "hardcoded". I guess I should make it a "config" up at the top. Hold on while I do that.
Re: Rain / Snow / Dust etc., with cheap GLSL.
Here ya go. ColorFunc() gives you full control over the resulting rain colors and alpha values.
- Attachments
-
- precipitation_particles.lua
- (13.79 KiB) Downloaded 54 times
Re: Rain / Snow / Dust etc., with cheap GLSL.
i want wet units, when they come out of the water there should be a thin film of water
Re: Rain / Snow / Dust etc., with cheap GLSL.
WTF did you know ANY game who have this effect, maby its cool for ego-shooter, but here? i think this needs to much resources.i want wet units, when they come out of the water there should be a thin film of water
BUT i think Bumpmapping would be a win for Spring.
PS: @TS :this a big win for Spring!