Scale bug fix with IMeshManipulator Class ?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
StuCollier
Posts: 52
Joined: Tue Mar 30, 2004 12:16 pm

Scale bug fix with IMeshManipulator Class ?

Post by StuCollier »

What is the proper way of scaling an AnimatedMesh ?

At present all I do is :

Code: Select all

myobject = smgr->addAnimatedMeshSceneNode(smgr->getMesh("Object.x"));
myobject->setScale(core::vector3df(35,35,35));
Image

Anything past scale x 30% leads to alot of clipping issues. Im reading the forum and it seems that I must use the IMeshManipulator Class.

Does anyone have any sample code on how to use the IMeshManipulator Class ?

Do I take it that a work around is to pre-scale before bringing into Irr ?
StuC
Freeware games
www.ovine.net
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

I remember reading something in the tutorials that said that the bounding box of an object is used for clipping. Try changing the size of the bounding box. You'll probably need to find which example I'm talking about. I can't remember which one.
StuCollier
Posts: 52
Joined: Tue Mar 30, 2004 12:16 pm

Post by StuCollier »

Sorry to be a pain but.....

Can anyone help me with this scale problem ?

Ive tried it with a more basic shape - and as you can see after the scaling the rendering goes jaggy. Ive tried in DX9 and OGL - gets worse in OGL.

I even tried

Code: Select all

    IMeshManipulator* manip = smgr->getMeshManipulator();
    manip->scaleMesh(tmesh->getMesh(0),core::vector3df(30,30,30));
    manip->recalculateNormals (tmesh->getMesh(0));
and the problem still exists. Ive also tried changing "irrDriver->setTextureCreationFlag( .... " to various setting but still no change.



Image
StuC
Freeware games
www.ovine.net
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

Ah, sorry I missed your reply Stu, I've been busy.

It sounds like it might be getting out of my league, but I'm having trouble understanding what's going on in the screenshots. Mostly because I'm not sure what you've drawn in later, and what the model is actually supposed to look like.

While you're waiting for a real response, you could maybe make 2 screen shots - one with things looking normal (with the object with no scaling applied or whatever), and another one with the error, marked in red.
I can tell you've done that with the 2nd lot of shots, but I'm not sure what the original shape of the object is supposed to be. And I'd like to see what the object in the first screen shot is supposed to be (without the errors) Maybe if you did some screen shots with basic objects - sphere, cube, pyramid, etc.

The errors on the second screen shot reminds me of the effect you get when things are too close to each other, and too far away from the camera, and you get z-buffering problems (because it's less acurate the further away you go from something), and you get those triangular effects where water meets sand, or paintings flat against walls, etc.

So maybe it has something to do with the z-buffering not compensating for the new size of the object or something.
StuCollier
Posts: 52
Joined: Tue Mar 30, 2004 12:16 pm

Post by StuCollier »

Ok heres another example.... this uses the dwarf model that comes with Irrlicht.

Especially with the hand - the intersection "flickers" like crazy....

Image

Dawrf has been scaled ( setScale(core::vector3df(22,22,22)); )

It seems that any intersection of polys causes glitches - instead of a smooth meeting..........
StuC
Freeware games
www.ovine.net
StuCollier
Posts: 52
Joined: Tue Mar 30, 2004 12:16 pm

Post by StuCollier »

Is there just me concerned about this ?
StuC
Freeware games
www.ovine.net
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

No, I am too (just haven't been online in a while).

(As you and I both know from Jamagic...) intersections are important, especially for creating water scenes that use seperate objects for the water and the terrain.
This is a common technique, where you make a terrain mesh, and then intersect it with a water mesh, which could be a flat plane, or have waves in it. You can raise or lower the 'water level' by raising or lowering the water mesh. (It's also what you might use in Bryce or Terragen)
If the 3D engine can't do reliable intersections, the shoreline seems to jump about whenever the camera moves, which really sucks.


The pictures you just posted have lead me to another question for you;

Does the flickering happen in the same way, when you just move the camera really close to the dwarf, so that it 'looks' about the same size as that, instead of scaling up?
If it does, then the intersection problem is a constant symptom of the way the engine works, and we'll have to wait for some improvement, but if it doesn't, then it means the engine can intersect properly, but we need to do something else to keep the object looking right when we scale it up.
Post Reply