Parallax problem, maybe a irrlicht bug?
Parallax problem, maybe a irrlicht bug?
Hello, I tried asking this in the IRC but no1 seems to be able to help me :/.
Some theories in the IRC were that it's actually a irrlicht bug since another user had has this problem but never got it solved...
Anyhow, the problem I have is:
I got a really weird bug, if u don't mind helping me out then check this pastebin:
http://pastebin.com/A0ptCzNf
The odd thing is that the bumpmap and all looks PERFECT, untill I look in the corners or not in the middle, where the map looks all... oily or something, really odd...
This is what it looks like in the corners: http://i41.tinypic.com/bjep3d.png
And this is what it looks like in the middle: http://i39.tinypic.com/wcbfpd.png
As you can tell it looks perfect in the middle, just like I want it, but when you get to the edges or actually anywhere but the center it looks like crap :/... Hopefully you can help me
Some theories in the IRC were that it's actually a irrlicht bug since another user had has this problem but never got it solved...
Anyhow, the problem I have is:
I got a really weird bug, if u don't mind helping me out then check this pastebin:
http://pastebin.com/A0ptCzNf
The odd thing is that the bumpmap and all looks PERFECT, untill I look in the corners or not in the middle, where the map looks all... oily or something, really odd...
This is what it looks like in the corners: http://i41.tinypic.com/bjep3d.png
And this is what it looks like in the middle: http://i39.tinypic.com/wcbfpd.png
As you can tell it looks perfect in the middle, just like I want it, but when you get to the edges or actually anywhere but the center it looks like crap :/... Hopefully you can help me
Re: Parallax problem, maybe a irrlicht bug?
I can't see the pic now on my company's PC as it's blocked by firewall. I'll take a look at it once i go back home.
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Re: Parallax problem, maybe a irrlicht bug?
looks like some kind of normalize error, possibly something normalized in the vertex shader then interpolated badly in the pixel shader (where it should be normalized but for performance gains it's not). You could Try subdividing the geometry more to reduce the interpolation errors or adding a few normalizes to the pixel shader (if you have access).
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Re: Parallax problem, maybe a irrlicht bug?
Your result seems more or less correct, plus I don`t think you changed the shader that much from the original. But I dont trust your mesh. You can try to create one Irr plane mesh and use it to be sure. Irrlicht plane normals are always pointing away from the surface:
PS: Blaming irrlicht for your code adventures is a shame.
Code: Select all
scene::IMesh* mesh = smgr->getGeometryCreator()->createPlaneMesh(core::dimension2df(100.0f, 100.0f), core::dimension2d<u32>(10, 10), &someMaterial, core::dimension2df(100, 100));
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Re: Parallax problem, maybe a irrlicht bug?
Well, it wasn't me that came to that conclusion ^^ it was actually a cpl of ppl and me that talked and appairently quite some ppl have had this exact problem and we figured it could be a bug .shadowslair wrote:Your result seems more or less correct, plus I don`t think you changed the shader that much from the original. But I dont trust your mesh. You can try to create one Irr plane mesh and use it to be sure. Irrlicht plane normals are always pointing away from the surface:PS: Blaming irrlicht for your code adventures is a shame.Code: Select all
scene::IMesh* mesh = smgr->getGeometryCreator()->createPlaneMesh(core::dimension2df(100.0f, 100.0f), core::dimension2d<u32>(10, 10), &someMaterial, core::dimension2df(100, 100));
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Re: Parallax problem, maybe a irrlicht bug?
Do you guys really think are the first ones to try parallax with Irrlicht, so you have disovered a bug? Where exactly is your unwanted behaviour? Are you sure you know what you are doing and what exactly is going on? There`s even a simplistic version in the examples, which works as it should be. So, unless proven the opposite, it`s definitely user mistake. Well, a group of users mistakes I guess.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Re: Parallax problem, maybe a irrlicht bug?
I'm sure it is, and really hope it is, however no one I have talked to on IRC or anywhere seems to have a clue why this is happening There's a little difference between my project and the example and that is that the example has a lot smaller object than what I'm trying to use, and when I load that object and do the same, it works nicely, using the exact same code etc.shadowslair wrote:Do you guys really think are the first ones to try parallax with Irrlicht, so you have disovered a bug? Where exactly is your unwanted behaviour? Are you sure you know what you are doing and what exactly is going on? There`s even a simplistic version in the examples, which works as it should be. So, unless proven the opposite, it`s definitely user mistake. Well, a group of users mistakes I guess.
As far as I can tell its hopefully my mistake, because I would LOVE to see this working as it's something I REALLY want in my project, however it seems to bug out after a being applied to a huge object, since it works on part of it, but later totally bugs out.
I'm not trying to blame Irrlicht for this, I'm trying to figure out if it COULD be a engine bug. Since I have come across those before.
Re: Parallax problem, maybe a irrlicht bug?
To be fair - there can always be a bug in Irrlicht. I found more than one bug in places where I thought that can't be ;-) (for example several crashes which could be reproduced by typing into an editbox...)
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
Re: Parallax problem, maybe a irrlicht bug?
I tried redoing it with a planemesh instead of a object, and have the exact same bug, in some places the parallax bumping is perfect, looks AWESOME. and then in the edges of the model it looks like crap :/.
Tried changing the scales and whatnot, still am unable to get it to work :S...
If someone who actually KNOWS they can get this to work could try making a plane which is, pretty damn big, and apply parallax and NOT get this bug, then I would be very, very, very happy lol...
Edit: Question, could this have something to do with too big textures? Currently the textures we use are 3000x3000 px.
Tried changing the scales and whatnot, still am unable to get it to work :S...
If someone who actually KNOWS they can get this to work could try making a plane which is, pretty damn big, and apply parallax and NOT get this bug, then I would be very, very, very happy lol...
Edit: Question, could this have something to do with too big textures? Currently the textures we use are 3000x3000 px.
Re: Parallax problem, maybe a irrlicht bug?
maybe the npot problems? try 2048x2048. And maybe try tilling textures like someone suggested before (so you wouldn't need to use such big textures).
Working on game: Marrbles (Currently stopped).
Re: Parallax problem, maybe a irrlicht bug?
I tried doing that and even a texture as small as somehwere around 512px didn't work correctly, I'm using the textures that come with irrlicht so it's really odd...serengeor wrote:maybe the npot problems? try 2048x2048. And maybe try tilling textures like someone suggested before (so you wouldn't need to use such big textures).
This is my current code.
Code: Select all
scene::IMesh* earthMesh2 = smgr->getGeometryCreator()->createPlaneMesh(core::dimension2df(500.0f, 500.0f), core::dimension2d<u32>(1, 1), &material , core::dimension2df(1, 1));
if (earthMesh2)
{
//perform various task with the mesh manipulator
scene::IMeshManipulator *manipulator2 = smgr->getMeshManipulator();
// create mesh copy with tangent informations from original earth.x mesh
scene::IMesh* tangentSphereMesh2 =
manipulator2->createMeshWithTangents(earthMesh2);
// set the alpha value of all vertices to 200
manipulator2->setVertexColorAlpha(tangentSphereMesh2, 200);
sphere2 = smgr->addMeshSceneNode(tangentSphereMesh2);
sphere2->setPosition(pos);
sphere2->setRotation(vector3df(0,0,0));
sphere2->getMaterial(0).SpecularColor.set(0,0,0,0);
sphere2->setDebugDataVisible(EDS_NORMALS);
//
// load heightmap, create normal map from it and set it
video::ITexture* earthNormalMap2 = driver->getTexture(bump.c_str());
if (earthNormalMap2)
{
driver->makeNormalMapTexture(earthNormalMap2, 0.0f);
//sphere2->setMaterialTexture(0,driver->getTexture("data/Textures/Level/crate.jpg"));
sphere2->setMaterialTexture(1, earthNormalMap2);
sphere2->setMaterialType(video::EMT_PARALLAX_MAP_SOLID);
}
//sphere2->getMaterial(0).MaterialTypeParam = 0.035f;
// adjust material settings
//sphere2->setMaterialFlag(video::EMF_FOG_ENABLE, true);
// drop mesh because we created it with a create.. call.
tangentSphereMesh2->drop();
}
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Re: Parallax problem, maybe a irrlicht bug?
Ah, I misread that you`re using the build-in EMT_PARALLAX_MAP_SOLID material. Pastebin version is not coloured and is harder to read. Thought you`re using your own shader all the time. My mistake. Never used the build-in shader materials, so I cannot comment on them. Indeed I won`t be surprised if it turns to be a bug. My apoligies.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Re: Parallax problem, maybe a irrlicht bug?
Np m8, in any case, any way I twist and turn these textures, it wont work on a bigger scale. It seems that it will work if I use a LOT of smaller planes, however that's not really what I want :/...shadowslair wrote:Ah, I misread that you`re using the build-in EMT_PARALLAX_MAP_SOLID material. Pastebin version is not coloured and is harder to read. Thought you`re using your own shader all the time. My mistake. Never used the build-in shader materials, so I cannot comment on them. Indeed I won`t be surprised if it turns to be a bug. My apoligies.
Re: Parallax problem, maybe a irrlicht bug?
Just made a quick test with your code + some other code to make it compile. Does it work for you and is this what you need?
Release.rar - 1.5 Mb
Move around with fps cam (was too lazy to position/rotate it myself )
Release.rar - 1.5 Mb
Move around with fps cam (was too lazy to position/rotate it myself )
Working on game: Marrbles (Currently stopped).
Re: Parallax problem, maybe a irrlicht bug?
you can't expect a view based shader to work across a huge 4 vert plane, the view direction is calculated in the vertex shader then interpolated values passed
on the inbetween pixels in the pixel shader. With something where the uv look up is based on the view direction which is badly interpolated your going to get strange results, parallax shaders can look pretty odd (smearing around as the view changes) at the best of times. Subdivide the geometry to give the shader more verts to work with.
on the inbetween pixels in the pixel shader. With something where the uv look up is based on the view direction which is badly interpolated your going to get strange results, parallax shaders can look pretty odd (smearing around as the view changes) at the best of times. Subdivide the geometry to give the shader more verts to work with.