Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (rki, AndrewAMD), 426 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Slin's Water Shader #179567
01/23/08 22:32
01/23/08 22:32
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hi guys, i've downloaded Slin's water shader>>

http://files.filefront.com/Water+for+Everyone/;8570332;/fileinfo.html

I have implemented it into my project and it works very well. The only addition i would like is that it is slightly transparent so i can see like the sea floor or rocks underneath the water plane/terrain.

I asked slin and he told me to add a couple of lines but they did not work and he said he has no more ideas.

I dont program shaders so does anyone know how to add transparency to the reflecting water shader?

Thanks.... DJB.

Last edited by DJBMASTER; 01/23/08 22:33.
Re: Slin's Water Shader [Re: DJBMASTER] #179568
01/23/08 23:12
01/23/08 23:12
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
post the shader script and ill try and tell you what to add and where

Re: Slin's Water Shader [Re: lostclimate] #179569
01/24/08 00:12
01/24/08 00:12
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
////////////////////////////////////////////////////////

matrix matMtl;

texture mtlSkin1;
texture mtlSkin2;

technique makewater2
{
pass p0
{
AlphaBlendEnable=false;
Zenable = True;
ZwriteEnable = True;

BlendOp=Add;
Lighting=True;

Texture[0] = <mtlSkin1>;
Texture[1] = <mtlSkin2>;

magFilter[0] = linear;
minFilter[0] = linear;
mipFilter[0] = linear;

COLOROP[0] = BumpEnvMap;
COLORARG1[0] = Texture;
COLORARG2[0] = Current;

TexCoordIndex[0] = 1;
TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;


magFilter[1] = Linear;
minFilter[1] = Linear;
mipFilter[1] = Linear;

AddressU[1] = Clamp;
AddressV[1] = Clamp;

ColorOp[1] = Modulate; //Modulate/AddSigned/Modulate2x/Modulate4x/Add <----------This looks all okay
ColorArg1[1] = Texture;
ColorArg2[1] = Current;

texcoordindex[1] = cameraspaceposition | 1; // For cubemap use: cameraspacereflectionvector
TextureTransformFlags[1] = count3 | projected;
TextureTransform[1] = {
0.8, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS!
0.0, 1.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS!
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
};
}
}

//technique fallback { pass p0 { } }

Re: Slin's Water Shader [Re: DJBMASTER] #179570
01/24/08 01:41
01/24/08 01:41
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Code:

matrix matMtl;

texture mtlSkin1;
texture mtlSkin2;

float4 AlphaX = {1.0, 1.0, 1.0, 0.5};
// change 0.5 to your alpha (0 - 1)

technique makewater2
{
pass p0
{
AlphaBlendEnable = true;
//AlphaTestEnable = true; // <-- you may need to add this
Zenable = True;
ZwriteEnable = True;

BlendOp=Add;
Lighting=True;

Texture[0] = <mtlSkin1>;
Texture[1] = <mtlSkin2>;

magFilter[0] = linear;
minFilter[0] = linear;
mipFilter[0] = linear;

COLOROP[0] = BumpEnvMap;
COLORARG1[0] = Texture;
COLORARG2[0] = Current;

TexCoordIndex[0] = 1;
TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;


magFilter[1] = Linear;
minFilter[1] = Linear;
mipFilter[1] = Linear;

AddressU[1] = Clamp;
AddressV[1] = Clamp;

ColorOp[1] = Modulate;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;

ColorOp[2] = Modulate;
ColorArg1[2] = AlphaX;
ColorArg2[2] = Current;

texcoordindex[1] = cameraspaceposition | 1;
cameraspacereflectionvector
TextureTransformFlags[1] = count3 | projected;
TextureTransform[1] = {
0.8, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS!
0.0, 1.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS!
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
};
}
}

//technique fallback { pass p0 { } }




xXxGuitar511
- Programmer
Re: Slin's Water Shader [Re: xXxGuitar511] #179571
01/24/08 02:24
01/24/08 02:24
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
@XxXGuitar511 > I added your code and un-commented the alphatestenabled=true and i get the following error...

Error in Effect:
mtl_ffpwater(51): error X3000: syntax error: unexpected token
'TextureTransformFlags'

it seems the TextureTransformFlags[1] = count3 | projected; is causing the error.

BTW is the terrain model supposed to have the transparency flag set?

Re: Slin's Water Shader [Re: DJBMASTER] #179572
01/24/08 09:35
01/24/08 09:35
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
remove the "cameraspacereflectionvector" right before the line you point out.

Re: Slin's Water Shader [Re: Steempipe] #179573
01/24/08 15:41
01/24/08 15:41
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Done that... now i get this error>>>

Error in effect:
Water_mat(56); ID3DXEffectCompiler: State 'COLORARG1' does not accept 'AlphaX' as a value. There was an error initializing the compiler.
ColorArg1[2] = AlphaX;

I have no idea what is going wrong, lol. Has anyone got this to work?

Last edited by DJBMASTER; 01/24/08 15:41.
Re: Slin's Water Shader [Re: DJBMASTER] #179574
01/24/08 20:06
01/24/08 20:06
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
...since I havn't tested it, that was probably my mistake. Try adding "<" ">" around AlphaX


xXxGuitar511
- Programmer
Re: Slin's Water Shader [Re: DJBMASTER] #179575
01/24/08 20:15
01/24/08 20:15
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
ColorArg does not accept a float, it's a DWORD value. I doubt that just simply adding < > or ( ) around the variable will clear up the error. You could try getting a value into the stage by using texturefactor... But this whole idea seems a bit faulty. I would be going at it by setting up alpha states and blending operations.

Did you try putting <my.transparent = on;> and <my.alpha = 50;> in your material to see if it serves you well enough?

Re: Slin's Water Shader [Re: Steempipe] #179576
01/24/08 22:14
01/24/08 22:14
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
placing <> around AlphaX just makes the water render as a black plane.

I have tried using >>

material mtl_ffpwater
{
skin1=waterbump;
event = mtl_ffpwater_event;
effect = "efx_water.fx";
my.transparent = on;
my.alpha=50;
}

But it doesnt accept transparent or alpha flags because it gives me errors when i run it.

I have tried adding transparent/translucent and alpha flags to the water action, view and material, but so far no look in making the water have alpha.
I am guessing the solution is to code it into the shader, but i am no good with programming shaders.

You mention alpha states and blending operations - i have no idea what these mean, lol.

Last edited by DJBMASTER; 01/24/08 22:15.
Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1