#### Archived

This topic is now archived and is closed to further replies.

# Voxel x,z tricky rotation

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Do you guys know how to make a tricky rotation around x,z axis? the most I have found about: " Z-rotation Three alternatives here. You can ''shear'' the landscape. This looks good when you rotate max 30 degrees around the Z axis. It does not work well if you rotate more than 45 degrees. It is done by adding "shearXfactor*(x-(scrwidth/2))" to the Y-coord after perspective projection, where shearXfactor = sin(Zangle). If you want to be able to do full 360 degree rotations around the Z axis, you must either draw non-vertical lines or split the process into two parts, where the first part draws the landscape without Z-rotation, and the second part is a zoomrotator that rotates the newly generated picture around the Z axis. X-rotation This is the hardest effect of all. When you rotate around the X axis, the vertical stripes on screen should not remain vertical anymore. (Draw some vertical lines on a piece of paper and check what happens when you rotate the paper around the X axis, then you will see what I mean.) They should not even remain lines! (Perspective effects make them wider at the end that''s closer to the eye... argh ) The only sensible approximation I know of is ''shearing'' the landscape in Z direction. It is done by adding "shearZfactor*Z" to the Y-coord before perspective projection, where shearZfactor = sin(Xangle). " do you know alternatives? some code? what''s the best method? Did you see weather maps in TV? some come with a bird vision (from the sky but with a slope).The matter, I need to represent the landscape(world map with "voxels") with more angle (about +45º) in the X axis (just the worst results angle because we are faking the rotation with the formulas above), else, we couldnt see the far countries in the landscape (nearest mountains cover the rest)and this is the rule in a weather map.maybe precalculated X rotation and not allowing to rotate X more? some ideas please!.

##### Share on other sites
If you post some code, where you have problems, maybe we can help you.

##### Share on other sites
Excuse me if I'm wrong with my enwlis, but is not about code.I want to make a voxel engine but with a different point of view, imagine you want to represent geographic world data to help students learn about where rivers and mountains are in its country.If a get the normal point of view of voxel worlds, we aren't going to see nothing special about the geography (this pov is good to play games), I'll try to draw the pov I'm referring to:
      +        +       Z-axis +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++      +                                                      +                              ----x           Y-axis                     ------------x x             +            --------------------x   x      +   ----------------------------x     x     POV-----------------------------x       x        +   --------------------------x         x                    +          -------------- xx             x GROUND       xxxxxxxxxx----xxx                xxxxxxx            xxx      xxxxxxxx                     xxxxxxxx xxxxxxxxxx                                             xxxxxx  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxthe POV that I want:      +        +       Z-axis +++  POV---- +++++++++++++++++++++++++++++++++++++++++++++++++      +  ---------                                                    +   -------------                                          Y-axis    ----------------                                           +      ------------------                                       +        --------------------                                   +         ------------------------                              +           ------------------xxxx---                           +            ------------- xx      x----                   GROUND       xxxxxxx-------xxx            xxxxxxx            xxx      xxx----x                     xxxxxxxx xxxxxxxxxx                                             xxxxxx  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Z-axis and X-axis represent the map, in 3d Z represent deep, X is horizontally and Y vertically represented.In the picture I get some heigth in Y and some angle in X axis(about 45º) from a typical voxel vision.
The question, how can I achieve this vision? rotating around X-axis in voxel is destructive(with the formulas above), only 30º or so, and the effect is not efficient.Do you guys know how get this point of view with good quality of images? maybe with precalculated tables representing where every pixel of the map goes to screen from this POV? some ideas please if you dont understand something let me know please!

[edited by - jetjohny on March 23, 2004 1:09:44 PM]

[edited by - jetjohny on March 23, 2004 1:11:29 PM]

[edited by - jetjohny on March 23, 2004 1:20:45 PM]

[edited by - jetjohny on March 23, 2004 1:24:27 PM]

[edited by - jetjohny on March 23, 2004 2:47:40 PM]

[edited by - jetjohny on March 23, 2004 2:55:17 PM]

##### Share on other sites
For the X-rotation, I added a constant to the top of the vertical stripes in the screen plan. But it work just for little angle (+ or -22).

[edited by - Chuck3d on March 25, 2004 2:56:48 PM]