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

#1
Support / Re: Terminology of Object3D
December 09, 2011, 10:02:24 PM
Awesome, thanks for the code sample. I'll admit I am reluctant to use something like that. It does indeed seem very hackish, although it is difficult to argue with results. I'll work on something that combines each chunk into a single or low number of objects and compare to see which one of these solutions comes out ahead.
#2
Support / Re: Terminology of Object3D
December 09, 2011, 08:44:18 PM
Chunks would need to be redrawn and recompiled each time a chunk loads next to them or a block in the chunk changes. Is it expensive to recreate an object with ~3000 triangles? Only the chunk the player is in would ever need to be recreated in this manner.

I have to think a similar thing needs to be accomplished whether the rendering is accomplished through JPCT or just OpenGL. A chunk is made up of display lists at some point, whether that is

each chunk is 6 display lists, one for each tile side
each chunk tile is its own display list
every chunk tile is in a single display list

There must be a good middle ground that makes sense.

---

Thinking on the idea you posted, it does seem very hackish. Basically what that says to me is that it's more performant to leave vertices in the world vs. recompiling the object that contains them. If so, would it be less hackish to simply leave the tile face in, but change it to be completely transparent if it no longer needs to be rendered?
#3
Support / Re: Terminology of Object3D
December 09, 2011, 08:12:44 PM
I'm procedurally generating a world with a very blocky shape (think Minecraft or Infiniminer). The performance issues I'm pretty sure come from too many Object3Ds in the scene. Even with a small chunk of terrain like a single 16x16x16 chunk, there are 1536 tiles to render, assuming you cut out the interior faces. As more chunks get added, say even a tiny playable area like 6 chunks, it potentially gets into the couple thousand range of tiles, each its own Object3D. What makes sense from a design perspective (each face represented by an individual plane) doesn't seem to work when rendered in large numbers. If this sounds familiar it's because I made a post on this same issue almost a year ago.

Correct me if I'm wrong but my thinking is that tiles in a chunk need to be merged and recompiled so instead of 1536 Object3Ds you have one. Rendering 6 chunks isn't 5000 Object3Ds but 6. When I look at some of the other demos, which all render with great framerates, the main difference I notice is that while objects might have a lot of triangles within them, they are still just one contained Object3D. There clearly seems to be a disadvantage to rendering too many discrete objects in a scene. And since you can then compile the Object3D, you've got the entire chunk, all ~1000 faces of it, on a single display list (or VBO).

Edit: I feel like an idiot when I post on this subject. I spend a lot of timing writing web application code and then I try to render a simple graphics scene and I'm really out of my element. Perhaps that's what draws me to this time and time again.
#4
Support / Terminology of Object3D
December 09, 2011, 03:59:40 PM
I have a prototype I've been working on, which I originally started in OpenGL and am trying to port over to JPCT. The majority of this transfer was quite painless - JPCT is way easier to use than base OpenGL calls, and I can only see the benefits getting larger as the project progresses. However, I've not yet been able to get the same performance as the OpenGL solution. This morning I was thinking that a big part of the problem is I don't exactly know what some of these Object3D functions do behind the scenes.

From a high level, I view an Object3D as a set of triangles that, when added to a World, will be rendered. But that's perhaps not even accurate, and there's also several functions that need to be called that are in a lot ways very black-box in their description.

Here are the functions I'm curious about:

Quote
public void build()
Initializes some basic object properties that are needed for almost all further processing. build() should be called if the object is "ready to render" (loaded, Textures assigned, placed, rendering modes set...).
Adding new triangles to an object after calling build() may work but doesn't have to. If you want to do this, call unbuild() before.

Based on this description this tells me an Object3D is initially in a state that is not renderable. At a high level what does build do to make it renderable?

Quote
public void compile()
Compiles an Object3D. Don't confuse this with build(), which does something completely different. A compiled object can be rendered faster when using the hardware renderer but has some shortcomings...

Based on the Javadoc I'm assuming this sets up the Object3D in a display list or VBO (depending on settings).
#5
Support / Re: Merging Primitive planes
December 02, 2010, 04:23:26 PM
That worked. Thank you. :)
#6
Support / Re: Merging Primitive planes
December 01, 2010, 11:56:17 PM
A decent guess, but it's not visible from any angle. Camera is in fly mode and I have checked it from below, above, left, right, etc.
#7
Support / Merging Primitive planes
December 01, 2010, 08:37:25 PM
Is there any reason I shouldn't do:


