## Skybox rotation Topic is solved

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
TaaTT4
OGRE Contributor
Posts: 203
Joined: Wed Apr 23, 2014 3:49 pm
x 30

### Skybox rotation

To render the skybox, I use the same technique that OGRE uses in its sample Sample_TutorialSky_Postprocess. As the title says, I'm wondering if there's an easy way to apply a rotation (to make things simpler: just a yaw around the world y axis) to the skybox.
I know I can simply apply a counter-rotation to the objects, but doing this creates a mess with the AABB visualization.
Senior game programmer at Vae Victis
Working on Racecraft

xrgo
OGRE Expert User
Posts: 1093
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 152

### Re: Skybox rotation

should be something like this (SkyPostprocess_vs.glsl):

Code: Select all

``````    outVs.cameraDir.xyz = normal.xyz;

float radian = 3.14; //whatever, maybe pass through uniform
mat2 m = mat2(c, -s, s, c);

dark_sylinc
OGRE Team Member
Posts: 4189
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 794
Contact:

### Re: Skybox rotation

If you want an arbitrary rotation, convert the quaternion to a Matrix3 and then send it to the shader:

Code: Select all

``````uniform float3x3 rotation;
....
//GLSL
//HLSL
I don't know if you need to swap the multiplication order though (i.e. try float3 * float3x3 if float3x3 * float3 doesn't work as intended or rotates in the opposite direction).

xrgo's answer works on rotating with 2 axes by using a float2x2, instead of 3 axis; but is basically the same concept.

TaaTT4
OGRE Contributor
Posts: 203
Joined: Wed Apr 23, 2014 3:49 pm
x 30

### Re: Skybox rotation

dark_sylinc wrote:
Mon Mar 04, 2019 8:43 pm
If you want an arbitrary rotation, convert the quaternion to a Matrix3 and then send it to the shader:

Code: Select all

``````uniform float3x3 rotation;
....
//GLSL