Remove the semi-Transparency for 3d model JPCT+Vuforia integration

Started by ashunkhs, May 12, 2014, 11:43:56 AM

Previous topic - Next topic

ashunkhs

Hi ,

   I am working on JPCT+Vuforia integration . My model is rendering well . but problem is that model is semi-transparent by default without any
   setTransparency() call . And it doed't show any effect when i set cube.setTransparency(-1) .



ashunkhs

Exactly what is the problem . It is the problem of model or FrameBuffer.

EgonOlsen



EgonOlsen

I've honestly no idea what i'm seeing there... and i can't spot any transparency... ???

ashunkhs

Hi

Any one have idea abut this problem .

Following is my code :



world = new World();
world.setAmbientLight(20, 20, 20);

sun = new Light(world);
sun.setIntensity(250, 250, 250);

// Create a texture out of the icon...:-)
TextureManager txtMgr = TextureManager.getInstance();
if (!txtMgr.containsTexture("texture")) {
Texture texture = new Texture(BitmapHelper.rescale(
BitmapHelper.convert(mActivity.getResources().getDrawable(R.drawable.cosmic_pic_05)), 64, 64));
txtMgr.addTexture("texture", texture);
}

tm = TextureManager.getInstance();

cube=loadOBJModel();
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();

//cube.rotateY(-180);
//cube.rotateX(90);

world.addObject(cube);

cam = world.getCamera();

SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
//sv.x += 500;
sv.y += 5000;
sv.z += 1000;

sun.setPosition(sv);

MemoryHelper.compact();
}

private Object3D loadOBJModel() {

Object3D[] model = null;
model = Loader.loadOBJ(mActivity.getResources().openRawResource(R.raw.chinies_obj),
mActivity.getResources().openRawResource(R.raw.chinies_mtl), 1.0f);

return Object3D.mergeAll(model);

}

public void onSurfaceCreated(GL10 gl, EGLConfig config)
    {
        DebugLog.LOGD("GLRenderer::onSurfaceCreated");
       
        // Call native function to initialize rendering:
        initRendering();
       
        // Call Vuforia function to (re)initialize rendering after first use
        // or after OpenGL ES context was lost (e.g. after onPause/onResume):
        QCAR.onSurfaceCreated();
    }

public void onSurfaceChanged(GL10 gl, int width, int height)
    {
    DebugLog.LOGD(String.format("GLRenderer::onSurfaceChanged (%d, %d)", width, height));

if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(width, height);
Config.viewportOffsetAffectsRenderTarget=true;
       
        // Call native function to update rendering when render surface
        // parameters have changed:
System.out.println("11111111111111111111");
        updateRendering(width, height);
       
        // Call Vuforia function to handle render surface size changes:
        QCAR.onSurfaceChanged(width, height);
    }
public void onDrawFrame(GL10 gl)
    {
        if (!mIsActive)
            return;
       
      /*  if(cube!=null)
        {
          cube.animate(anim, 0);
      if (anim>1) {
      anim=0;
      } else {
      anim+=0.01f;
      }
        }*/
        // Update render view (projection matrix and viewport) if needed:
        mActivity.updateRenderView();
       
        updateCamera();
        // Call our native function to render content
        renderFrame();
       
world.renderScene(fb);
world.draw(fb);
fb.display();
    }
   
    public void updateModelviewMatrix(float mat[]) {
modelViewMat = mat;
}
   
    public void updateCamera() {
if (modelViewMat != null) {
float[] m = modelViewMat;

final SimpleVector camUp;
if (mActivity.isPortrait()) {
camUp = new SimpleVector(-m[0], -m[1], -m[2]);
} else {
camUp = new SimpleVector(-m[4], -m[5], -m[6]);
}

final SimpleVector camDirection = new SimpleVector(m[8], m[9], m[10]);
final SimpleVector camPosition = new SimpleVector(m[12], m[13], m[14]);

cam.setOrientation(camDirection, camUp);
cam.setPosition(camPosition);

cam.setFOV(fov);
cam.setYFOV(fovy);
}
}

EgonOlsen

It might help to know what exactly the problem is. All i'm seeing in this screen shot is a brown something. I'm not even sure what it's supposed to be nor do i know which parts of the image show the problem....

ashunkhs

Hi,

  i have attached two image .check out the problem .
  My problem is the model shows semi transparent , it not looks proper .

[attachment deleted by admin]

EgonOlsen

 ??? I just don't see any transparent parts in these images... ???

ashunkhs

Means both looks same .?
there is nothing difference between them .

both are the same model . one looks proper in sample project .but when the code in my project it looks different . what is the problem ?

ashunkhs


EgonOlsen

Maybe we aren't talking about transparency here at all but about a problem with the depth buffer. Vuforia does some funny things with the depth buffer, we had this issue before as described here: http://www.jpct.net/forum2/index.php/topic,3536.msg25228.html#msg25228. Maybe that helps...