Advertisement

Deforming normals on Sphere?

Started by February 12, 2003 03:45 AM
7 comments, last by laeuchli 22 years ago
Dear All, I have generated a sphere, using a parametric equations, and obtained normals for it. However, for each vertex of the sphere, I deform it along the normal by some random value: Sphere.xyz*=Deform; of course, then the normals are no longer correct. Is there anyway to deform the normals? The only way I can think of is to generate the correct normal by getting the T an B tangent vectors and then crossing them. You''d think this would be easy, as it''s a parametric shape, but the function I''m deforming the sphere by doesn''t have a derviate(at least not one usable in this situations). Jesse
Just multiply the normals by the deform factor , basically is just as you were ''deforming'' a sphere to an ellipsoid.

Advertisement
I''m not sure that will work :-(. For example, take the sphere point 1,1,1. I displace it up 2 by 1*2,1*2,1*2. If I do the same thing to the normal, once I normalize the normal, I will be right back where I started(1,1,1). Maybe I''m missing something?
The normal of the displaced vertex will actualy be the same in your example. But the normals of neighbouring vertices should be
different but they will stay the same. So only affecting the normal of the deformed vertex is not enough.
And what about recomputing the normals ?
well, sadly recomputing the vertexes isn''t really possible, as I''m doing this on a vertex program, and I''m already out of instructions. As I see it, to recomputer the normals, I need to know at least the four points by the normal, which means I need 4 times the intructions. Either that, or a I need a very rough approximations for the derivate of a hybrid multifractal function :-). I guess I''m out of luck on current hardware, but oh well, it still looks pretty good...
Jesse
A vertex shader...hmmm...I saw an NV example of vertex shader - a walking alien. Vertex deformations using bones. I''m not sure,
but i think there was also lighting, so i think they computed the
normals somehow.
Advertisement
Some of your normals will be rotated, of course, when you deform the sphere. Are you using pixel shaders too? If so, you could possibly generate a bump map based on the same random displacements, and use the bump map to simulate the deformation of the normals per pixel.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
I thought of that, but I think I still have a problem then. To make that solution work, I need to generate tangent space. Thats easy enough for the base sphere using the partial derivatives, but when I deform the sphere, don''t I need to change my tangent space? The function I''m deforming my sphere don''t have a derivative that I could use...
So I guess I''m out of luck? Oh well, still looks pretty good without deforming the normals too, but would have looked better. Guess I''m waiting on a Geforce6 then :-)...

Jesse

This topic is closed to new replies.

Advertisement