Jump to content
  • Advertisement
Sign in to follow this  
Hseptic

Using partial derivatives to light circular waves

This topic is 2203 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You could always create a Google Code account, create a new project, then put the ZIP file in your Downloads. Lots of space.

Share this post


Link to post
Share on other sites
Advertisement
I succeeded in downloading your program, but I'm unable to run (I suggest to link with the static libraries or distribute the required dlls..) and compile it since I do not have Visual Studio on this PC. I will try on the other computer later. Can you modify your shader to show the normals as color and post an image? It may help understanding if the error is in the normal generation or somewhere else.

Share this post


Link to post
Share on other sites
How do I link the libraries or distribute the dlls, and get them to you? Also, how to I make the normals visible and colorize them?

Share this post


Link to post
Share on other sites
You can change the project settings to use static libraries instead of dynamic ones (dlls). To show the normals as color you can simply return the normal in the pixel shader, i.e.

return float4(normalW, 1.0);

Share this post


Link to post
Share on other sites
I have successfully tried your program in another computer. The strange effect is clearly given by the normals. The strange pattern is indeed also visible when showing the normals instead of the result of the light calculation. If we limit the calculation to a single sine wave*, the normals and lighting seem correct. The math formulation is also correct. Thus, I think the strange effect is actually correct in general and the pattern is probably motivated by the interaction of the different waves at different amplitudes, angular velocities and phases.

When you calculate the y-component of the position you are using only two waves instead of three as in the derivative.

* I suggest to see the second and third waves in isolation. These waves clearly follows the pattern you are seeing. The number of vertices is probably too low to show the correct result. You can try to use more polygons or implement some form of displacement mapping. Edited by apatriarca

Share this post


Link to post
Share on other sites
An artifact from using higher wave numbers than can be represented by the mesh perhaps?

Share this post


Link to post
Share on other sites
You are right, it isn't isotropic but the vertices aren't arranged in a circular fashion and the light "agree" with the geometry (look at the border of the mesh for example). I think that may motivate the non-isotropic behaviour.

Share this post


Link to post
Share on other sites
I realize this. I'm merely using the basic sample that comes with the D3D SDK to compare. It still looks like crap, but at least it's isotropic crap.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!