Author Topic: OpenGL rendering with semi-static geometry  (Read 13540 times)

0 Members and 1 Guest are viewing this topic.

Offline Markohs

  • DevTeam, Coder/patcher
  • Devotee
  • *
  • Posts: 1559
  • Total likes: 2
  • Helpful: 86
  • Languages: EN,ES,CAT
Re: OpenGL rendering with semi-static geometry
« Reply #35 on: December 10, 2013, 08:28:18 PM »
I'll need more reading of the code to get the idea, and contribute to this. I see your points.

About point 1, are your refering obj_t is not the place to add this, or that we'll need more code and change how they are processed?

About 2, I don't really understand what's the difference between a 3D geometry and 2D sprites, aren't supposed 2D sprites to have a z-value? Yes, we have to be able to mix static geometries with moving objects, and update them separately. I thought y coordinate would solve this.

Do you think adding information for makeobj is needed for any of this or would simplify something?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4861
  • Total likes: 201
  • Helpful: 108
  • Languages: EN, NO
Re: OpenGL rendering with semi-static geometry
« Reply #36 on: December 10, 2013, 09:02:32 PM »
1. There are a couple of things, I don't remember exactly which apart from smoke, that escaped the generic thing I did to pick up most of the things that changed. I had to do some hacks to get those working.

2. The main problem with 3D geometry is that it doesn't always correspond with the real-life geometry of the objects, so pixels get a wrong z value. This caused overhead wires to be visible through the bridge above. Front images are visible through the back images on the tile in front. Vehicles disappear partially into the ground on slopes, and also come into conflict with front images, as well as the back images in front of these again.

I therefore think it's time to try out plain 2D billboarding (so more or less like my previous attempt, just divided into semi-static batches rather than fully streamed), but the trouble is coming up with good z-values that "always" work. Simutrans doesn't simply render things back to front, because that won't work well at all, nor does it get it 100 % correct the way it does it either.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8821
  • Total likes: 322
  • Helpful: 229
  • Languages: De,EN,JP
Re: OpenGL rendering with semi-static geometry
« Reply #37 on: December 10, 2013, 09:57:29 PM »
Why is the z-coordinate not just the order in the drawing list? That would give the same drawing order than 2D.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4861
  • Total likes: 201
  • Helpful: 108
  • Languages: EN, NO
Re: OpenGL rendering with semi-static geometry
« Reply #38 on: December 11, 2013, 06:40:28 AM »
Why is the z-coordinate not just the order in the drawing list? That would give the same drawing order than 2D.

That's more or less the idea, but the current drawing list isn't static. The z-coordinates of ground tiles, buildings and other static stuff must have gaps for vehicles and other moving objects "to pass through". The current drawing list isn't correct either, as already mentioned.