Problem in Sprite3D M3G

Forum for discussion on 3D games for mobile platform and doubts related to M3G, Mascot capsule and other rendering engines.

Problem in Sprite3D M3G

Postby prasadmathugama » Tue Jul 27, 2010 1:16 pm

Dear all,

I have an image of a person. when I create it, I simply cut the person and insert it in to a transparent background. Now person is in the image and its surrounding is transparent. I converted it to 3D Sprite object. But when I render it to my 3D world, its transparent background is also rendered with shading color around (kind of deformation).

here is the code sample:

Image2D texImage = null;
Appearance myAppearance = new Appearance();

texImage = (Image2D) Loader.load("/GameWorld/Umpire/umpair back .png")[0];

sprite = new Sprite3D(true, texImage, myAppearance);
sprite.setCrop(0, 0, 64, 128);

sprite.setTranslation(-0.6f, 0.65f, 0.0f);
sprite.setScale(0.6f, 1.2f, 0f);
sprite.setOrientation(90, 0f, 0.1f, 0f);
sprite.postRotate(-270, 0.1f, 0f, 0f);

I render the world in my game loop. But when I draw it as a sprite on top of a another image, transparency is there. What should I do? Pls help.
Posts: 4
Joined: Tue May 04, 2010 8:02 am

Re: Problem in Sprite3D M3G

Postby ladty » Thu Jul 29, 2010 12:26 pm


I think that your problem is in using CompositingMode.REPLACE (which is default in m3g). Try this:

Code: Select all
Appearance myAppearance = new Appearance();
CompositingMode cm = new CompositingMode();

Or you can experiment with other constants, like ALPHA, ALPHA_ADD, MODULATE, MODULATE_X2, REPLACE. Sometimes it makes nice effects, but use it wisely - it reduces FPS quite a lot imo :)

And if this won't help, try creating your Image2D like this:
... = new Image2D(Image2D.RGBA, /* Image */);
I'm not sure how does the Loader exactly work in this case, so I do it this way.

But I think the CompositingMode should do it :)
User avatar
Posts: 24
Joined: Wed Jul 09, 2008 10:36 am
Location: Czech republic

Return to 3D Mobile Game (M3G)

Who is online

Users browsing this forum: No registered users and 1 guest