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.


Messages - AleNovi

Pages: [1]
1
Support / Re: Voxel engine
« on: September 11, 2017, 10:59:14 am »
OK. Thanks. Maybe you know alternative 3d engines to do that?

2
Support / Voxel engine
« on: September 11, 2017, 10:16:27 am »
Hi all!
I need to make something like a voxel renderer but don't know how to do it properly with jPCT. (max around 13.000.000 blocks)
When i'm trying to make many cubes (Object3D with 12 Triangles) it makes low fps after ~50 objects.
Next, if i use one object by "mergeAll" - fps is stable ~60 but it takes many time to load (around 3sec for 12.000 blocks)
Load 13.000.000 in libGDX takes around 3sec.
I'm new in jPCT and do not found the same question So, any idea how to optimize this?

3
Support / Re: Transparency issue
« on: June 25, 2017, 02:23:52 pm »
I understand, thanks for the answer!

4
Support / Transparency issue
« on: June 25, 2017, 11:59:58 am »
Hi there!
I have some issue with transparency:http://radikal.ru/video/evjcydyhsoc
How it works now: Each not transparent cube is created as a separate object, then they are combined using Object3D.mergeObjects(not_transparent_object, current_cube);
In addition, transparent objects are combined into a second object Object3D.mergeObjects(transparent_object, current_cube);
So one layer = two Objects - one not transparent and one transparent (o3d_t.setTransparency(255))
This method provides good performance but transparent objects conflict with each other (in video yellow block and bars are transparent).
Is there any way to fix this? I'm new to the engine, so I could not notice any method that can fix it.
Thanks.

5
Support / Re: Camera rotation
« on: June 15, 2017, 02:33:08 pm »
Thank You very much! That was exactly what i needed!
I created limit in 1.56f and camera now don't twitches at 90 degrees.
SimpleVector limit_vector = new SimpleVector(0,1,0);
float angle = limit_vector.calcAngle(camera.getYAxis());
if(angle+Math.abs(movement.worldRotationX)<1.56f){
    camera.rotateX(-movement.worldRotationX);
    camera.rotateY(-movement.cameraRotationY);
} else {
    camera.rotateY(-movement.cameraRotationY/10);
}

6
Support / Re: Camera rotation
« on: June 15, 2017, 12:03:45 pm »
I made some tests and this code works fine except one thing - when camera's x rotate reaches +/- 90 degrees it twitches. I really don't know how to fix it. I tried to made limits (rotate camera's x only when summary angle in -1.56f<x<1.56f range) but there was one more bug - when i rotate camera's Y axis, X axis rotates too and my limit variable = 1.56f when real angle= 1.0f or less. Is there any way to get the current value of the camera's rotation angle except to create a variable that will sum the total rotation?
    private void moveCamera() {
        Movement movement = _movementhandler.getMovement();
        Object3D MyObject = one_layer.get(0);

        if (movement.hasMovement()) {

            Camera camera = world.getCamera();

            if(camera_z-movement.cameraMovementZ>10 && camera_z-movement.cameraMovementZ<200)
            camera_z-=movement.cameraMovementZ;

            camera.rotateX(-movement.worldRotationX);
            camera.rotateY(-movement.cameraRotationY);
     
            camera.setPosition(MyObject.getTransformedCenter());
            camera.moveCamera(Camera.CAMERA_MOVEOUT, camera_z);
            camera.lookAt(MyObject.getTransformedCenter());
        }

7
Support / Re: Camera rotation
« on: May 29, 2017, 01:57:18 pm »
Thanks for reply. I tried this method and camera not twitching but now i need to lock camera's z axis.
    private void moveCamera() {
        Movement movement = _movementhandler.getMovement();
        SimpleVector cam_pos = new SimpleVector();
        Object3D MyObject = one_layer.get(one_layer.size()/2);

        if (movement.hasMovement()) {
            Camera camera = world.getCamera();
            camera.getPosition(cam_pos);
            camera_z-=movement.cameraMovementZ;//variable to add distance to object
            camera.rotateX(-movement.worldRotationX);
            movement.worldRotationX = 0.0f;
            camera.rotateY(-movement.cameraRotationY);
            movement.cameraRotationY = 0.0f;

            camera.setPosition(MyObject.getTransformedCenter());
            camera.moveCamera(Camera.CAMERA_MOVEOUT, camera_z);
            camera.moveCamera(Camera.CAMERA_MOVEIN, movement.cameraMovementZ);
        }
    }

In other words, the camera should always look at the object having 0 degrees of rotation along the Z axis.
how to do it in best way w/o camera.lookAt?

8
Support / Re: Camera rotation
« on: May 28, 2017, 01:53:44 am »
The crux of the problem: that example turns the camera around its axis in single touch. In multi touch it moves camera left/right/up/down and in/out.
I need the camera to rotate around the object in the single touch mode.
I recorded a video for a visual display of the problem https://youtu.be/cEzp2dDiYgc
During movement on the vertical axis, the camera is twitching

9
Support / Re: Camera rotation
« on: May 27, 2017, 06:52:58 pm »
This method called in onDrawFrame:
public void onDrawFrame(GL10 gl) {
               if (!stop) {
                    fb.clear(back);
                    mSkybox.render(world,fb);
                    world.renderScene(fb);
                    world.draw(fb);
                    moveCamera();
                    fb.display();
                } else {
                    if (fb != null) {
                        fb.dispose();
                        fb = null;
                    }
                }
        }


'movement' i took from this example http://www.jpct.net/wiki/index.php?title=MultiTouch_camera_controls

10
Support / Camera rotation
« on: May 27, 2017, 12:41:49 am »
Hi All!
I'm starting to develop an application that should display a 3D model, but i can't understand how correctly rotate camera around object.
I tried to use this guide http://www.jpct.net/wiki/index.php?title=MultiTouch_camera_controls but it not exactly what i need.
I want to rotate camera like in this app https://play.google.com/store/apps/details?id=com.tdcp.threedc or this https://play.google.com/store/apps/details?id=jquinn.qubism.android
Now i have this code to move camera, based on guide which i wrote above.
    private void moveCamera() {
        Movement movement = _movementhandler.getMovement();
        SimpleVector cam_pos = new SimpleVector();
        Object3D MyObject = one_layer.get(one_layer.size()/2);

        if (movement.hasMovement()) {
            Camera camera = world.getCamera();
            camera.getPosition(cam_pos);
           
            SimpleVector backVect = MyObject.getTransformedCenter();
            backVect.scalarMul(-1.0f);
            Matrix rotationmatrix = new Matrix();
            rotationmatrix.translate(backVect);
            rotationmatrix.rotateY(movement.cameraRotationY);
            rotationmatrix.translate(MyObject.getTransformedCenter());

            cam_pos.matMul(rotationmatrix);
            camera.setPosition(cam_pos);
            camera.lookAt(one_layer.get(one_layer.size()/2).getTransformedCenter());

            camera.moveCamera(Camera.CAMERA_MOVEUP, movement.worldRotationX*10);
            camera.moveCamera(Camera.CAMERA_MOVEIN, movement.cameraMovementZ);
        }
    }


The camera twitches during the rotation so I probably need to change the code.
Maybe someone knows good examples with the source code. I will be grateful for any help.

Pages: [1]