Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ares91x

#1
mmm yes this could work

Exists a way do create stencil in jpct?
#2
Support / JPCT-ae + GoogleTango = Occlusion/Stencil
August 26, 2017, 11:48:45 AM
Hi everyone,
Im using Google Tango for a project and Im trying to find a way to hide(partialy or totaly) virtual object that are behind a real object.
I found this project http://www.modeso.ch/blog-posts/augmented-reality-using-tango-occlusion.html but this is in OpenGl and in C (I dont know both of them) and I was wondering if exists a similar way to implement that in JPCT-ae or something similar for example creating a stencil with the point coming from depth perception sensor of GoogleTango and than applying the stencil to the view in order to cover(not render) part of 3D object. So in few words how to create a stencil given some points (point coordinates are in 3D) and apply it to an view?
#3
Support / Re: Black color is rendered as transparent !!!
September 13, 2016, 02:57:34 PM
nothing happens , i tried 3dobject.setTrasparency(-1); with 3ds and md2 models and it still transparent

Can it be that this GLES10.glClearColor(0.0f, 0.0f, 0.0f, 0.f); on the ARtoolkit render make the texture transparent?
#4
Support / Black color is rendered as transparent !!!
September 11, 2016, 10:35:40 AM
Hi, i have integrated JPCT-AE with ARtoolkit and it works fine but can't render black color, when i render an object the black part of the texture is rendered as transparent.

This is the ARtoolkit Render
public class ARRenderer implements GLSurfaceView.Renderer {

    /**
     * Allows subclasses to load markers and prepare the scene. This is called after
     * initialisation is complete.
     */
public boolean configureARScene() {
return true;
}

    public void onSurfaceCreated(GL10 unused, EGLConfig config) {       
   
    // Transparent background
    GLES10.glClearColor(0.0f, 0.0f, 0.0f, 0.f);
    }

    public void onSurfaceChanged(GL10 unused, int w, int h) {
    GLES10.glViewport(0, 0, w, h);
    }

    public void onDrawFrame(GL10 gl) {
    if (ARToolKit.getInstance().isRunning()) {   
    draw(gl);
    }   
    }
   
    /**
     * Should be overridden in subclasses and used to perform rendering.
     */
    public void draw(GL10 gl) {
    GLES10.glClear(GLES10.GL_COLOR_BUFFER_BIT | GLES10.GL_DEPTH_BUFFER_BIT);
    }
   
}


and this is JPCT-AE render
public class RenderARESX extends ARRenderer {

    private World mWorld;
    private Camera mCamera;
    private FrameBuffer mBuffer ;

    Matrix projMatrix = new Matrix();

    @Override
    public boolean configureARScene() {

        Config.useRotationPivotFrom3DS=true;
        // Initialize the game world and the camera
        mWorld = new World();
        mWorld.setClippingPlanes(0.1f, 10000.0f);
        mWorld.setAmbientLight(150, 150, 150);

        mCamera = mWorld.getCamera();

        // Load all objects to the world
        for (AmbientElement ae: MainScene.getInstance ().getAmbientElementsList()) {
            // init AmbientElement
            if (!ae.initRendering(mWorld) ) {
                // If there was a problem, return false
                return false;
            }
            //Log.wtf("esx","getmMarkerId = "+ae.getTracer().getmMarkerId());
        }

        return true;
    }

    @Override
    public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) {

    }

    @Override
    public void onSurfaceChanged(GL10 gl10, int w, int h) {

        Config.useRotationPivotFrom3DS=true;

        super.onSurfaceChanged(gl10, w, h);
        mBuffer = new FrameBuffer(gl10,w,h);
    }

    float[] projection;
    @Override
    public void onDrawFrame(GL10 gl10) {

        mBuffer.clear();

        try {
            projection = ARToolKit.getInstance().getProjectionMatrix();

            projMatrix.setIdentity();
            projMatrix.setDump(projection);
            projMatrix.transformToGL();

            SimpleVector translation = projMatrix.getTranslation();
            SimpleVector dir = projMatrix.getZAxis();
            SimpleVector up = projMatrix.getYAxis();

            mCamera.setPosition(translation);
            mCamera.setOrientation(dir, up);

            for (AmbientElement ae : MainScene.getInstance().getAmbientElementsList()) {
                ae.updateMarkerTransformation();
            }

            mWorld.renderScene(mBuffer);
            mWorld.draw(mBuffer);
            mBuffer.display();
        }catch (Exception e){
            Log.e("esx","ERRORE RenderARESX.onDrawFrame "+e.toString());
            e.printStackTrace();
        }
    }

}


is it possible that this make the black part of the texture transparent GLES10.glClearColor(0.0f, 0.0f, 0.0f, 0.f); in ARtoolkit render?
I tried to change this but nothing happens.
Any idea how to solve this?
#5
Support / Re: Touch 3D object ArToolKitJpctBaseLib
August 18, 2016, 06:00:14 PM
Hi
this has nothing to do with your problem but i saw something in your code that i'm looking for to much time. How do you track multpiple objects ,in other words how do you assign a pattern to a object for example hear
cubo = new TrackableObject3d("single;Data/patt.hiro;80", getCube()); you assign "single;Data/patt.hiro;80" to Cube .How to assign different patterns to different objects ?
#6
Hi ,
someone has any idea why the BLACK COLOR of the 3D object is rendered as transparent. The object is a .3DS
This is the onDrawFrame func:

@Override
    public void onDrawFrame(GL10 gl10) {
        try {
            float[] projectionCamera = ARToolKit.getInstance().getProjectionMatrix();
            projMatrix.setIdentity();
            projMatrix.setDump(projectionCamera);
            projMatrix.transformToGL();
            SimpleVector translation = projMatrix.getTranslation();
            SimpleVector dir = projMatrix.getZAxis();
            SimpleVector up = projMatrix.getYAxis();
            cam.setPosition(translation);
            cam.setOrientation(dir, up);

            if (ARToolKit.getInstance().queryMarkerVisible(markerID)) {
                float[] transformation = ARToolKit.getInstance().queryMarkerTransformation(markerID);

                object3d.setIdentity();
                object3d.setDump(transformation);
                object3d.transformToGL();

                thing.clearTranslation();

                thing.translate(object3d.getTranslation());
                thing.setRotationMatrix(object3d);
                thing.scale(GlobalVar.getScale());
            }


            //buffer.clear(colorBLACK);
            world.renderScene(buffer);
            world.draw(buffer);
            //buffer.display();
        }catch (Exception e){
            //Log.d("esx","ERRORE RenderARESX.java  onDrawFrame(GL10 gl10) : "+e.toString());
            e.printStackTrace();
        }
    }


*The commented lines has no effect

Any idea how to solve?
This is a screenshot:

THX and sorry for my english