replacing bump maps in real time

Hi!

I am trying to do a simple animated river water texture, but for the fun of it, I decided to do my own. I decided to try Perlin Noise in my case. So I started by doing a really simple thing: combining the fractalTexture script from the Procedural examples with the included simple water shader. At each timestep of the fractalTexture script, I recalculate the bump map of the associated simple water shader. This looks like this:

function Start ()
{
	texture = new Texture2D(width, height, TextureFormat.RGB24, false);
	//renderer.material.mainTexture = texture; // just replaced this line with the one below
	renderer.material.SetTexture("_BumpMap", texture);
}

All the rest stays the same as in the Procedural/FractalTexture example. This also works fine, but only from one side…
Looking at it from one side I see the animated water. Turning around and looking at the very same spot from the other side, I see just a flat blue plane…
This seems to be rather curious. Might it be because I just use the plain grayscale image as the input for bumpmap (in the GUI I have to “generate Bumpmap” first)? I am a bit lost here (already…).

Later on of course I want to move the normal map generation down to the shader (analogouse to Perlin’s implementation in GPU Gems2), but just going step by step (I am new to water shaders).

Just a side question: I saw the impressive examples from the ocean shader. Refractions are only possible with Unity Pro, isn’t it?

Thanks,
Gabriel

Input for the bumpmap? I thought you create the bumpmap with the fractalTexture script and apply it with the texture like this

renderer.material.SetTexture("_BumpMap", texture);

You don’t need to set an bumpmap texture for the shader in the editor.

If you use a regular texture and disable the fractalTexture script you plane looks good from both sides … i.e. without animation but with bump?

Yepp, pro only. :frowning:
But with a good cubemap you could fake quiet a lot. :wink:

sorry for my bad explanation, what you say above is exactely what I do.

I tested it and with a normal bump map applied to the materiel and no script applied I get a fine bumpy surface viewable from all sides.

Applying the script FractalTexture again, I get the animated bumpmap when viewed from one side and a flat blue surface when viewing (the exact same spot) from the other side.
Also when I place my player camera perpendicular to the two directions I mentioned above, I’ll see to my left animated waves, to my right flat blue surface. As I move along to the right side, the animated waves “magically” apear on my left side view and just the same spots that were flat blue surfaces seconds before…

Do I have to make some tweaks to my camera object?[/quote]

Strange thing…
The texture calculation should not depend on the player camera. So I guess it’s something else.

You could check your cameras clipping settings, but I don’t think that’s the answer. Sure you don’t have a second plane clipping through or something like that?

What does the generated normal map look like? Could you post the image that is output by the fractal script? I suspect that it is not normalized, and that all the normals are pointing in a weird direction.