I was trying to find a guidance for this functionality but I didn't find anything what would provide an answer.
I am trying to create a 3D model, which would have a "pedestal" similar to a chess piece and a simple plane on top of it.
Such model would be placed in 3D space and the plane would "roll" according to the angle to camera. Basically the lower part of the plane would keep its vertices' positions and the top two vertices would change its location so the texture/plane would always faces the camera directly (the texture would not be skewed).
I know that I need to use a vertex shader to modify the vertices positions but I cannot figure out how. Did anyone try to solve similar functionality?
Thank you for any advice.
Having a simple plane always facing camera
-
- Gnome
- Posts: 368
- Joined: Tue Jan 06, 2009 1:12 pm
- x 43
-
- OGRE Team Member
- Posts: 2108
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1134
-
- Gnome
- Posts: 368
- Joined: Tue Jan 06, 2009 1:12 pm
- x 43
Re: Having a simple plane always facing camera
Hello paroj,
I am familiar with billboards, yet I haven't really used them (except for particles).
I understood from your reply that it is probably a very beginner's question (since you posted just a link) but I am still not sure what exactly do you recommend.
Wouldn't it be better to just correctly set the position of the two upmost vertices in the vertex shader?
I am familiar with billboards, yet I haven't really used them (except for particles).
I understood from your reply that it is probably a very beginner's question (since you posted just a link) but I am still not sure what exactly do you recommend.
Wouldn't it be better to just correctly set the position of the two upmost vertices in the vertex shader?
-
- OGRE Team Member
- Posts: 2108
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1134
Re: Having a simple plane always facing camera
it doesnt really matter where you change the vertices. Its just that Ogre already provides the functionality that you need (as linked).
-
- Bronze Sponsor
- Posts: 480
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 167
Re: Having a simple plane always facing camera
The problem with a billboard is that it faces the camera at all times and I think that @kubatp needs something a bit more sophisticated.
If I were to do this, my approach would be to have the plane on the pedestal change its orientation according to the position of the camera relative to the pedestal/plane setup.
So you should have a vector v = (camera - pedestal), proyect that vector onto the xz plane and then you have a direction to set for the plane on the pedestal.
Of course I am assuming here that the plane can only move in y axis, but that is how I am imagining the situation.
Correct me if I am mistaken.
If I were to do this, my approach would be to have the plane on the pedestal change its orientation according to the position of the camera relative to the pedestal/plane setup.
So you should have a vector v = (camera - pedestal), proyect that vector onto the xz plane and then you have a direction to set for the plane on the pedestal.
Of course I am assuming here that the plane can only move in y axis, but that is how I am imagining the situation.
Correct me if I am mistaken.