Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Progress using 3D in Gideros — Gideros Forum

Progress using 3D in Gideros

I'm having a hard time prying myself away from the computer since I've gotten into 3D coding with Gideros, having been away from 3D work for a number of years. I mentioned on another thread that I was looking into whether Gideros's 3D support was usable for a new fishing game I have planned, or if I'd need to use pre-rendered textures and build the game in 2D. I dabbled in Unity, but didn't care for the layers and the interface, and would much rather work with a system that just lets me load or create meshes from Blender models, and code all the behavior directly. I'm thrilled to find that Gideros can do a lot more than I would have guessed. Sure, there are limitations, like no support for models with animated armatures, as far as I know, but for an engine that's primarily 2D, it can do plenty of 3D.

Today I made a custom shader that handles aerial perspective (fog, to make distant objects look distant), and to fog underwater objects relative to the depth and the viewing angle, plus water clarity, basically specialized fog that only applies below the surface. So far that's working fine on the landscape, but not with other subsurface objects, so it still needs work, but the effect on the lake bottom is exactly what I had in mind. It's my first experiment with a custom shader, and I clearly have a lot to learn, but it's an encouraging start. I've improved the heightfield code for performance, tried swapping in a landcsape mesh with 16 times more detail than I was using, and it still behaves nicely. I changed my water surface animation method to apply just to the area around the viewer, rather than over the entire body of water, which allows me to scale up the whole world greatly without hurting performance.

If anyone is interested in the heightfield landscape code, or the fogging shader, let me know and I'll share some modules.

Here's the progress so far:





Paul
+1 -1 (+6 / -0 )Share on Facebook

Comments

  • SinisterSoftSinisterSoft Maintainer
    Accepted Answer
    It looks great. :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • wow it looks awesome, I didn't know we could something like that in Gideros
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • hgy29hgy29 Maintainer
    I am working on animated models support. I will let you know...
    +1 -1 (+4 / -0 )Share on Facebook
  • PaulHPaulH Member
    edited November 2019
    Oooh... That's really cool! There are lots of things I've used animated models for in the past that I thought I'd do in Gideros using sets of pre-posed models, or break models into parts and move them relative to one another, but models with animations would be much smoother, and more straightforward. I'd love to have that!

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited November 2019
    @PaulH I nominate you GIDEROS 3D CODER OF THE DECADE :)
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • Thanks, but if there were such an honor, my nomination would go to @hgy29, for the addition of animated models. I can't wait to starting working with that.

    Here's what my project looks like with another week of progress:





    I've fixed some things in the height field mesh generation, fixed the underwater shader and improved the main shader, added programatically generated lakes with variable geographical features, changed the controls from buttons to sliders, added swiping from the center to look around, and today I added a system that populates the world with objects (trees, etc) a zone at a time, fading them in as you approach, and fading them out and removing them from the scene when they're far away. There are still some artifacts in the landscape objects, and there's lots of improvement to be made there, and everywhere, but this has been a good test of performance.

    Even with object density cranked up pretty high, it's still plenty smooth on a Galaxy S10. An old GS4 can only manage around 10 fps at that level, but one can always decrease the amount of scenery detail on slower devices.

    +1 -1 (+6 / -0 )Share on Facebook
  • Apollo14Apollo14 Member
    edited November 2019
    PaulH said:

    An old GS4 can only manage around 10 fps at that level, but one can always decrease the amount of scenery detail on slower devices.

    That's what I was talking about when I said that 3D is too sophisticated.

    For decent 3D we'd need occlusion culling, mesh combining, mesh LODs, benchmarking drawcalls/triangles, etc. And lots of other stuff.

    Honestly, it'd be better for Gideros to become solid 2D engine with support of industry standard SDKs that are required by every mobile publisher, shader editors, particle editors, etc. Or it will become neither fish nor flesh.

    (if someone asked my opinion)

    Likes: oleg

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    Apollo14 said:


    For decent 3D we'd need occlusion culling, mesh combining, mesh LODs, benchmarking drawcalls/triangles, etc. And lots of other stuff.

    Actually it depends on what you want to do, and you can always do that yourself in lua. Keep in mind that modern hardware can easily do with brute force what old games did with lots of optimizations. I am already surprised when I see what people can do with Gideros limited 3D support.

    +1 -1 (+2 / -0 )Share on Facebook
  • I've thought about adding more functions common to 3D engines, like the mesh LODs. That would be easy enough to add in the Lua code, and I'll do that if I need to in order to get 30 FPS on the oldest devices I expect to support. But the easiest way to keep the frame rate up is just to keep the amount of detail reasonable, and I'm impressed at how much detail I could add to a large area before it became an issue for the old phone. The scene I'm rendering represents almost 4 square miles (10 square km) and to test the limits I added quite a few thousand trees, far more than necessary to make the shoreline of the lake look densely wooded. The final game will probably just use far fewer trees, or (as long as they're just scenery and don't impact the gameplay) I may adjust the level of detail based on the performance of the device.

    One aspect of Gideros that's been hugely helpful is the sprite child hierarchy. That makes it simple to make sure all the solid meshes in the scene get rendered before those using alpha textures, so that alpha areas don't occlude items behind them. Those objects with textures with alphas become children of a sprite that gets added to the scene after the sprites containing solid objects. The child hierarchy also made it efficient to add detail elements (vegetation, etc.) to the scene a zone at a time as they approach, and fade and remove them when they're far away. Each zone just get sprites (one for solids, one for objects with alpha) with children for all the detail items, so all the detail items for a zone can get added or removed together.

    Even if Gideros never tries to become a full featured 3D game engine, but just continues to provide some of the basics that people can build on as needed, it's plenty powerful for the game I have in mind, far more capable than I expected. I also find it much more straightforward than Unity or other engines I've tried.

    Likes: hgy29, MoKaLux

    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    @PaulH, I added basic instancing support in Gideros recently. It allows to draw a large amount of instances of the same shape with almost no CPU overhead. It needs custom shaders though.
  • Interesting... I'd like to have a look at that. Right now I only really see the CPU hit from adding a lot of simple meshes at the moment when new zones move into range and a lot of instances get added at once. I've been thinking of moving some of that processing to a separate thread. I haven't profiled that code, so I don't know how much of the processing time goes into testing potential locations for each item, vs creating and adding the meshes. If the latter is the bigger job for the CPU, and there's a more efficient solution, I'd certainly check that out.



  • Continued progress on building a 3D game in Gideros...

    In the last couple of weeks I've overhauled the algorithms I use to generate landscapes and lakes, improved the water shader, sped up building and populating of the world with details (vegetation, etc.), articulated the outboard motor and electric trolling motor on the boat, rebuild the boat console, made the gauges (fuel, battery, RPM and speed) functional, implemented the core of a fish locator (sonar), and created animated fish, just one species so far. Right now the fish just swim around. I've yet to give them proper AI, or make it possible to fish for them. I've built an animated fishing rod (one of several the game will eventually have.) I've had challenges in essentially cutting a hole in the water surface, so the boat doesn't appear to be half flooded. The solution is to add a 0-alpha mesh over the interior of the boat, rendered before the water animation, and not applying the water shader to the boat when viewing it from a first-person view. The more complete solution would be to split the boat into interior and exterior models, and applying the water shader only to the exterior. Next, towards making it possible to actually fish, I'll either animate a 3D fisherman, or decide to limit the player to first-person views and only have to animate the anglers forearms, as they use fishing rods, drive the boat, land fish, etc.





    There's a lot of features planned for this game, between 1,000 and 2,000 hours of work, but I'm confident the result will be a much better game than the Windows game I wrote years ago. That's giving me a lot of models and textures to work with.

    If people want to discuss the pros and cons of Gideros supporting 3D, we can start a thread for that. In fact I think I'll do that. Meanwhile I'll use this thread to share what I'm learning through the project, if anyone is interested.
    +1 -1 (+4 / -0 )Share on Facebook
  • @PaulH I've checked your 2D android fishing game, it's outstanding. All the fishing games I've seen before were pretty childish. While your game suits even hardcore adult fishermen, very realistic. Only fisherman-programmer could create such game! :)

    Likes: MoKaLux

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.