Recent Posts

Pages: [1] 2 3 ... 10
1
Support / Re: Vertices only visible in certain camera angles
« Last post by EgonOlsen on June 07, 2021, 02:06:15 pm »
That's a bit strange. The vertex controller does nothing more than to modify the mesh. Whether this happens via controller at runtime or it's by baking it into the mesh shouldn't matter.
2
Support / Re: Vertices only visible in certain camera angles
« Last post by rkull88 on June 03, 2021, 01:29:55 pm »
Maybe I'm doing something incorrect cause I can't get the triangles to be drawn/updated when assigning controller, applying, removing and then calling build. Here's what I do:
Code: [Select]
int vertexCount = object.getMesh().getUniqueVertexCount();

JpctVertexController2 controller = new JpctVertexController2();
object.getMesh().setVertexController(controller, true);

JpctMeshData initData = new JpctMeshData(vertexCount);
controller.updateMeshData(initData.vertexData, initData.normalData);
object.getMesh().applyVertexController();
object.touch();
object.getMesh().removeVertexController();

object.build();
world.addObject(object);

where JpctMeshData is just initialized as:
Code: [Select]
public JpctMeshData(int size) {
        vertexData = new SimpleVector[size];
        normalData = new SimpleVector[size];

        for(int i = 0; i < vertexData.length; i++) {
            vertexData[i] = new SimpleVector();
            normalData[i] = new SimpleVector(0, -1, 0);
        }
    }

and controller.updateMeshData():
Code: [Select]
public synchronized void updateMeshData(SimpleVector[] meshData, SimpleVector[] normalData) {
        SimpleVector[] destinationMesh = getDestinationMesh();
        SimpleVector[] destinationNormals = getDestinationNormals();
        System.arraycopy(meshData, 0, destinationMesh, 0, meshData.length);
        System.arraycopy(normalData, 0, destinationNormals, 0, normalData.length);
    }

Had the same problem earlier. That's why I had to keep the controller but only update it the first time and then continue by only updating the attributes..
3
Support / Re: Vertices only visible in certain camera angles
« Last post by rkull88 on June 01, 2021, 10:26:22 am »
Nothing superscientific done, but ran an average on the different setups in the onDraw() method in my fragment. Measuring the time it takes to update the vertices.

Vertex controller: 35 ms
Vertex attribute: 9 ms

But for the rendering itself (no averaging, just looking at the time spent):

Vertex controller: mostly around 100 ms
Vertex attributes: mostly around 200 ms

Quote
You might want to try to apply the controller just once, remove it and call build afterwards. Just to see if that changes something. It shouldn't, but just to rule that out...

I'll try thet, thanks!
4
Support / Re: Vertices only visible in certain camera angles
« Last post by EgonOlsen on May 31, 2021, 04:59:59 pm »
You might want to try to apply the controller just once, remove it and call build afterwards. Just to see if that changes something. It shouldn't, but just to rule that out...
5
Support / Re: Vertices only visible in certain camera angles
« Last post by EgonOlsen on May 31, 2021, 03:58:19 pm »
What performance difference are we talking about here? How much faster/slower is one solution than the other?
6
Support / Re: Vertices only visible in certain camera angles
« Last post by rkull88 on May 31, 2021, 03:25:08 pm »
In both cases, I'm still using vertex attributes, one static for drawing the wireframe based on barycentric coordinates and one dynamic for the coloring of the vertcies. The thing that differs is how the position of the vertices are updated.

In the vertex attribute case, I couldn't get the position update to work if I didn't do one initializing update using a vertex controller. But after that first update, it worked by only updating the position via the attribute.

I'm only calling build() on the Object3D
7
Support / Re: Vertices only visible in certain camera angles
« Last post by EgonOlsen on May 31, 2021, 02:47:31 pm »
That the amount of work done in fillAttributes increases when you are using vertex attributes is to be expected. I'm more confused about the fact that there seems to be significant work done in the other case as well. Are you, even in case of using the vertex attributes, still assigning the vertex controller? Or do you have some explicit calls to compile(...) or maybe build(false)?
8
Support / Re: Vertices only visible in certain camera angles
« Last post by rkull88 on May 31, 2021, 10:29:35 am »
Now I got the profiling to work. Updating the vertex attributes instead of the vertex controller is indeed faster, however, when it comes to the rendering, updating the vertex attributes takes longer time in draw() and renderScene(). Don't know if these screencaps of the top down charts can give you any clues, but here they are: https://www.dropbox.com/sh/809ag9of4esvlig/AAB3OcqPMtVRw1fSQ0uuZCYra?dl=0

*_vert_attr = changing vertex position via vertex attribute
*_vert_controller = changing via vertex controller

From what I can see, the function fillAttributes() differs quite alot, especially the get() from ArrayList in the vertex attribute case.

Since I'm using the "position" attribute, is there any chance that stuff gets written/updated twice when it doesn't have to? I mean, the position attribute is written anyway right? Or is it some other magic going on under the hood? :)

Thanks alot for the support!
9
Projects / Re: Physics example
« Last post by aleks1283 on May 30, 2021, 02:23:42 pm »
 I defeated the first dragon !!! Fixed.Working.


VVV2 = new GenericVertexController() {
            @Override
            public void apply() {
                SimpleVector[] aaa = getSourceMesh();
                int lll=aaa.length;
                X77 = new float[lll];
                Y77 = new float[lll];
                Z77 = new float[lll];
                for (int f=0;f<lll;f++)
                {
                    aaa[f].matMul(cyl7.getWorldTransformation());
                    X77[f] = aaa[f].x;
                    Y77[f] = aaa[f].y;
                    Z77[f] = aaa[f].z;
                    aaa[f].matMul(cyl7.getWorldTransformation().invert());
                }
            }
        };
10
Projects / Re: Physics example
« Last post by AeroShark333 on May 29, 2021, 10:18:49 pm »
Thanks, I hope you see a cool game this year.
I need something like object.clearRotation and preferably object.clearTranslation to apply to sourceMesh.clearRotation and sourceMesh.clearTranslation.
Good luck ;)
Pages: [1] 2 3 ... 10