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.
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
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.
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 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...
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
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.
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.