1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Windows Anura 3D (PBR 3D Engine)

Discussion in 'Work in Progress' started by BCrash, Jul 27, 2019.

  1. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Anura3D Logo Medium.png
    I started working on this project as a little 3D shader experiment back in 2015 (GMS 1.4), to see how far I can go. Right after implementing a traditional per-pixel lighting system I started replacing it by PBR (Physically Based Rendering) to achieve more realistic graphics. In 2017 after updating GMS my project didn't work anymore. I couldn't figure out why, so I took a break. In July 2019 I started porting my engine to GMS 2 step by step. At this point, everything works as intended, so I will continue on GMS 2 from now on. :)

    I will edit this post over time and go into detail on some of the features and techniques. Also I hope to find some help, since i regularly run into unexpected trouble. :)

    2019-8-10 19-35-20.jpg
    Screenshot: July 30, 2019

    Download:
    Not yet. There's soo much to do. I'm going to provide a little material demo as soon as possible.
    Feel free to join my Discord to stay updated with this and other projects: https://discord.gg/bgbdGA8

    Features (re)implemented:
    - Physically Based Rendering (PBR) with different approaches to choose from (for quality/performance balance)
    - Deferred Shading ("unlimited" light sources)
    - Materials based on Unreal Engine workflow (Base Color, Roughness, Metalness)
    - Reflections based on equirectangular images (360°)
    - Import .obj 3D models
    - Basic vertex buffers (at this point only planes, cubes and spheres)
    - Skybox (Skydome)
    - Mipmapping (done in GMS 2 now, had to use a DLL in GMS 1.4)
    - Displacement Mapping
    - And some stuff I probably forgot to mention...

    What's next?

    - WIP: Ambient Occlusion (SSAO)
    - Translucent objects
    - Shadow Mapping (included in GMS 1.4 version)
    - Emissive Mapping (included in GMS 1.4 version)
    - Depth Of Field (included in GMS 1.4 version)
    - Bloom (included in GMS 1.4 version)
    - Dynamic Reflections (not a huge fan of Screenspace Reflections though)
    - Anti-Aliasing
    - There's always something to do...

    Media:
    Most of the textures were taken from https://freepbr.com. Great stuff!
    I will refresh these screenshots/videos every now and then to show the current progress.
    2019-8-10 19-35-20.jpg
    2019-8-3 10-30-3.jpg
    2019-7-31 21-55-10.jpg
    2019-7-30 21-46-27.jpg

    Information:
    Physically Based Rendering is the most realistic realtime rendering "technique" today. Instead of making things more complicated, creating textures is a lot more intuitive. Pretty much every material found on Earth can be simulated by only setting a base color, a roughness value and a metalness value.

    "Physically based rendering (PBR) is an approach in computer graphics that seeks to render graphics in a way that more accurately models the flow of light in the real world. Many PBR pipelines have the accurate simulation of photorealism as their goal."
    From https://en.wikipedia.org/wiki/Physically_based_rendering

    PBR Guide: https://www.substance3d.com/pbr-guide
    An artist's perspective: https://wiki.jmonkeyengine.org/jme3/advanced/pbr_part1.html
    Since I didn't want to limit the number of lights, I decided to use Deferred shading. It's a technique where lighting is calculated in screenspace. To use this technique the scene has to be rendered multiple times. In GMS only HLSL can do that in one pass. Doing that with the GLSL version used in GMS would be very slow.
    So, the performance is pretty good, but it works only on Windows.
     
    Last edited: Aug 10, 2019
    Yal, Misu, Fredrik and 15 others like this.
  2. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Uploaded a video to showcase the current progress:
     
    Kentae likes this.
  3. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Improved the lighting. Although both versions are actually correct (depending on material properties), the new one looks more realistic and natural to me:
    Improved Lighting.jpg
     
    Xor, NoobsWeStand and Amon like this.
  4. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    440
    Looks absolutely beautiful!
    I'd like to write a post and tutorial about this. Hope to see more soon
     
    BCrash likes this.
  5. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    @Mert Thank you! Now that'd be great. Still a long road to go, might take a while. :)

    Just finished rearranging the skydome part:
    2019-7-30 21-46-27.jpg
     
    Mert likes this.
  6. Morendral

    Morendral Member

    Joined:
    Jun 27, 2016
    Posts:
    401
    This is really nice, and does a nice job showcasing pushing the limits of what this "2D" engineer is capable of.
     
    BCrash likes this.
  7. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    @Morendral Thank you! :)

    Here's a screenshot of an actual 3D model with some (not so good) PBR texture mapping:
    2019-7-31 21-55-10.jpg
     
    Morendral and Mert like this.
  8. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    2,250
    Is there a really comprehensive guide to physically based rendering?

    Also, I understand that creating artwork for PBR can be complicated by the fact that you need accurate material property measurements to get anything close to good-looking results.
     
    BCrash likes this.
  9. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    @flyingsaucerinvasion Huge names worked on different PBR approaches (Disney, nvidia, Crytek, Epic,...), so yes, there are loads of helpful websites and in-detail guides.:)
    I will link this one in the first post: https://www.substance3d.com/pbr-guide

    Currently working on displacement mapping:
    AnuraDisplacementMapping.jpg
     
  10. CMAllen

    CMAllen Member

    Joined:
    Mar 2, 2017
    Posts:
    863
    The ambient occlusion isn't strong enough for the version with displacement. With simple bump/normal mapping, you can clearly see the seams and gaps between the pieces. But that all melts together with displacement. Not sure how to fix that.
     
    BCrash likes this.
  11. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    @CMAllen Thanks for your comment! At this point there's no ambient occlusion at all. I'm not sure if I understand you right, because the gaps you mentioned do look better to me with displacement enabled (the normal map is made to work with rounded stones - the lighting looks wrong on flat textures). Also some of the gaps are visible because the stones have different heights.
    If you mean the stones don't occlude each other, you might have to take a closer look. The technique I am implementing is called Parallax Occlusion Mapping.

    Here's a bunch of new screenshots using different texture maps with extreme height settings (like you wouldn't use in a game). The camera is really close to the surface:
    2019-8-3 10-22-1.jpg
    2019-8-3 10-30-3.jpg
    2019-8-2_0-0-1.jpg
     
  12. IGameArt

    IGameArt Member

    Joined:
    Jun 21, 2016
    Posts:
    171
    Is this all done natively with shaders?
     
    BCrash likes this.
  13. lolslayer

    lolslayer Member

    Joined:
    Jun 23, 2016
    Posts:
    695
    Looks amazing, great stuff man!
     
    BCrash likes this.
  14. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Thank you guys.
    @lolslayer Yes, it's all done in GMS 2 using the built-in shader editor.
     
    RujiK and Cpaz like this.
  15. lolslayer

    lolslayer Member

    Joined:
    Jun 23, 2016
    Posts:
    695
    Great :)
     
    BCrash likes this.
  16. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    440
    Hi. Will this be compatible with all platforms?
    I'm wondering :rolleyes:
     
    BCrash likes this.
  17. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Hi @Mert, sadly it's Windows only at this point. The GLSL version used in GMS does not support MRT (Multiple Render Targets), so it would be very slow.

    Here's the usual comparison image when it comes to PBR (made in Anura 3D). It describes the material workflow best. Usually "metalness" is either 0 or 1, because in reality there are no materials in between. So just to show the difference: RoughnessMetalness.jpg
     
    Yal likes this.
  18. Ali Al - Mosawi

    Ali Al - Mosawi Member

    Joined:
    Jun 20, 2016
    Posts:
    57
    WoW thats perfect do you try make detailed scenes
     
    BCrash likes this.
  19. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    @Ali Al - Mosawi Thank you! I want to use it for some smaller 3D games later.
     
  20. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Started implementing Ambient Occlusion. Glad the first step is done! :)

    2019-8-8 0-21-5.jpg
     
    SnotWaffle Studios likes this.
  21. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    This really is the most basic implementation of SSAO I can think of and it still needs a lot of tweaking (and fixes). Just want to show today's progress:
    2019-8-8 0-38-53.jpg
     
  22. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Still working on Ambient Occlusion (SSAO). So far:
    2019-8-10 19-35-20.jpg
     
    Joe Ellis likes this.
  23. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Hey guys, sorry for not posting any news recently. Currently cleaning up the project and reorganizing the whole structure (creating and sorting scripts for easier usability, optimizing a lot of code, renaming internal variables, ..that kind of stuff). It takes some time, but it's important. On the plus side, the performance is even getting noticeably better. :)

    Also had a few test runs on some friend's PCs. Turns out the SSAO approach I used is a massive bottleneck on older GPUs. Can't tell why at the moment (I figured out that it is only one line of shader code, but it doesn't seem to make any sense). Will try a different approach soon.

    Since I don't want to annoy you with more spheres and cubes, today's screenshot is from the GMS 1.4 version (September 2016). I'm not sure if I will continue work on the modeler, since it's extremely time consuming. We'll see.

    If you haven't yet, feel free to join our Discord to follow this and other projects (e.g. Twitch Plays games).

    Thank you! :)

    2016-09-06 001.png
     
  24. JaimitoEs

    JaimitoEs Member

    Joined:
    Aug 9, 2016
    Posts:
    220
    Awesome shaders! Congratulations!
     
    BCrash likes this.
  25. duran can

    duran can Member

    Joined:
    Sep 1, 2019
    Posts:
    10
    whats going download is yet ?
     
    BCrash likes this.
  26. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    Looks really impressive, hard to imagine it's even possible to do something like this in GM! (Which I guess is because you mostly made it in GL instead :p). I don't have anything to add to the discussion, so I'm just gonna post here to get notifications in case you ever release it.

    Oh yeah, and the metalness/roughness comparison was pretty cool, I've gone through a number of guides explaining what the common different material-based parameters do but they're usually only showing an extreme (1.0) example that makes it hard to visualize how to tweak the parameters to get the effect you want.
     
    BCrash likes this.
  27. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Hey guys, thanks for your comments! The project is currently paused (due to some other things happening in my life).

    @duran can At this point I'm not even sure how to release it when it's in a usable state (base shaders only? include additional stuff? manual? free/commercial? - so many things...).

    @Yal Exactly, except it's made in HLSL (DirectX). :)
     
  28. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    You could always just release it in every form instead of picking one - a free super-base version, a paid full version, and if you also want the manual you need to pay for the additional "know what the hell you're doing" DLC :p Itchio has a really nice system for tiered releases where you can make some files only available if the player paid a certain amount, it's perfect for "lite + pro" style stuff. For the marketplace, you'd release two separate assets (one free and one paid) named Anura Lite and Anura Pro (or something along those lines) with different sources - tons of people have done so, most notably that big Easing Function library.
     
    Last edited: Jan 23, 2020
    BCrash likes this.
  29. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    @Yal Thank you, sounds great. Didnt know that was possible on itch.io! Will definitely check it out.

    Some basic knowledge of how to use shaders is required though (and of course some GMS experience). Currently it's really stripped down to PBR (no shadows, Ambient Occlusion is a huge bottleneck, Displacement Mapping is not 100% working as intended).

    I might have to remove these parts and clean up the project, so it's easier to understand the whole thing. I dont want to release trash. :)

    Here you can see what the Displacement Mapping does (the surface looks curved - compare to the green horizontal line):
    [​IMG]
     
    Yal likes this.
  30. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    There's like no usable advanced shadow system on the marketplace right now (I checked recently - there's a bunch of assets by one guy, but they're broken and don't work properly), so if you can get deferred shading running you'd basically have the market for yourself on that. So don't forget to include that in the pro version ;)
     
    BCrash likes this.
  31. BCrash

    BCrash Member

    Joined:
    Aug 5, 2016
    Posts:
    25
    Deferred Shading is already implemented, just no shadow mapping so far. It's on my list though. :)
     
    Yal likes this.

Share This Page