Irrlicht weird swapped XYZ to XZY + Grass Shader Problem
Irrlicht weird swapped XYZ to XZY + Grass Shader Problem
Hello.
I would like to ask why irrlicht uses some weird swapped Y <> Z (XZY) axis which gives height as Y axis instead of Z axis as it should.
It messes up most the shaders (even the irrlicht's internal ones like normal map, pseudo parallax, it uses wrong axis (Y not Z) for dot() lighting).
Each other engines i checked are using normal XYZ axis. Is there any way to fix that to Normal ?
I would like to ask why irrlicht uses some weird swapped Y <> Z (XZY) axis which gives height as Y axis instead of Z axis as it should.
It messes up most the shaders (even the irrlicht's internal ones like normal map, pseudo parallax, it uses wrong axis (Y not Z) for dot() lighting).
Each other engines i checked are using normal XYZ axis. Is there any way to fix that to Normal ?
Last edited by deadbeef on Fri Apr 09, 2010 7:25 pm, edited 1 time in total.
-
Bear_130278
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation
-
randomMesh
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: Irrlicht weird swapped XYZ to XZY
"Whoops..."
Yes i know what "Normal" is. Im just telling that DirectX and OpenGL uses Z axis as height and its kind of weird that irrlicht swaps it to Y.
I have tested other engines like Ogre, TrueVision and it used Z axis as height and its more correct to position anything in 2D space as XY and set its height as Z in 3D space. Its even more logic.
I have problems with most hlsl shaders and i have to convert all XYZ vectors to XZY to work correct.
It looks like all irrlicht space is rotated by 90 degrees :F
I have tested other engines like Ogre, TrueVision and it used Z axis as height and its more correct to position anything in 2D space as XY and set its height as Z in 3D space. Its even more logic.
I have problems with most hlsl shaders and i have to convert all XYZ vectors to XZY to work correct.
It looks like all irrlicht space is rotated by 90 degrees :F
I found irrlicht quite impressive, but some functions are not easy to use and you need too much coding.
The ITerrainSceneNode for instance has no handy procedure for setting the terrain height. You can load a jpg from file or you can get an IMesh to manipulate things. I found out, that eventhough you want to load a terrain of size 300x300 it creates a mesh of 192*192 in the case you have a patchsize of 65. The wrapper can handle this issue by creating automaticly a larger texture in memory, so you dont even need to kill your harddrive. Heights can be given by setting a custom grid.
The wrapper can draw 2D polygons. Irrlicht can do this only in OpenGL.
It can create colored contourlines of a surface and vertical contours and contourmaps.
The wrapper can render into different windows and only two lines of code is needed.
It can handle camera movements, like GoForward, Pitch, etc.
Last but not at least, you dont want to put your code into an infinite loop. So its up to you, which window to render and when. Second all the above mentioned functions can be called with 12 lines of code...
[/img]
The ITerrainSceneNode for instance has no handy procedure for setting the terrain height. You can load a jpg from file or you can get an IMesh to manipulate things. I found out, that eventhough you want to load a terrain of size 300x300 it creates a mesh of 192*192 in the case you have a patchsize of 65. The wrapper can handle this issue by creating automaticly a larger texture in memory, so you dont even need to kill your harddrive. Heights can be given by setting a custom grid.
The wrapper can draw 2D polygons. Irrlicht can do this only in OpenGL.
It can create colored contourlines of a surface and vertical contours and contourmaps.
The wrapper can render into different windows and only two lines of code is needed.
It can handle camera movements, like GoForward, Pitch, etc.
Last but not at least, you dont want to put your code into an infinite loop. So its up to you, which window to render and when. Second all the above mentioned functions can be called with 12 lines of code...
[/img]
Tomi
Ok ok but how did you managed the XZY swap to XYZ ?
You made that globally ?
Btw. Im trying to run that shader:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24794
Do anyone has c++ source code for this sample ?
As i can see it uses XY axis instead of irrlicht's XZ and i cant make it look as it should :F
You made that globally ?
Btw. Im trying to run that shader:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24794
Do anyone has c++ source code for this sample ?
As i can see it uses XY axis instead of irrlicht's XZ and i cant make it look as it should :F
Rotate your camera 90°, the world does not care which axis you use for up (and neither do OpenGL or D3D). Sorry default-camera is not to your tastes, but actually Y-up is rather common in 3D. Actually so common that the depth-buffer is even often called z-buffer (as it's going into the screen).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Then why shaders are made other way?
Like this one:
http://irrlicht.sourceforge.net/phpBB2/ ... p?p=221252
I tried to run that and i cant make it work correct.
Any (example) help ?
Like this one:
http://irrlicht.sourceforge.net/phpBB2/ ... p?p=221252
I tried to run that and i cant make it work correct.
Any (example) help ?
I dont want to create another thread so i post it here. Its also kind of related to the XYZ axis problem so here it go:
I used the shader i posted before just as it is with simple plane "terrain" and i cant get it work with irrlicht. What am i doing wrong ? Or maybe i have to do it in some special way ?
Could anyone post me an example usage (working) of this shader ?
It would help me to understand that alot.
BTW. I didnt had any problems with PerPixelLighting as you can see on the character.
I used the shader i posted before just as it is with simple plane "terrain" and i cant get it work with irrlicht. What am i doing wrong ? Or maybe i have to do it in some special way ?
Could anyone post me an example usage (working) of this shader ?
It would help me to understand that alot.
BTW. I didnt had any problems with PerPixelLighting as you can see on the character.
Last edited by deadbeef on Sat Apr 10, 2010 7:48 pm, edited 1 time in total.
Z is Depth, Y is Height. It's always been like that in most 3D graphics engines, including OGRE. Why do you think the Depth Buffer is called the Z Buffer?deadbeef wrote:its more correct to position anything in 2D space as XY and set its height as Z in 3D space. Its even more logic.
EDIT: Didn't read CuteAliens post first, made the same points
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
DirectX and OpenGL can use either. Take a look at the "Coordinate Systems" section of the Direct3D sdk docs, where it shows Y as up, but says some modelling apps use Z as up. Or the D3DXMatrixLookAtRH function where it says "the current world's up, usually [0, 1, 0]".Im just telling that DirectX and OpenGL uses Z axis as height and its kind of weird that irrlicht swaps it to Y.

