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 - mxar

Pages: 1 2 3 [4] 5
46
Support / Re: Vertex colouring from last jPCT-AE version
« on: November 12, 2014, 10:02:37 am »
Many thanks,

 this beta version is exactly the same with 1.29 version?

 The addition of new Object3D constructor is the only difference with version 1.29?

Thanks in advance

47
Support / Re: Vertex colouring from last jPCT-AE version
« on: November 11, 2014, 08:47:34 am »

Hi again,

there are cases vertex normal are pre-known. In such case, these normals describe the real-world object more accurately than the calculated ones.

Is there a way to give the jPCT-AE engine the known normal?

Can I use vertex or fragment shaders to use the pre-known vertex normals when building Object3D models with this constructor?


 Object3D object3D = Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId)

Thanks in advance



48
Support / Re: Vertex colouring from last jPCT-AE version
« on: November 07, 2014, 09:34:03 pm »
OK, thanks.

49
Support / Re: Vertex colouring from last jPCT-AE version
« on: November 07, 2014, 10:51:08 am »
Hi again,

how can i apply vertex normals to  object3D when i call  this constructor ?

 Object3D object3D = Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId)

Also ,do you know if .3ds model can have embedded  textute images?

I mean if it is possible  the texture images  not be  separated from the .3ds file.

Thanks in advance.





50
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 30, 2014, 12:23:49 pm »
thanks

51
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 29, 2014, 02:45:29 pm »
Hi again,

I wrote a code to apply vertex colors to loaded 3D model.

The part of the code that assignes vertex color is:

 int vertices = object3D.getMesh().getUniqueVertexCount();

        float[] data = new float[4*vertices];

        for(int i = 0; i < data.length; i++){
           
           data = 0.0f;
                   
              if(i%4 == 0)
                data = 0.0f; //red color
             
              if(i%4 == 1)
                 data = 0.0f; //green color
             
              if(i%4 == 2)
                  data = 1f; //blue color
             
              if(i%4 == 3)
                   data = 0.5f; //transparency
               
        }
         
        VertexAttributes  vattrs = new VertexAttributes("colorinfo",data,VertexAttributes.TYPE_FOUR_FLOATS);

        object3D.getMesh().addVertexAttributes(vattrs);
       
        GLSLShader  shader = new  GLSLShader( Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.vertexshader)),Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.fragmentshader)));

        object3D.setShader(shader);
       
       object3D.strip();
       object3D.build();
       world.addObject(object3D);

 The vertex shader is:

attribute vec4 colorinfo;
uniform mat4 modelViewProjectionMatrix;
attribute vec4 position;
varying vec4 vertexColor;


void main(void)
{
     vertexColor = colorinfo;
     gl_Position = modelViewProjectionMatrix * position;

}
 
And the fragment shader is:


varying vec4 vertexColor;


void main(void)
{
 gl_FragColor = vertexColor;
}


The problem is that i dont see any transparency. I see only a blue 3D model.

It looks like the code : 
             if(i%4 == 3)
                 data = 0.5f; //transparency

doesnt create any transparency.

How can i produce transparency with vertex colors?

Thanks in advance


52
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 16, 2014, 01:39:24 pm »

OK,

Thank you.


53
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 16, 2014, 10:41:44 am »


Ok

but I want to ask you if more types of Object3D models (like the supported .3ds,.obj ..) are planned to be supported in the near future by jPCT-ae.

Also non square texures with power of 2 sizes (like 512x256,128x64) are accepted and are safe ?

Thanks in advance


54
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 15, 2014, 09:10:11 am »
Thanks for your answer,

I want to ask you if other type of Object3D models (like .3ds,.obj ..) are planned to be supported in the near future.

Also i found some 3D models with non square textures and having not power of 2 width and size.

I know that these kind of textures are not supported by jPCT-ae, but do you know any way to be used by jPCT-ae? (scaling?,some tranformation? ..).

Thanks in advance

55
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 13, 2014, 09:59:00 pm »
Thanks for the answer.

I forgot to remove the unused vec4 theColor from fragment shader.

My current project is an Augmented Reality project.

I need to read the Augmented Object3D models from a data buffer not from a file.

This means that i dont know the format (.3ds, .obj,. md2 ..)  of the Object3D model stored in the data buffer.

The Object3D obj = Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId)   method could be a good candidate in this case.

One part of the data buffer can store the float[] coordinates,
other parts the float[] uvs, int[] indices  and textureID.

But  some Object3D formats like .obj provide the material info in a separate .mtl file.

For example a .mtl file can have a content like this:
 
newmtl policecar.png
Ns 0
Kd 0.8 0.8 0.8
Ks 0.0 0.0 0.0
Ka 0.2 0.2 0.2
d 1
illum 2
map_Kd policecar.png


I think that the previews Object3D constructor doesn't provide this kind of info.

What do you think about this issue?


Thanks in advance








56
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 13, 2014, 12:40:04 pm »

Thanks for your answer.

I wrote the following code:

       int vertices = object3D.getMesh().getUniqueVertexCount();
        Log.d(TAG," vertices = " + vertices);

        float[] data = new float[4*vertices];

        for(int i = 0; i < data.length; i++){
           
            data = 0.0f;
           
            if(i%3 == 1)
                data = 1f;
           
           
        }
         
        VertexAttributes  vattrs = new VertexAttributes("colorinfo",data,VertexAttributes.TYPE_FOUR_FLOATS);

        object3D.getMesh().addVertexAttributes(vattrs);
       
        GLSLShader  shader = new  GLSLShader( Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.vertexshader)),Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.fragmentshader)));

        object3D.setShader(shader);
       
       object3D.strip();
       object3D.build();
       world.addObject(object3D);

 The vertex shader is:

attribute vec4 colorinfo;
uniform mat4 modelViewProjectionMatrix;
attribute vec4 position;
varying vec4 vertexColor;


void main(void)
{
     vertexColor = colorinfo;
     gl_Position = modelViewProjectionMatrix * position;

}
 
And the fragment shader is:

varying vec4 theColor;
varying vec4 vertexColor;


void main(void)
{
 gl_FragColor = vertexColor;
}

I think that works . Am i correct? 

Also I have a question about the  method:


Object3D obj = Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId) 

How can I apply material info in this case to Object3D obj?

Thanks in advance.

57
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 10, 2014, 03:43:41 pm »
Hi again,

How  can i assign the vertex color colorinfo in the vertex shader?

I need to use the position of vertex inside the vertex shader program?

I wrote a program based on previews reply but compiler shows the following error message:

"Error missing attribute position in vertex shader"

Also, should I write and a fragment shader?

Can you give me an idea of how the vertex and (if needed) fragment shader must be?


Thanks in advance

58
Support / Re: Vertex colouring from last jPCT-AE version
« on: September 29, 2014, 09:35:51 pm »

Many thanks.
 

59
Support / Re: A Racing game
« on: September 29, 2014, 09:30:48 pm »
Thanks for your answer.

I agree that is better to load all the 3D Objects at the beginning of the game.

60
Support / A Racing game
« on: September 29, 2014, 12:02:23 pm »
Hi,

Im thinking to start a racing game.

But i dont know the best way to build the road.

Should I use plane 3D objects ?
Should I load the parts of the road once at the begining of the game or dynamically?


Thanks in advance



Pages: 1 2 3 [4] 5