Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Joining meshes programaticly  (Read 938 times)
0 Members and 1 Guest are viewing this topic.
Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Posted 2013-06-04 21:56:20 »

Hello everyone, im currently (trying) to create a character for a project, but im already having a little problem.
Im trying to render each bodypart stand-alone for maximum customizability, but now i need to find out how to "join" these parts.

Example (joint on leg / torso):


Is there any method / algorithm created to remove these seams of separate objects?
Im thinking about cutting off both objects, and add vertrices at these joining points, but i have no idea how to find out what faces are intersecting and where to add vertrices.

*note: these models are generated by code in a loop like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
    private void renderLeg(float x, float y){
        float xpos = x;
        float ypos = y;
       
        float step = SimpleMath.PI2f / 16;
        float currentw = 0, textw = 0, texth = 0;
               
        float[] sidearray = new float[] { 0, 8, 14, 16, 17, 16, 10, 10, 11, 10, 6, 0 };
        float[] heightarray = new float[] { 2, 2, 8, 8, 8, 35, 8, 8, 8, 2, 2, 0 };
       
        Vector3f v1, v2, v3, v4;
       
        for(int h = 0; h < sidearray.length-1; h++){
            for(float r = 0; r <= SimpleMath.PI2f; r += step){

                float bx = xpos + SimpleMath.sinf(r) * sidearray[h+1];
                float tx = xpos + SimpleMath.sinf(r) * sidearray[h];
                float tz = SimpleMath.cosf(r) * sidearray[h];
                float bz = SimpleMath.cosf(r) * sidearray[h+1];
                float tx2 = xpos + SimpleMath.sinf(r+step) * sidearray[h];
                float bx2 = xpos + SimpleMath.sinf(r+step) * sidearray[h+1];
                float tz2 = SimpleMath.cosf(r+step) * sidearray[h];
                float bz2 = SimpleMath.cosf(r+step) * sidearray[h+1];
               
                v1 = new Vector3f(tx2, ypos,tz2);
                v2 = new Vector3f(bx2, ypos+heightarray[h],bz2);
                v3 = new Vector3f(bx, ypos+heightarray[h],bz);
                v4 = new Vector3f(tx,ypos,tz);
               
                TrianglePoint_Tree tp1 = new TrianglePoint_Tree(v1, new Vector2f(currentw+textw, texth), 0, 0f);
                TrianglePoint_Tree tp2 = new TrianglePoint_Tree(v2, new Vector2f(currentw+textw, 0), 0, 0f);
                TrianglePoint_Tree tp3 = new TrianglePoint_Tree(v3, new Vector2f(currentw, 0), 0, 0f);
                TrianglePoint_Tree tp4 = new TrianglePoint_Tree(v4, new Vector2f(currentw, texth), 0, 0f);

                vbo.addTriangle(tp1, tp2, tp3);
                vbo.addTriangle(tp3, tp4, tp1);
            }
           
            ypos += heightarray[h];
        }
    }
Offline NegativeZero

JGO Knight


Medals: 30
Projects: 2
Exp: 3 years


Zero but not.


« Reply #1 - Posted 2013-06-05 12:27:38 »

You may want to look into how metaballs work.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (33 views)
2014-07-18 06:55:21

Zero Volt (29 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (26 views)
2014-07-16 23:30:00

Cero (41 views)
2014-07-16 00:42:17

Riven (43 views)
2014-07-14 18:02:53

OpenGLShaders (31 views)
2014-07-14 16:23:47

Riven (30 views)
2014-07-14 11:51:35

quew8 (29 views)
2014-07-13 13:57:52

SHC (65 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!