I’ve written a simple water shader that holds two textures
one diffuse
one that’s responsible to get a wavy distortion.
The calculations work great and the water distorts exactly like I want to.
Now my problem is the lighting. I use the subpass “Diffuse/PPL” and this renders the diffuse texture on top without distortion so that it seems like I have two layers of water.
Here’s a screenshot with and without pixel lighting:
You’ll have to write your own, modified version of Diffuse/PPL if you want it to do the same distortion as your base pass. The source code is available in a sticky thread at the top of this forum.
Damn, I already did that and the only reason why it didn’t worked was that I needed two tex2D reads and so the shader fell back to VertexLit because I didn’t forced SM3.0.
I think there’s no way around to use a lower shader model since I need the two texture reads, or is it?
I’ve got a shader I wrote with nine texture samples from the same texture, so I think the only reason for SM3 would be because your second read is dependent on the results of your first. I thought that was possible in SM2, but perhaps I’m wrong.
Even in ATIs broken world of shader standards (they ignore what they don’t like), up to 4 chained texture lookups should work.
Chances are that it does not work in your case due to the cg generated dx shader that goes overboard with the texture registers (using new temp registers instead of reusing the old one, really going up to 9 textures instead of remaining on 2) which would break the SM2 part