Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smart normal matrix calculation #82

Open
sinisterchipmunk opened this issue Mar 10, 2013 · 0 comments
Open

smart normal matrix calculation #82

sinisterchipmunk opened this issue Mar 10, 2013 · 0 comments

Comments

@sinisterchipmunk
Copy link
Owner

Currently, all normal matrices in Jax are calculated with code such as:

mat4.invert imv, modelview
mat3.fromMat4 normal, imv
mat3.transpose normal, normal

This is correct. However, it's also costly. Would it be worthwhile to have Jax check the normal object for a flag such as orthonormal? If true, the normal matrix would be calculated simply by taking the upper 3x3 of modelview; and imv could be calculated by simply taking the transpose of modelview. If the property is false or nonexistent, the slower but safer method is used.

Jax could then manage this flag internally with wrapper classes such as Jax.Camera. The flag has to be explicitly set: if not set by Jax or by the developer (in the off chance that they're directly calculating their own matrices), the slower, more correct version would be used.

Need to investigate whether this is a good idea at all; whether it is architecturally viable; and what, if any, performance gains can be had from this approach. Bonus points for benchmarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant