Page 2 of 3

Re: OpenGL 3D viewport renderer

Posted: 04 Dec 2019 17:03
by milek7
Assert wrote: 03 Dec 2019 23:56 No, this is just because the land generator do not invalidate all of the tiles, just save and load. I will fix this soon.
That fixes missing tiles, but I meant that UI graphics are pixelated: https://i.imgur.com/4yPs6wE.png I tracked it to be caused by sampling atlases at wrong mipmap level, removing that from code fixed it for me:

Code: Select all

glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_LOD_BIAS, 0.5);

Re: OpenGL 3D viewport renderer

Posted: 04 Dec 2019 20:28
by Assert
milek7 wrote: 04 Dec 2019 17:03
Assert wrote: 03 Dec 2019 23:56 No, this is just because the land generator do not invalidate all of the tiles, just save and load. I will fix this soon.
That fixes missing tiles, but I meant that UI graphics are pixelated: https://i.imgur.com/4yPs6wE.png I tracked it to be caused by sampling atlases at wrong mipmap level, removing that from code fixed it for me:

Code: Select all

glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_LOD_BIAS, 0.5);
Ah, i see. Thisng not so simple. Without this bias too hi level is selected on my hardware. Probably this is something dependent to the drivers or hints. I will make an explicit mip level selection in the shader.

Re: OpenGL 3D viewport renderer

Posted: 14 Dec 2019 08:49
by Assert
milek7 wrote: 04 Dec 2019 17:03 That fixes missing tiles, but I meant that UI graphics are pixelated: https://i.imgur.com/4yPs6wE.png I tracked it to be caused by sampling atlases at wrong mipmap level, removing that from code fixed it for me:

Code: Select all

glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_LOD_BIAS, 0.5);
Fixed, with a lot of other things https://github.com/Assert1/OpenTTD

Re: OpenGL 3D viewport renderer

Posted: 14 Dec 2019 21:08
by modreoci
I compiled and ran game but 3D viewports does note appear... I also made appropriate settings like in the video... What I have to do? (Manjaro Linux)

Re: OpenGL 3D viewport renderer

Posted: 14 Dec 2019 22:45
by Assert
modreoci wrote: 14 Dec 2019 21:08 I compiled and ran game but 3D viewports does note appear... I also made appropriate settings like in the video... What I have to do? (Manjaro Linux)
It's better to contact milek7 about nix, i can't test it in my env:(

Re: OpenGL 3D viewport renderer

Posted: 15 Dec 2019 10:36
by milek7
https://github.com/Assert1/OpenTTD/blob ... v.cpp#L172
Replace that line with #if 1
The other if branch was for OpenGL ES (mobile devices etc., but some other changes necessary for GLES weren't merged from my branch)

Re: OpenGL 3D viewport renderer

Posted: 15 Dec 2019 22:33
by Assert
milek7 wrote: 15 Dec 2019 10:36 https://github.com/Assert1/OpenTTD/blob ... v.cpp#L172
Replace that line with #if 1
The other if branch was for OpenGL ES (mobile devices etc., but some other changes necessary for GLES weren't merged from my branch)
Latest changes shoud work with ES profile... at least, i am tested it in windows, and everything is ok...

Re: OpenGL 3D viewport renderer

Posted: 16 Dec 2019 06:38
by stefino_cz
I had a chat with Assert yesterday about this 3D mode. It looks really good but I found a problem with vehicle length. 3D models have constant length and it seems like a big problem because 3D environment still uses 2D engine which changes the length of the vehicle at the direction. This fact produces big spaces between wagons in _ and I directions. The question is if this problem has any solution :|

Re: OpenGL 3D viewport renderer

Posted: 16 Dec 2019 08:15
by Assert
stefino_cz wrote: 16 Dec 2019 06:38 I had a chat with Assert yesterday about this 3D mode. It looks really good but I found a problem with vehicle length. 3D models have constant length and it seems like a big problem because 3D environment still uses 2D engine which changes the length of the vehicle at the direction. This fact produces big spaces between wagons in _ and I directions. The question is if this problem has any solution :|
This is not a problem, and this is a fundamental thing in OTTD, because it uses integer space coordinates.

Re: OpenGL 3D viewport renderer

Posted: 20 Dec 2019 19:42
by jimbob
This looks amazing. I've got some low poly 3d models I was making for my own game, I'd be happy to share them to help with this project.

Re: OpenGL 3D viewport renderer

Posted: 04 Jan 2020 01:11
by pelya
After 15 years of development, OpenTTD is getting a revolutionary new feature - rotate the map in any direction!

I'm tempted to release this as Android version on April 1st for one week, of course rename it to 'OpenTTD 3D' in gaudy 3D font. All NewGRFs will be rendered as billboard-style flat sprites, like monsters from Doom (1993), aesthetics be damned.

Re: OpenGL 3D viewport renderer

Posted: 12 Jan 2020 09:31
by Zephyris
Very cool! How does it link sprites to 3D models to know what to use? If you fixed the vertical elevation of the camera you could probably get away with billboarding trees.

I wouldn't try to grab anything from zBase though, those models are wildly unoptimised for real time 3D!

Re: OpenGL 3D viewport renderer

Posted: 12 Jan 2020 09:59
by NekoMaster
Would it be possible for someone to post a binary? I can never seem to get compiling on windows to work.

Re: OpenGL 3D viewport renderer

Posted: 13 Jan 2020 17:51
by mando
I had literally just tried doing this myself, seeing as you've gotten this far, I will save myself some effort. It looks very cool, just needs some 3DGRFs.

Re: OpenGL 3D viewport renderer

Posted: 14 Jan 2020 13:32
by MagicBuzz
All what I can say about newgrf is...

Ok, newgrf (as their name say) are... graphics. And graphics are eyecandy.
3D is eyecandy too.

As a result, I don't think the lack of 3D newgrf is a real matter : you choose right now to play with newgrf eyecandy or 3D eyecandy.
Next newgrf versions could implement 3D graphics.
It's the same problem with 32 bits + max zoom newgrfs : most of newgrf doesn't support max zoom, that's not a reason do not support it.

Next, most newgrfs are not simply eyecandy : there are vehicle properties, industries properties, new cargos, etc. so existing newgrf are still usefull.

IMO 3D port is a very good thing.

Re: OpenGL 3D viewport renderer

Posted: 18 Jan 2020 10:30
by jimbob
MagicBuzz wrote: 14 Jan 2020 13:32 All what I can say about newgrf is...

Ok, newgrf (as their name say) are... graphics. And graphics are eyecandy.
3D is eyecandy too.

As a result, I don't think the lack of 3D newgrf is a real matter : you choose right now to play with newgrf eyecandy or 3D eyecandy.
Next newgrf versions could implement 3D graphics.
It's the same problem with 32 bits + max zoom newgrfs : most of newgrf doesn't support max zoom, that's not a reason do not support it.

Next, most newgrfs are not simply eyecandy : there are vehicle properties, industries properties, new cargos, etc. so existing newgrf are still usefull.

IMO 3D port is a very good thing.
Quite, first thing first is a set of base models. Then newgrfs can default to a base graphic until some creates the proper graphic for the new vehicle/building etc...

I've some 3d models I want to load into this, the day I get some free time to try it out.

Re: OpenGL 3D viewport renderer

Posted: 03 Apr 2020 10:56
by SirkoZ
How about a 2D approach - to increase color depth of any existing sprite be it newgrf or old via some sort of upscaling via OpenGL. Just to get smoother transitions between the pixels of each sprite.
That is the most important thing to reduce the strain on eyes of any TTD or TTO because if its 256-bit graphics.
3D terrain can come later. A friend and I made a 3D OpenGL terrain similar to TTD's ages ago (year 1998) on linux before OpenTTD was created and it worked well and one could change tile textures on the fly, but it wasn't developed into a real game.

Re: OpenGL 3D viewport renderer

Posted: 04 May 2020 08:23
by mrgiords
Personally I find this prototype fantastic and I hope that it gets developed more! :bow:

One thing I always found a bit difficult and frustrating with OpenTTD is terrain reshaping and map exploration: I think 3D would help a lot in this sense.

My only concern would be about performance, it would be a pity if it was not possible to create the same amount of vehicles that one can create now. But I'm ignorant about the technology side, so it might not really be a problem.

Awesome idea! :)

Re: OpenGL 3D viewport renderer

Posted: 04 May 2020 13:40
by kamnet
I've tried running this a couple of times now, and unfortunately it starts off really laggy, then my mouse starts very slowly moving all over the place, outside of my control, before it stops responding and Windows wants to shut it down.

Re: OpenGL 3D viewport renderer

Posted: 16 May 2020 14:07
by zbx1425
I would like to say this is an awesome project, and I rushed to try it out.
However, it does not seem to be working on my device...
I downloaded the binary, reset the configuration, and the program crashed instantly at startup.

The OS was Windows 10 1709, and the graphics adapter was Intel UHD Graphics 630.

I have little knowledge of C++ so I cannot help :cry:

Crash Log: https://pastebin.com/HqVqwHuq
Crash Dump: https://drive.google.com/file/d/1T-qmnw ... sp=sharing