Question about BillboardRotationType

Problems building or running the engine, queries about how to use features etc.
Post Reply
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Question about BillboardRotationType

Post by Niubbo »

Ogre Version: 1.12.8
Operating System: Win10
Render System: dx9

I have a question about the concept of rotation type applied to the billboards, due to my lack of knowledge about how the concept of vertex\texture works.

In a billboardset you can set the rotation type or based on the vertex rotation or texture rotation.

Abou the vertex rotation the concept is clear to me (or at least I think), the vertex is a point in the space, so the spatial coordinates of vertex to new coordinates facing the camera.

Is no clear to me what happen with the rotation of texture coordinates: as far I understood the texture coordinates represent the coordinate UV over the texture bidimensional image. How they can generate a rotation effect?

Is there any document explaining the concept?

In the API documentation the negative effect of texture rotations are described, is no clear to me what is the negative side of vertex rotation. Performance?


Thanks
User avatar
suny
Greenskin
Posts: 137
Joined: Thu Mar 12, 2020 5:53 pm
x 60

Re: Question about BillboardRotationType

Post by suny »

You can rotate your UVs, and the result will be a rotated projection of the textures to the quad.
So the quad stays aligned with the view, but the texture itself is rotated (as "projected" with a rotation) to the quad.
(There is one UV coordinate per vertex, and the result is interpolated between them. So each UV will point each vertex to a part of the texture. If your vertices UV point to the texture corners BCDA instead of ABCD, the result is a 90-degree rotation of the picture)

The issue can be a cropping of the image on the quad corners if the image goes too far on the borders of the texture.

The negative effect of the vertex rotation is performance, as the 4 vertices must be rotated with a transform matrix.
S.
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Question about BillboardRotationType

Post by Niubbo »

Thanks Suny, I understand the example you did, is less clear to me how this works in the case of billboard when this last rotate to face always the camera but showing always the frontal image; in this case, it seems to me, the texture corners ABCD remains the same, no change of UV spot
User avatar
suny
Greenskin
Posts: 137
Joined: Thu Mar 12, 2020 5:53 pm
x 60

Re: Question about BillboardRotationType

Post by suny »

If the quad is always facing the camera with its vertices A and B on top, and C and D at the bottom, and its UVs are changing, the texture mapping will change the ordering of the texture pixels in relation to the vertices.
So the geometry doesn't rotate, but the texels do, resulting in a picture rotation (because the polygons are "reading" the texture in diagonal)
S.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Question about BillboardRotationType

Post by dark_sylinc »

This video should make it obvious what UV rotation means:

Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Question about BillboardRotationType

Post by Niubbo »

thanks you both, understood.
Post Reply