IRR|Cinema studio: some water for the thirsty

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
esaptonor
Posts: 145
Joined: Sat May 06, 2006 11:59 pm

Re: Water shader test

Post by esaptonor »

omaremad wrote:but this little demo shows the looks side of the water.
hmm...certainly looks cool, but it doesn't look like water yet :wink:

i assume the projection code and animations will make it look like water.
keep up the cool work!
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Image

Ok i refined the water a bit but the projection still doesnt scale :(

If duesxl come over here can you please exploare this with me, the projection is really annoying me now.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Post by JPulham »

Question. I thought of writing a water shader, but I don't know much GLSL (if any :? ). Can you get the current depth value before setting it? then you can have :
a) displacement mapping... so geometry does/doesn't overlap in shallow areas.
b) (the main point) fog! so the currdepth - lastdepth (or depth of water) multiplied by a fog constant to get a blend amount for the fog color.

Just an idea... could look good :roll:
pushpork
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

wow, nm
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

omaremad wrote:Ok i refined the water a bit but the projection still doesnt scale :(

If duesxl come over here can you please exploare this with me, the projection is really annoying me now.
Just coming around, I'm wondering if you did not forget to divide the position of the water vertex by its normal.
In my shader, it's this line :
"vec4 projCoord = waterpos / waterpos.w;"

BTW for everyone : I made a fully fonctionnal Water Scene Node (with both DirectX HLSL and OpenGL GLSL now) for my wrapper with C#. I had quite a lot of people who required a C++ conversion but I really don't have the time at all to do it so if anyone has the courage (it's not a huge stuff at all), I think everyone would be quite interested.
Here is the new code with the HLSL shader included :
http://irrlichtnetcp.svn.sourceforge.ne ... iew=markup

Here's a screenshot (click to maximize) :
Image
and an example (require .NET 2 on Windows or Mono 1.16+ on Linux) :
http://deusxl.free.fr/waterparallaxppx.zip

Hope it helps.
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

@DeusXL: Nice! I'll take a look at converting this to C++.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

I'm almost done with the conversion. 8)

One thing I can't find a comparison for is "Color.TransparentGray" and "Color.Grey". It doesn't seem that they are constants defined in the C++ flavor of Irrlicht.

Anyone know where this is defined? I just need the values. I even grep'd the Irrlicht .NET source with no luck...

I assume TransparentGray is RGBA(0.5,0.5,0.5,0) and Gray is RGBA(0.5,0.5,0.5,1.0) but I'd like to know for sure.
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

Great :!:

Here are listed all colors you need :
http://irrlichtnetcp.svn.sourceforge.ne ... iew=markup
Of course, you need to divide values by 255.0f.
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

DeusXL wrote:Great :!:

Here are listed all colors you need :
http://irrlichtnetcp.svn.sourceforge.ne ... iew=markup
Of course, you need to divide values by 255.0f.
Thanks. :D

I'll use the c8 colour functions, I can then use the ARGB values as ints as-per the code in your link. 8)

Once I get it working I'll look at adding Fresnel and fixing the reflections - they don't look quite right... :?
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Im using asm but texproj2D or its asm opcode TXP do the W divide automatically. Ill check if using a Normal tex divided by w would work, but the single opcode does the same thing.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Nope no diffrence :(
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

omaremad wrote:It is possible to do the physics completely on the gpu but i need results from the previous cycle, this can only be done via a vertex texture lookup where results from a vertex/ pixel shadera are stored for futre use but that needs a geforce 6XXXX card
Use two textures. Blit one to sysmem while the other is being rendered to...
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

For your technique i'd have to have an extra physics colour pass, then id have to render that to a render target, then read each pixel using the cpu then transform that to height values and normals. That is slower than 100% cpu.

Its either 100 gpu or 100 cpu im afraid (100% gpu requires vertex texture fetch)
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

DeusXL wrote:
omaremad wrote:Ok i refined the water a bit but the projection still doesnt scale :(

If duesxl come over here can you please exploare this with me, the projection is really annoying me now.
Just coming around, I'm wondering if you did not forget to divide the position of the water vertex by its normal.
In my shader, it's this line :
"vec4 projCoord = waterpos / waterpos.w;"

BTW for everyone : I made a fully fonctionnal Water Scene Node (with both DirectX HLSL and OpenGL GLSL now) for my wrapper with C#. I had quite a lot of people who required a C++ conversion but I really don't have the time at all to do it so if anyone has the courage (it's not a huge stuff at all), I think everyone would be quite interested.
Here is the new code with the HLSL shader included :
http://irrlichtnetcp.svn.sourceforge.ne ... iew=markup

Hope it helps.
OK, got this working in C++. Just got to fix the reflections and then I'll post the code. 8)
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

I've converted DeusXL's code to C++. Looks good, but the textures for the Castle 3ds mesh is not being picked up by the mesh loader - may be a bug in C++ irrlicht.

Anyway, I'll post the code over in the Code Snippets forum so people can look at it whilst I track down the loader issue. There's a C++ class for reflected water (so its easily reusable) and the converted demo.
Post Reply