Object3D plane1 = Primitives.getPlane(1, 10f);
Object3D plane2 = Primitives.getPlane(1, 10f);
plane2.rotateX((float) Math.toRadians(90));

Object3D merged = Object3D.mergeObjects(plane1, plane2);
world.addObject(merged);
world.buildAllObjects();


When I do so only one plane is visible.
#8
Support / Re: Performance with many objects
November 10, 2010, 03:39:30 PM
I solved this by eliminating all shared faces. I had assumed that overdrawing between the chunks wouldn't be a big deal but that proved false. Thanks for all your help.
#9
Support / Re: Performance with many objects
November 10, 2010, 03:41:05 AM
An important thing I should note is that the planes *between* chunks, the ones on the chunk edge, are always rendered. This was a design decision to allow chunks to be wholly separate entities. Each chunk does not know the contents of its neighbors and thus assumes it must render its outside faces. After this latest test I don't know if that design decision is going to hold up.
#10
Support / Re: Performance with many objects
November 10, 2010, 12:16:34 AM
Screenshot of what I'm rendering:



Log output:


run:
Java version is: 1.6.0_20
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Current mode:800 x 600 x 32 @75Hz
Driver is: atiu9p64 aticfx64 aticfx64 atiu9pag aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64/null on ATI Technologies Inc. / ATI Radeon HD 4800 Series
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
Loading Texture...res/grid.jpg
created new chunk
created new chunk
created new chunk
created new chunk
created new chunk
created new chunk
created new chunk
created new chunk
created new chunk
Compiling source object...
Subobject of object 1/object3 compiled using 2 vertices in 0ms!
Object 1/object3 compiled to 1 subobjects in 4ms!
Object 3/object5 precompiled!
Object 5/object7 precompiled!
Object 7/object9 precompiled!
Object 9/object11 precompiled!
Object 11/object13 precompiled!
Object 13/object15 precompiled!
Object 15/object17 precompiled!
Object 17/object19 precompiled!
Object 19/object21 precompiled!
Object 21/object23 precompiled!
Object 23/object25 precompiled!
Object 25/object27 precompiled!
Object 27/object29 precompiled!
Object 29/object31 precompiled!
Object 31/object33 precompiled!
Object 33/object35 precompiled!
Object 35/object37 precompiled!
Object 37/object39 precompiled!
Object 39/object41 precompiled!
Object 41/object43 precompiled!
Object 43/object45 precompiled!
Object 45/object47 precompiled!
Object 47/object49 precompiled!
Object 49/object51 precompiled!
Object 51/object53 precompiled!
Object 53/object55 precompiled!
Object 55/object57 precompiled!
Object 57/object59 precompiled!
Object 59/object61 precompiled!
Object 61/object63 precompiled!
Object 63/object65 precompiled!
Object 65/object67 precompiled!
Object 67/object69 precompiled!
Object 69/object71 precompiled!
Object 71/object73 precompiled!
Object 73/object75 precompiled!
Object 75/object77 precompiled!
Object 77/object79 precompiled!
Object 79/object81 precompiled!
Object 81/object83 precompiled!
Object 83/object85 precompiled!
Object 85/object87 precompiled!
Object 87/object89 precompiled!
Object 89/object91 precompiled!
Object 91/object93 precompiled!
Object 93/object95 precompiled!
Object 95/object97 precompiled!
Object 97/object99 precompiled!
Object 99/object101 precompiled!
Object 101/object103 precompiled!
Object 103/object105 precompiled!
Object 105/object107 precompiled!
Object 107/object109 precompiled!
Object 109/object111 precompiled!
Object 111/object113 precompiled!
Object 113/object115 precompiled!
Object 115/object117 precompiled!
Object 117/object119 precompiled!
Object 119/object121 precompiled!
Object 121/object123 precompiled!
Object 123/object125 precompiled!
Object 125/object127 precompiled!
Object 127/object129 precompiled!
Object 129/object131 precompiled!
Object 131/object133 precompiled!
Object 133/object135 precompiled!
Object 135/object137 precompiled!
Object 137/object139 precompiled!
Object 139/object141 precompiled!
Object 141/object143 precompiled!
Object 143/object145 precompiled!
Object 145/object147 precompiled!
Object 147/object149 precompiled!
Object 149/object151 precompiled!
Object 151/object153 precompiled!
Object 153/object155 precompiled!
Object 155/object157 precompiled!
Object 157/object159 precompiled!
Object 159/object161 precompiled!
Object 161/object163 precompiled!
Object 163/object165 precompiled!
Object 165/object167 precompiled!
Object 167/object169 precompiled!
Object 169/object171 precompiled!
Object 171/object173 precompiled!
Object 173/object175 precompiled!
Object 175/object177 precompiled!
Object 177/object179 precompiled!
Object 179/object181 precompiled!
Object 181/object183 precompiled!
Object 183/object185 precompiled!
Object 185/object187 precompiled!
Object 187/object189 precompiled!
Object 189/object191 precompiled!
Object 191/object193 precompiled!
Object 193/object195 precompiled!
Object 195/object197 precompiled!
Object 197/object199 precompiled!
Object 199/object201 precompiled!
Object 201/object203 precompiled!
Object 203/object205 precompiled!
Object 205/object207 precompiled!
Object 207/object209 precompiled!
Object 209/object211 precompiled!
Object 211/object213 precompiled!
Object 213/object215 precompiled!
Object 215/object217 precompiled!
Object 217/object219 precompiled!
Object 219/object221 precompiled!
Object 221/object223 precompiled!
Object 223/object225 precompiled!
Object 225/object227 precompiled!
Object 227/object229 precompiled!
Object 229/object231 precompiled!
Object 231/object233 precompiled!
Object 233/object235 precompiled!
Object 235/object237 precompiled!
Object 237/object239 precompiled!
Object 239/object241 precompiled!
Object 241/object243 precompiled!
Object 243/object245 precompiled!
Object 245/object247 precompiled!
Object 247/object249 precompiled!
Object 249/object251 precompiled!
Object 251/object253 precompiled!
Object 253/object255 precompiled!
Object 255/object257 precompiled!
Object 257/object259 precompiled!
Object 259/object261 precompiled!
Object 261/object263 precompiled!
Object 263/object265 precompiled!
Object 265/object267 precompiled!
Object 267/object269 precompiled!
Object 269/object271 precompiled!
Object 271/object273 precompiled!
Object 273/object275 precompiled!
Object 275/object277 precompiled!
Object 277/object279 precompiled!
Object 279/object281 precompiled!
Object 281/object283 precompiled!
Object 283/object285 precompiled!
Object 285/object287 precompiled!
Object 287/object289 precompiled!
Object 289/object291 precompiled!
Object 291/object293 precompiled!
Object 293/object295 precompiled!
Object 295/object297 precompiled!
Object 297/object299 precompiled!
Object 299/object301 precompiled!
Object 301/object303 precompiled!
Object 303/object305 precompiled!
Object 305/object307 precompiled!
Object 307/object309 precompiled!
Object 309/object311 precompiled!
Object 311/object313 precompiled!
Object 313/object315 precompiled!
Object 315/object317 precompiled!
Object 317/object319 precompiled!
Object 319/object321 precompiled!
Object 321/object323 precompiled!
Object 323/object325 precompiled!
Object 325/object327 precompiled!
Object 327/object329 precompiled!
Object 329/object331 precompiled!
Object 331/object333 precompiled!
Object 333/object335 precompiled!
Object 335/object337 precompiled!
Object 337/object339 precompiled!
Object 339/object341 precompiled!
Object 341/object343 precompiled!
Object 343/object345 precompiled!
Object 345/object347 precompiled!
Object 347/object349 precompiled!
Object 349/object351 precompiled!
Object 351/object353 precompiled!
Object 353/object355 precompiled!
Object 355/object357 precompiled!
Object 357/object359 precompiled!
Object 359/object361 precompiled!
Object 361/object363 precompiled!
Object 363/object365 precompiled!
Object 365/object367 precompiled!
Object 367/object369 precompiled!
Object 369/object371 precompiled!
Object 371/object373 precompiled!
Object 373/object375 precompiled!
Object 375/object377 precompiled!
Object 377/object379 precompiled!
Object 379/object381 precompiled!
Object 381/object383 precompiled!
Object 383/object385 precompiled!
Object 385/object387 precompiled!
Object 387/object389 precompiled!
Object 389/object391 precompiled!
Object 391/object393 precompiled!
Object 393/object395 precompiled!
Object 395/object397 precompiled!
Object 397/object399 precompiled!
Object 399/object401 precompiled!
Object 401/object403 precompiled!
Object 403/object405 precompiled!
Object 405/object407 precompiled!
Object 407/object409 precompiled!
Object 409/object411 precompiled!
Object 411/object413 precompiled!
Object 413/object415 precompiled!
Object 415/object417 precompiled!
Object 417/object419 precompiled!
Object 419/object421 precompiled!
Object 421/object423 precompiled!
Object 423/object425 precompiled!
Object 425/object427 precompiled!
Object 427/object429 precompiled!
Object 429/object431 precompiled!
Object 431/object433 precompiled!
Object 433/object435 precompiled!
Object 435/object437 precompiled!
Object 437/object439 precompiled!
Object 439/object441 precompiled!
Object 441/object443 precompiled!
Object 443/object445 precompiled!
Object 445/object447 precompiled!
Object 447/object449 precompiled!
Object 449/object451 precompiled!
Object 451/object453 precompiled!
Object 453/object455 precompiled!
Object 455/object457 precompiled!
Object 457/object459 precompiled!
Object 459/object461 precompiled!
Object 461/object463 precompiled!
Object 463/object465 precompiled!
Object 465/object467 precompiled!
Object 467/object469 precompiled!
Object 469/object471 precompiled!
Object 471/object473 precompiled!
Object 473/object475 precompiled!
Object 475/object477 precompiled!
Object 477/object479 precompiled!
Object 479/object481 precompiled!
Object 481/object483 precompiled!
Object 483/object485 precompiled!
Object 485/object487 precompiled!
Object 487/object489 precompiled!
Object 489/object491 precompiled!
Object 491/object493 precompiled!
Object 493/object495 precompiled!
Object 495/object497 precompiled!
Object 497/object499 precompiled!
Object 499/object501 precompiled!
Object 501/object503 precompiled!
Object 503/object505 precompiled!
Object 505/object507 precompiled!
Object 507/object509 precompiled!
Object 509/object511 precompiled!
Object 511/object513 precompiled!
Object 513/object515 precompiled!
Object 515/object517 precompiled!
Object 517/object519 precompiled!
Object 519/object521 precompiled!
Object 521/object523 precompiled!
Object 523/object525 precompiled!
Object 525/object527 precompiled!
Object 527/object529 precompiled!
Object 529/object531 precompiled!
Object 531/object533 precompiled!
Object 533/object535 precompiled!
Object 535/object537 precompiled!
Object 537/object539 precompiled!
Object 539/object541 precompiled!
Object 541/object543 precompiled!
Object 543/object545 precompiled!
Object 545/object547 precompiled!
Object 547/object549 precompiled!
Object 549/object551 precompiled!
Object 551/object553 precompiled!
Object 553/object555 precompiled!
Object 555/object557 precompiled!
Object 557/object559 precompiled!
Object 559/object561 precompiled!
Object 561/object563 precompiled!
Object 563/object565 precompiled!
Object 565/object567 precompiled!
Object 567/object569 precompiled!
Object 569/object571 precompiled!
Object 571/object573 precompiled!
Object 573/object575 precompiled!
Object 575/object577 precompiled!
Object 577/object579 precompiled!
Object 579/object581 precompiled!
Object 581/object583 precompiled!
Object 583/object585 precompiled!
Object 585/object587 precompiled!
Object 587/object589 precompiled!
Object 589/object591 precompiled!
Object 591/object593 precompiled!
Object 593/object595 precompiled!
Object 595/object597 precompiled!
Object 597/object599 precompiled!
Object 599/object601 precompiled!
Object 601/object603 precompiled!
Object 603/object605 precompiled!
Object 605/object607 precompiled!
Object 607/object609 precompiled!
Object 609/object611 precompiled!
Object 611/object613 precompiled!
Object 613/object615 precompiled!
Object 615/object617 precompiled!
Object 617/object619 precompiled!
Object 619/object621 precompiled!
Object 621/object623 precompiled!
Object 623/object625 precompiled!
Object 625/object627 precompiled!
Object 627/object629 precompiled!
Object 629/object631 precompiled!
Object 631/object633 precompiled!
Object 633/object635 precompiled!
Object 635/object637 precompiled!
Object 637/object639 precompiled!
Object 639/object641 precompiled!
Object 641/object643 precompiled!
Object 643/object645 precompiled!
Object 645/object647 precompiled!
Object 647/object649 precompiled!
Object 649/object651 precompiled!
Object 651/object653 precompiled!
Object 653/object655 precompiled!
Object 655/object657 precompiled!
Object 657/object659 precompiled!
Object 659/object661 precompiled!
Object 661/object663 precompiled!
Object 663/object665 precompiled!
Object 665/object667 precompiled!
Object 667/object669 precompiled!
Object 669/object671 precompiled!
Object 671/object673 precompiled!
Object 673/object675 precompiled!
Object 675/object677 precompiled!
Object 677/object679 precompiled!
Object 679/object681 precompiled!
Object 681/object683 precompiled!
Object 683/object685 precompiled!
Object 685/object687 precompiled!
Object 687/object689 precompiled!
Object 689/object691 precompiled!
Object 691/object693 precompiled!
Object 693/object695 precompiled!
Object 695/object697 precompiled!
Object 697/object699 precompiled!
Object 699/object701 precompiled!
Object 701/object703 precompiled!
Object 703/object705 precompiled!
Object 705/object707 precompiled!

