Re: [Algorithms] DotProduct3 bump-mapping question
Brought to you by:
vexxed72
From: Scott B. <Scott@Mad-FX.com> - 2001-03-06 03:23:17
|
Cool we seem to be on the same page. This clears things up nicely. I agree there are many flavors in doing this and I'll sit down and think hard on which will be better and which can eventually be done nicely with vertex shaders. > 3. Compute the uv gradient vectors for each triangle > 4. Sum the gradients at each vertex for every triangle that shares it. > (similar to calculating smooth normals) Do any of the NVidia sample or others do this? That's exactly what I was afraid I would have to do but I could never figure out if any of the samples where doing it. Thanks Even :) ----- Original Message ----- From: "Evan Hart" <eh...@at...> To: <gda...@li...> Sent: Monday, March 05, 2001 8:39 PM Subject: RE: [Algorithms] DotProduct3 bump-mapping question > Scott, > > Generally the way you deal with the problems I think you are concerned > about is by creating a tangent space across the surface. The tangent space > allows the normal map to have +Z (or whatever your convention is) point away > from the surface. To calculate tangent space for an arbitrarily mapped > surface do the following: > > 1. Create surface normals obeying any faceting rules. > 2. Seperate the vertices such that each has unique tex coords and normal > 3. Compute the uv gradient vectors for each triangle > 4. Sum the gradients at each vertex for every triangle that shares it. > (similar to calculating smooth normals) > 5. Possibly ortho-normalize the bases (don't change normal) > > Now, you have a normal, tangent, and binormal. When you bump map transform > the light vector at each vertex into the space defined by the normal, > tangent, and binormal. This vector is then interpolated across the surface > for the dp3 operation. You can use a cube map to deal with denormalization. > > There are many flavors of this whole process, and I do not profess to be an > expert on all of them. One twist, is that you use the process above to only > create the tangent in the direction of positive U (or V) and then cross it > with the normal to get the binormal. > > Finally, there is another uglier way to do this. If your texels are all > unique, you can map them all to object space rather than mapping the light > to surface space. > > Hope this helps. > > -Evan > > -----Original Message----- > From: Scott Bean [mailto:Scott@Mad-FX.com] > Sent: Monday, March 05, 2001 7:59 PM > To: gda...@li... > Subject: Re: [Algorithms] DotProduct3 bump-mapping question > > > > yeah, but you have to remember, all these calculations are being done in > > texture space. > > See akbar, unless I'm not following right, texture space is WARPED, if the > geometry is complex and the UV wrap is warped and reversed and all weird, > then there is no real texture space. And if you mean the light vector to be > rotated in the current vertice's UV coord. texture space, then how do you do > that... > > For example, would your bump mapping implementation work with a torus object > mapped properly and tiled say 8 times with a reversed(flip) wrap addressing > mode. See at each unit, the texture space is changed... this is what I'm > having problems with... > > > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > |