Texture matrix on IBillBoardSceneNode randomly ignored D3D9

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

Texture matrix on IBillBoardSceneNode randomly ignored D3D9

Post by squisher »

The following snippet

Code: Select all

    irr::scene::IBillboardSceneNode* explosion = smgr->addBillboardSceneNode(0, dimension2df(40,40),
        pos, 0, SColor(0,255,255,255), SColor(0,255,255,255));
 
    explosion->setMaterialFlag(irr::video::EMF_LIGHTING, false);
    explosion->setMaterialFlag(irr::video::EMF_ZWRITE_ENABLE, false);
    explosion->getMaterial(0).setTexture(0, G::device->getVideoDriver()->getTexture("ani1.jpg"));
    explosion->setMaterialType(irr::video::EMT_TRANSPARENT_VERTEX_ALPHA);
 
    explosion->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.26f, 0.26f);
    explosion->getMaterial(0).getTextureMatrix(0).setTextureScale(0.24f, 0.24f);
Displays one of the 16 frames in

Image

(I plan to animate it later) Yet depending on the angle from which I view the billboard, sometimes I see all 16 explosions instead of just the 1 frame.

This is really frustrating because my brother-in-law is visiting tomorrow and I'm trying to fix this so I have a working game before then. I'm furiously trying to find where the bug is, but if anyone else can help I'd greatly appreciate it...

Edit: This happens D3D9 only!!! It works fine in OPENGL.

Edit2: if I shoot an unrelated rocket (which creates light, a mesh obviously, and a particle emitter, the 16 frames will merge back into the desired 1 frame, but as soon as all the rocket effects disappear, it goes back to ignoring the texture matrix and showing all 16 frames.)
Current project: StarDust. A single player galactic conquest game.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Texture matrix on IBillBoardSceneNode randomly ignored D

Post by hybrid »

The texture looks more like add_color, not transparent_vertex. Moreover, the code above only shows exactly one part of the texture (assuming full 0,0..1,1 texture coords). Maybe show the other parts as well...
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

Re: Texture matrix on IBillBoardSceneNode randomly ignored D

Post by squisher »

Doesn't sound like you understand what I'm doing. The code I pasted just shows 1 of the 16 frames because that's all that's needed to demonstrate the problem. The actual animation cycles through texture coordinates, showing frame 1, then frame 2, then frame 3 and so on through all 16 frames.

Transparency isn't the issue here. It's always transparent. The issue is that, each frame, the texture may be rendered without any transformation if some seemingly random combination of viewing angle and lighting exists.

At the very least, OpenGL and DirectMode are doing different things. Since they should be in sync, one of them is wrong. It sure seems like DirectMode ignoring texture transform is the wrongest of the two.
Current project: StarDust. A single player galactic conquest game.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Texture matrix on IBillBoardSceneNode randomly ignored D

Post by hybrid »

Ok, so you say that you are now showing just one frame of the texture without animation. But from time to time it switches to ignore the texture matrix?
Post Reply