... this goes on for awhile! Had to truncate it because the forum software wouldn't let me put this many characters in one post.


The class which creates the planes does so with methods like this:


private static void initModel() {
        if(MODEL == null) {
            MODEL = Primitives.getPlane(1, 1);
            MODEL.build();
            MODEL.compile();
        }
    }

public void drawTop() {
        renderable = true;

        Object3D plane = new Object3D(MODEL, true);
        plane.rotateX((float)Math.toRadians(90));
        plane.translate(position.x, position.y-0.5f, position.z);
        //plane.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
        plane.setTexture("grid");
        plane.build();
        plane.shareCompiledData(MODEL);
        plane.compile();
        planes.add(plane);
    }
public Object3D[] getObjects() {
        return planes.toArray(new Object3D[0]);
    }


In that screenshot I made 38 chunks 4*4*4 which is ((4*4)*6 ) * 38 = 3648 planes/quads/faces. Within each chunk there are no inner faces being created. There's nothing else in the scene. You can see the FPS I'm achieving there (obviously FRAPS kills this a bit).

I'm not running any Config flags, just using default settings. Renderer is:

FrameBuffer buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
#11
Support / Re: Performance with many objects
November 09, 2010, 08:43:17 PM
Yeah, that's pretty conclusive. There's something I could/should be doing to my plane creation to make it render faster... I assume the same compile, clone steps as above? I will do a thorough test of those techniques tonight.
#12
Support / Re: Performance with many objects
November 09, 2010, 04:26:34 PM
Given the results we've gotten so far I went ahead and came up with an algorithm that generates a "chunk" of 8x8x8 cubes with no inner faces. I say "cube" but each part of the overall chunk is no longer a cube persay, but an object that is capable of creating only the faces (which are planes) that it's instructed to. So an inner cube has no faces at all where an outside one has 1-3.

