Author Topic: Remove the semi-Transparency for 3d model JPCT+Vuforia integration  (Read 5849 times)

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
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) .



Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #1 on: May 12, 2014, 03:09:39 pm »
Exactly what is the problem . It is the problem of model or FrameBuffer.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #2 on: May 12, 2014, 03:18:44 pm »
I'm not sure. Do you have a screen shot?

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #3 on: May 12, 2014, 07:19:52 pm »
FTA

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #4 on: May 12, 2014, 07:35:21 pm »
I've honestly no idea what i'm seeing there... and i can't spot any transparency... ???

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #5 on: May 13, 2014, 07:14:18 am »
Hi

Any one have idea abut this problem .

Following is my code :


Code: [Select]
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);
}
}
« Last Edit: May 13, 2014, 08:50:33 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #6 on: May 13, 2014, 08:52:30 am »
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....

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #7 on: May 13, 2014, 09:50:52 am »
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]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #8 on: May 13, 2014, 12:09:53 pm »
 ??? I just don't see any transparent parts in these images... ???

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #9 on: May 13, 2014, 12:30:15 pm »
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 ?

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #10 on: May 13, 2014, 12:37:27 pm »
FTA

 screen short.

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #11 on: May 13, 2014, 12:50:16 pm »
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...

Offline ashunkhs

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Remove the semi-Transparency for 3d model JPCT+Vuforia integration
« Reply #12 on: May 14, 2014, 11:53:09 am »
thank .
Now fixed the issue .