???
http://img140.imageshack.us/i/aproblem.png/
ATI X600XT.
Separately, assuming I even get this working:
* The plane is incorrect. I need to change the axis (rotate on X 90 degrees) How do I do this?
* I need to make the plane go from (0,0) to (sizex, sizey) instead of increase the size in all directions. How do I do this?
Thanks.
Blood & Water Effects [Irrlicht 1.7.1]
-
- Posts: 38
- Joined: Mon Jan 09, 2012 5:07 pm
Re: Blood & Water Effects [Irrlicht 1.7.1]
Hi together,
I would like to use this very promising water shader in my Project. Can anybody upload the OpenGL (GLSL) version of the water shader please? The file has been deleted on the original link and I can't find it anywhere else. Unfortunately it's also not contained in IrrExt.
Anyways this is a very nice work.
I would like to use this very promising water shader in my Project. Can anybody upload the OpenGL (GLSL) version of the water shader please? The file has been deleted on the original link and I can't find it anywhere else. Unfortunately it's also not contained in IrrExt.
Anyways this is a very nice work.
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Blood & Water Effects [Irrlicht 1.7.1]
whoah! this is really nice!
but what about transparecy? It looks too opaque in my eyes.... ^^*
but what about transparecy? It looks too opaque in my eyes.... ^^*
"this is not the bottleneck you are looking for"
-
- Competition winner
- Posts: 117
- Joined: Wed Jun 30, 2010 8:44 am
- Location: Portugal
- Contact:
Re: Blood & Water Effects [Irrlicht 1.7.1]
http://www.4shared.com/zip/ieIR7rmp/jorge.htmlSinsemilla wrote:... water shader in my Project. Can anybody upload the OpenGL (GLSL) version of the water shader...
Open first the included main.cpp file for more details. Hope this helps.
Re: Blood & Water Effects [Irrlicht 1.7.1]
water_vs.glsl
water_ps.glsl
Code: Select all
uniform mat4 mWorld;
uniform vec4 CamPos;
uniform float Time;
uniform float sinWave;
varying vec4 waterPos;
varying vec3 MultiVar;
varying vec3 worldView;
varying vec2 texCoords;
void main()
{
vec4 position=ftransform();
gl_Position=position;
waterPos=gl_Vertex*mWorld;
MultiVar.y=Time/10000.0;
if(sinWave>0.0) {
MultiVar.x=(sin((position.x/3.0)+(Time*10.0/10000.0)))+(cos((position.z/3.0)+(Time*10.0/10000.0)));
gl_Position.y+=MultiVar.x;
}
MultiVar.z=CamPos.y;
worldView=CamPos.xyz-(mWorld*gl_Vertex).xyz;
texCoords=(gl_MultiTexCoord0.xy+0.5)/2.0+vec2(MultiVar.y, MultiVar.y);
texCoords.x=texCoords.x+sin(MultiVar.x*5.0)*(5.0/1000.0);
texCoords.y=texCoords.y+cos(MultiVar.x*5.0)*(5.0/1000.0);
}
water_ps.glsl
Code: Select all
uniform mat4 mWorldViewProjP;
uniform float sinWaveP;
uniform float refractionP;
uniform float seaLevel;
uniform sampler2D ReflectionTexture;
uniform sampler2D NormalMap;
uniform sampler2D DUDVMap;
varying vec4 waterPos;
varying vec3 MultiVar;
varying vec3 worldView;
varying vec2 texCoords;
void main()
{
vec4 projCoord=mWorldViewProjP*waterPos;
projCoord.x=(projCoord.x/projCoord.w)/2.0+0.5;
projCoord.y=(projCoord.y/projCoord.w)/2.0+0.5;
if(sinWaveP>0.0) {
projCoord.x+=sin(MultiVar.x*5.0)*(2.0/1000.0);
projCoord.y+=cos(MultiVar.x*5.0)*(2.0/1000.0);
}
if(refractionP>0.0) {
vec4 DUDVoffset=texture2D(DUDVMap, texCoords);
projCoord.x+=(DUDVoffset.x/40.0)-(1.0/80.0);
projCoord.y+=(DUDVoffset.y/40.0)-(1.0/80.0);
}
projCoord=clamp(projCoord, 0.001, 0.999);
vec4 normal=vec4(0.0,1.0,0.0,0.0);
if (MultiVar.z < seaLevel)
{
projCoord.y=1.0-projCoord.y;
}
projCoord.y=projCoord.y*(-1.0);
vec4 refTex=texture2D(ReflectionTexture, projCoord.xy);
float facing=(1.0-max(dot(normalize(worldView), normalize(normal.xyz)), 0.0));
vec4 MultCol=vec4(0.4,0.7,1.0,0.0);
refTex=(refTex+vec4(0.0,0.0,0.1,0.0))*MultCol;
vec4 norMap=texture2D(NormalMap, texCoords);
float lightComp=1.0-max(dot(normalize(norMap.xyz), normalize(abs(worldView))),0.0);
vec4 finalCol=refTex;
if(MultiVar.z<seaLevel) finalCol*=0.8;
finalCol.a=0.6+(facing/2.0);
finalCol+=lightComp;
gl_FragColor=finalCol;
}
-
- Posts: 38
- Joined: Mon Jan 09, 2012 5:07 pm
Re: Blood & Water Effects [Irrlicht 1.7.1]
@jorgerosa: Thx for the link , i managed to download your code after a few more or less random clicks on that page (what language is this? ).
However, your main.cpp is unfotunately empty :
Anyways, your code looks very interesting, i will have to study it a while.
@smso: Thx to you also.
However, your main.cpp is unfotunately empty :
Code: Select all
#include <irrlicht.h> // Declare Irrlicht
#include "CWaterSurface.h" // For ocean effects.
#include "CWaterShader.h" // For ocean effects.
// #include "CBloodEffect.h"
// #include "CBloodShader.h"
/// RESULT:
/// http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=39624&p=232219#p232219
int main(char ** args)
{
}
@smso: Thx to you also.
Re: Blood & Water Effects [Irrlicht 1.7.1]
for Irrlicht 1.8.0-alpha
modify CBloodShader::createMaterial
from
to
modify CBloodShader::createMaterial
from
Code: Select all
matBlood = gpu->addHighLevelShaderMaterialFromFiles
(
matBloodShader, "vertexMain", EVST_VS_2_0,
matBloodShader, "pixelMain", EPST_PS_2_0,
this, EMT_TRANSPARENT_ALPHA_CHANNEL
);
Code: Select all
matBlood = gpu->addHighLevelShaderMaterialFromFiles
(
matBloodShader, "vertexMain", EVST_VS_2_0,
matBloodShader, "pixelMain", EPST_PS_2_0,
this, EMT_TRANSPARENT_ALPHA_CHANNEL_REF
);