Previously I was creating (8^3)*6 faces = 3,072 faces for a chunk of this size. Now it's (8*2)*6 = 96. However, after plugging this back into my dynamic terrain generation and generating about 15 chunks I was disappointed to find the FPS dropping quickly. 15 chunks is about 1,440 planes, half of which are back culled, which I would assume can be rendered quite easily. My computer isn't too old.... Core 2 Duo @ 3.0 GHz, 4 GB RAM, modern graphics card, but I get about 30 FPS.

Are these results typical? I tried reusing the same plane and compiling it like we discussed above, but the results were similar.

Edit: I want to thank you again for looking into these issues. I'm a professional developer but don't have a lot of experience (yet) with graphics. It really is a whole new set of challenges.
#13
Support / Re: Performance with many objects
November 07, 2010, 02:20:56 AM
Very comprehensive analysis. I've gone back to my OpenGL test case and perhaps I had some confirmation bias going on at the time because the performance isn't as good as I stated previously. I wasn't running an FPS monitor and it just felt smoother, but the numbers don't lie. It's a little better, but not significantly. After doing the adjustments you've laid out the performance is pretty similar to JPCT, so thanks for that advice.

Is there any culling I could implement to have the renderer ignore the cubes that are clearly not visible? In the case I sent you most of those cubes are completely obscured by the ones on top/in front of them. I'll look into what I can do, but I'm also curious if you have any suggestions.
#14
Support / Re: Performance with many objects
November 06, 2010, 03:37:34 PM
Sent a simple test case to hostmaster@jpct.net
#15
Support / Re: Performance with many objects
November 06, 2010, 05:45:07 AM

Java version is: 1.6.0_20
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Current mode:800 x 600 x 32 @75Hz
Driver is: atiu9p64 aticfx64 aticfx64 atiu9pag aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64/null on ATI Technologies Inc. / ATI Radeon HD 4800 Series
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
Loading Texture...res/rock.jpg
Loading Texture...res/sky.gif
Loading Texture...res/sky2.gif
Software renderer disposed
Hardware supports textures up to 8192*8192 in size!
OpenGL renderer disposed