Re: [Algorithms] Scaling Models
Brought to you by:
vexxed72
From: Tom H. <to...@3d...> - 2000-07-29 21:26:10
|
At 04:57 AM 7/29/2000 +0000, you wrote: >It is a very good question what the API does when the modelview matrix >contains scaling, uniform or non-uniform. If it applies the modelview >matrix (except the translation) to normals when the modelview matrix >contains non-uniform scaling, it is incorrect. Does it detect when >the linear part of the modelview matrix is non-orthogonal, and do the >right thing? That would be very expensive. Or it could just do the >transpose(inverse(L)) routine to transform normals in all cases? That >would be very wasteful in the majority of cases that the app uses only >orthogonal linear parts of the model and view transformations. The transpose(inverse) for normals slipped my mind. Oops. OpenGL does do the transpose(inverse) of course. The transpose(inverse) operation only needs to be performed once when the matrix is loaded, and only if the API has state currently enabled that uses normals (directional lighting or spherical environment mapping). If these states are enabled after the fact, the matrix can be created when the state changes. In the case where it needs to do the computation, whether or not it checks for linearity depends on the expense of the check I guess. The driver writers are usually pretty good at doing minimal amounts of work to speed things up as best they can. Tom |