2
\$\begingroup\$

(First of all, I really didn't know how to title my question so it tells exactly what I mean so if anyone has a better title feel free to edit my question or leave a comment.)

Look at the water in the screen:

enter image description here

See all the annoying white pixels? That's the specular. It looks nice up close:

enter image description here

But when I move the camera away from water it starts to look bad. Actually, the same problem occurs elsewhere (e.g. with grass or rocks) but it's not as bad as with the specular.

I think I know why it looks the way it does but I don't know how to make it look better, more smooth, something like this:

enter image description here

Well, blur helps but blur is an expensive post-process and it's not the way I want to do it.

How can I make it look better, less pixelated and more natural?

Edit: I mentioned that I have the problem with e.g. grass. The grass' shader only uses a texture. The water's shader, however, uses normal mapping and based on the mapped normal it calculates light's specular component.

Update: Following Tording's advice I've used NVIDIA DDS plugin to generate mipmapped normal map DDS file and I've used that instead in my project. Although I'm not sure if I prefer the result to the previous one:

enter image description here

I realize that my normalmap texture and/or my water shading technique might be to blame, though. :P But my point is - using mipmapping might solve my problem (a lot of sharp pixels/noise) but it also introduces new problems.

\$\endgroup\$
  • \$\begingroup\$ Why does your water look like aluminum foil? \$\endgroup\$ – Panda Pajama May 19 '14 at 8:39
  • \$\begingroup\$ I have no idea how you're rendering your water, but I don't think the problem is with smoothing. Take a look at this picture: noaa.gov/features/monitoring_0209/images/aerial.jpg Notice that the direct sun reflection is not applied to all of the water, but just the parts that would reflect the sun if it were a mirror. \$\endgroup\$ – Panda Pajama May 19 '14 at 8:43
  • \$\begingroup\$ That's because I'm using directional light instead of a point one. I'm aware of that and my question isn't addressing that problem. It's addressing the way the specular reflections look from distance. \$\endgroup\$ – NPS May 19 '14 at 8:52
  • \$\begingroup\$ This late image looks alot more like what i expect to see. you can now start to see the tiling pattern and also the texture pattern. \$\endgroup\$ – Tordin May 25 '14 at 16:45
  • \$\begingroup\$ The pattern is something that shouldn't be noticable (ideally). Any way to make it less apparent? \$\endgroup\$ – NPS May 25 '14 at 19:48
6
\$\begingroup\$

This is called mipmaping, It looks like you are missing out on mipmaping for your textures. this causes a huge impact on visuals. And when it comes to mipmaping Normals, Specular and other "information" textures, it gets quite tricky.

the reason for this is that when objects gets further away, the gpu has to take this into account and calculate the corresponding texel. So, in practice, it will start skipping bigger pieces of your huge texture because it cant map it to the relative size. The mipmap is the solution to this since the gpu then knows how to handle those faraway pixels since it got a down scaled version of your texture. And now the problem of having textures with information ( Like normals ) is that, when you are scaling down, you are effectively averaging the values of four neighboring pixels. which can cause incorrect values for normals for example. For plain color it´s okay, but not with information.

My best experiance with this has been to use the DDS plugin for Photoshop that nvidia have made. it´s fully free and REALLY efficient.

This is the link to DDS plugin

Other than that, you could create some sort of distance function to your shader that knows when you are further away to take a bigger sample area of your water plane.

here is an link that you can read about mipmaps on wiki, it´s really good explaining on whats going on. MIPMAPING wiki link

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Grass is just a texture in my app, specular obviously isn't a texture at all, so I assume mipmaps apply only to the former? As for "take a bigger sample" you mean some sort of blur effect (instead of calculating the colour of one pixel take an average of a few pixels)? \$\endgroup\$ – NPS May 19 '14 at 8:09
  • \$\begingroup\$ Actually, the grass has the same effect as the water, is just less visible beacuse it has a lower intensive value. How have you actually made the water? \$\endgroup\$ – Tordin May 19 '14 at 8:17
  • \$\begingroup\$ See the edit to my question. Also - is DDS an alternative to generating mipmaps by e.g. DirectX? \$\endgroup\$ – NPS May 19 '14 at 8:23
  • \$\begingroup\$ Yes, it is. You can probably find any different source of mipmap generator if you googel around on it. \$\endgroup\$ – Tordin May 19 '14 at 9:44
  • \$\begingroup\$ Actually, a good debug thing is just to render the specular texture on the water to actually see whats happening. you will se that those white spots are coming from a downscaling sampling pattern. \$\endgroup\$ – Tordin May 19 '14 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.