Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Search
Login
Register
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Normal matrix
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Normal matrix (Read 2416 times)
Shot
byte
Posts: 7
Normal matrix
«
on:
July 27, 2013, 09:18:49 pm »
Is there a way to send a normal matrix (transpose of inverse of model view matrix) to shader for every object in a scene?
«
Last Edit: July 27, 2013, 10:01:42 pm by Shot
»
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Normal matrix
«
Reply #1 on:
July 27, 2013, 10:00:09 pm »
You don't have to. I think the source of the shaders in the HelloShader example show what to do instead.
Logged
Shot
byte
Posts: 7
Re: Normal matrix
«
Reply #2 on:
July 27, 2013, 10:06:28 pm »
Yep, I saw it, but imho it's not correct because after this operation normal may not be prependicular to its' surface. See this explanation:
http://www.lighthouse3d.com/tutorials/glsl-tutorial/the-normal-matrix/
Logged
Thomas.
double
Posts: 833
Re: Normal matrix
«
Reply #3 on:
July 28, 2013, 11:01:12 am »
Calculation normals from modelViewMatrix is faster and for orthogonal transformations it is fine (transpose and invert is about O(300))
Logged
My game for Android
,
Physics example
,
Texture assistant
Shot
byte
Posts: 7
Re: Normal matrix
«
Reply #4 on:
July 28, 2013, 11:16:03 am »
I see, but what about non-orthogonal transformations? Is it a proper way of thinking: orthogonal camera == orthogonal transformations and perspective camera == non-orthogonal transformations?
Logged
Thomas.
double
Posts: 833
Re: Normal matrix
«
Reply #5 on:
July 28, 2013, 06:20:36 pm »
No, non orthogonal transformation is for example scale in
x
axis
Logged
My game for Android
,
Physics example
,
Texture assistant
Print
Pages: [
1
]
Go Up
« previous
next »
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Normal matrix