Author Topic: Large size model can't be displayed properly  (Read 4639 times)

Offline nm123

  • byte
  • *
  • Posts: 9
    • View Profile
Large size model can't be displayed properly
« on: November 18, 2010, 03:20:47 pm »
I try to load large size models with  jPCT-AE in android emulator, for example to show a plane:

plane = Primitives.getPlane(2, 1000000);

and set Config.farPlane = 100000000. The plane can't be shown in whole. When the camera move/turn, some broken color blocks(the plane's texture color) are flashing everywhere on the screen. ???...

What can I do in the code to get the LARGE size model displayed properly without above problem?!

Thanks in advance...

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Large size model can't be displayed properly
« Reply #1 on: November 18, 2010, 03:25:58 pm »
have a look at Config.maxPolysVisible

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Large size model can't be displayed properly
« Reply #2 on: November 18, 2010, 03:46:51 pm »
This is an insanely large plane. You'll most likely run into accuracy issues with that, which are imposed by the gpu itself. There's just one solution: Don't do it. If you want a large plane, split it.

Offline nm123

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Large size model can't be displayed properly
« Reply #3 on: November 18, 2010, 04:01:43 pm »
Thanks for the replies and advise. Just a question:  how many polygons in the plane for following:

plane = Primitives.getPlane(1, 100000);

suppose not many, right?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Large size model can't be displayed properly
« Reply #4 on: November 18, 2010, 04:47:18 pm »
Two. But that's not the point. They are not polygons, they are monsters...much too large.

Offline nm123

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Large size model can't be displayed properly
« Reply #5 on: November 18, 2010, 05:29:00 pm »
I agree it's somehow insane :D. But it's useful in the case of making a large ground with edges close to the far horizontial line as much as possible so that from the view of camera the edges can't be seen (nearly).

And the large plane doesn't have many polygons for performance reason.

I saw in some 3d libs this can be done, so suppose JPCT-AE can do it too. :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Large size model can't be displayed properly
« Reply #6 on: November 18, 2010, 11:49:58 pm »
There's no magic involved in rendering a large plane, no secret switch or magic code or something. If you create it, render it and it looks wrong, it just doesn't work...at least on your platform. There's no way around this except not to do it. Just cover the edges in fog...

As said, mobile gpus lack accuracy, which is most likely the reason for this.

Offline nm123

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Large size model can't be displayed properly
« Reply #7 on: November 20, 2010, 06:45:50 pm »
Oh well, if don't use this super large ground, how can I make the effect that an airplane or walker can not see the ground boundaries and can never come close to the boundary edges? Use a relatively large ground model won't help because the airplane/walker can eventually move close and reach to the edges, in that case fog won't help... I would like the airplane/walker can go any directions and there are no walls to block its way.

Your ideas/tips will be much appreciated!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Large size model can't be displayed properly
« Reply #8 on: November 20, 2010, 09:20:06 pm »
You may try to create an infinite plane by code..."just" detect in which direction the player is facing and transform a fixed set of sub-plane objects so that they form the plane before him. If you are moving too far away from the origin, you might have to shift the whole world though, or otherwise you'll run into accuracy problems again.

Have a look at my game Alien Runner. It uses the same approach in a simplified form for the race track. You could race to infinity on that thing you the game would let you...it just takes the part that leaves the screen and attaches it again at the far end, which results in an infinite track.

Offline nm123

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Large size model can't be displayed properly
« Reply #9 on: November 22, 2010, 05:10:02 am »
Thanks for the suggestions... Where can I get the source code for the Alien Runner game?