Moderators: Huki, jigebren

RVGL - Shader Edition

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

5 Jun 2017, 04:40 PM #1

I'm making a quick announcement about something I've been working on for the past month. It's a new shader based rendering engine for RVGL, targeting OpenGL 3.1+ Core Profile (i.e., currently using Core features only). It's very different from the fixed pipeline used by v1.2 and current RVGL, and it's hard to map many of the features supported by the existing renderer. But the results have been promising and I can't wait to see results from real world hardware (including Intel :wacko:).

What is supported so far:
- Lights and shadows
- Fog (including vertical fog)
- Mirrors, semi-transparency
- Environment effects (using multi-texturing)
- Mesh deformation effects (waterbox, splash, etc).

What's still missing:
- HUD, text and menus (basically all 2D stuff)
- Sparks, trails, skidmarks
- Special objects (skybox, rain, ...)

More news and test builds to follow soon, but here goes an obligatory screenshot:
Quote
Like
Share

prorab2
Sober
Joined: 2 Apr 2017, 02:20 PM

6 Jun 2017, 01:54 AM #2

Awesome! Freaking wanna try it, waiting for test build ^_^
Quote
Like
Share

MarvTheM
Alcoholic
MarvTheM
Alcoholic
Joined: 12 Jun 2010, 07:45 AM

6 Jun 2017, 08:17 AM #3

This is going to be amazing!
Quote
Like
Share

Black-Revolt001
Alcoholic
Joined: 19 Aug 2014, 06:31 PM

6 Jun 2017, 12:21 PM #4

The circuit is already official, on Alias ReVolt Master

The circuit is available in reverse mode with a course of 3.601467 miles ie 5796 meters...
Quote
Like
Share

Pyves
Regular
Pyves
Regular
Joined: 17 Jul 2011, 03:56 PM

6 Jun 2017, 04:59 PM #5

Is that the Ruddles County track?

Can't wait to try out the new shader based rendering engine! ;)
Quote
Like
Share

Joined: 26 May 2017, 06:16 PM

7 Jun 2017, 04:31 AM #6

Cool, can't wait to try it out! :D
Harvester FTW!
"The greatness of a nation can be judged by the way it treats its animals." -Mahatma Gandhi
Quote
Like
Share

Abc
100% Proofer
Abc
100% Proofer
Joined: 7 Apr 2009, 06:43 PM

7 Jun 2017, 09:34 AM #7

Cool stuff!!
why a new engine when rvgl is still not even beta?
1.2 final when?
Sorry for this
Yes, I'm the ABC block and you can find me in Toy World 1 track! ;)
Reborn as Juest Zungo :P PS: I prefer chatting and i have Steam, Skype, Google and Microsoft account, just ask for it via PM or rarely find me in RVHouse. Also check out my interests.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

9 Jun 2017, 07:08 PM #8

I'm currently adding some basic text support to make testing easier.

My observation is that the shader version scales really well at high poly counts. I'm getting 70+ fps when viewing the entire Ruddles County track in full screen, and this is with a decent Nvidia card from 2008. In comparison, the fixed function version gives 15-20 fps. On my AMD notebook APU, there is a noticeable performance increase across all tracks I've tried so far. There's still room for further optimizations.

@Abc: It's actually been planned for a long time now, and the main intention is to support the Re-Make project... are you following that btw? (assuming you have access to RVL). The secondary goal is to possibly have RVGL on platforms like iOS / Android that are based on GLES 2+ (which is mostly a subset of GL Core and requires a shader version). I also expect to see higher throughput and better power efficiency on newer cards, notebooks, etc.
Quote
Like
Share

Abc
100% Proofer
Abc
100% Proofer
Joined: 7 Apr 2009, 06:43 PM

10 Jun 2017, 02:16 AM #9

yeah i've heard about re-make but not much into it.
cool to know.
I'm hoping there's no porting issues/mistakes again :)
good luck on the transition
Yes, I'm the ABC block and you can find me in Toy World 1 track! ;)
Reborn as Juest Zungo :P PS: I prefer chatting and i have Steam, Skype, Google and Microsoft account, just ask for it via PM or rarely find me in RVHouse. Also check out my interests.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

18 Jun 2017, 12:06 AM #10

I'm releasing the first shader based build 17.0615s. The GL version is locked to 3.2+ Core profile. You can check the video info in your re-volt.log to confirm this. Extract the archive over the latest "a" build.
rvgl_17.0615s_win32.7z
rvgl_17.0615s_win64.7z
rvgl_17.0615s_linux.7z

This is a very unoptimized first cut, but it should already give a nice performance boost on newer cards. There are some things you should watch out for:
  • It currently uses one big shader for everything in which options are turned on and off through uniforms. This can be slow, but enough to support RVGL's existing feature set. The next step will be to use small induvidual shaders for each mesh or material type and Uniform Buffer Objects to share parameters between them. This should also allow easy creation of custom shaders for specific models / meshes.
  • Vertices are now processed on the GPU, but this can increase the number of vertices that need to be processed as they are no longer shared between polys. A possible way to handle this in the future may be to use triangle strips when possible.
  • The stock tracks world files are chopped into very small meshes called "cubes", which can improve performance on the fixed pipeline. However, with the shader version it's actually better to send large number of polys in a batch. You can use the WorldCut tool to merge together cubes in the world file and re-split them with a larger cube size. I recommend a Cube size of 4000 and a BigCube size of 12000. For most custom tracks that don't use the cube optimization, expect some nice performance boost with this version. :)
  • Lights are limited to 8 lights per world cube. The limit can be increased when we switch to UBO's, but it's already more than enough. For comparison, the iOS version only supports 4 lights per cube.
  • The re-volt.log file will log information about cubes in the world file, and the number of polys in each cube / mesh.
Well, have fun testing, and be sure to post your log with your reports.
Quote
Like
Share

MarvTheM
Alcoholic
MarvTheM
Alcoholic
Joined: 12 Jun 2010, 07:45 AM

18 Jun 2017, 06:54 AM #11

That's an amazing update.

[HIDE=My system specs]
OS: Arch Linux 64 (Manjaro 17.0.1 Gellivara)
Kernel: x86_64 Linux 4.9.31-1-MANJARO
DE: GNOME on Xorg, nVidia drivers

CPU: Intel Core i7-4770K @ 8x 4GHz
GPU: GeForce GTX 770
RAM: 7907MiB
[/HIDE]
I'm getting better frame rates on the shader version.
A single race with rvgl_17.0327a on Toys in the Hood 1 sticks to 2000 fps (~3500 max).
The same with 17.0615s yields around 3000 fps (~4000 max)

The only drops I encountered are when additive things like explosions are being rendered, then it can go down to 600.

I also tried it on my track Industry and I'm getting better frame rates with the shader version, too.
With shaders, it tops out at 2000 and drops to 500 at times.
Without shaders, it doesn't even reach 1000 and goes as low as 100.

Loading times are not even noticeable. Everything loads instantly, even quicker than the non-shader version.

I only encountered a few graphical problems.

Texture filtering might be a bit too aggressive, you can see some outlines around crosshairs and other additively rendered things like fireworks:
[HIDE=Screenshot]

[/HIDE]

Alpha sorting seems to have a few problems as well:
(The green ivy below the windowsill should be covered by the other plants.)
[HIDE=Screenshot]

[/HIDE]
I am also getting the flickering polygons on Super Market 1 that Gotolei reported, even without any mods.

Here's my log (includes the two races mentioned): http://files.re-volt.io/logs/17.0615s/2016-06-18.log

I'm really glad to see this update happening. It looks gorgeous and it will give us so many more possibilities to work the game. Thanks a ton for your work, I appreciate it.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

19 Jun 2017, 02:23 AM #12

Thanks for the feedback, Marv. There are definitely going to be immense possibilities for designing new content, but I'm glad to hear about the noticeable performance improvement even for existing / unmodified content.
MarvTheM @ 18 Jun 2017, 12:24 PM wrote:The only drops I encountered are when additive things like explosions are being rendered, then it can go down to 600.
Does that mean the non-shader version doesn't go down to 600?
Texture filtering might be a bit too aggressive, you can see some outlines around crosshairs and other additively rendered things like fireworks:
[HIDE=Screenshot]

[/HIDE]
I see what you mean. This is because I disabled alpha testing (I mean pure black transparency) for additive blending. In fact it looks like we still need alpha testing in this case, so I'll turn it back on.
Alpha sorting seems to have a few problems as well:
(The green ivy below the windowsill should be covered by the other plants.)
[HIDE=Screenshot]

[/HIDE]
There is actually no more alpha sorting - transparent polys are not sorted. I'm going to apply an Order Independent Transparency shader later, but this is not done yet.
I am also getting the flickering polygons on Super Market 1 that Gotolei reported, even without any mods.
As mentioned on Discord, this bug is triggered by bomb explosions on tracks with texture animations. It's fixed now.

There were reports from Vaid about very slow loading on some Windows systems. I was able to reproduce that myself on my 64-bit Windows 10 (but strangely not on my 32-bit Windows 7). This is caused by large amount of World Cubes info written to the log. Considering this, I've disabled the cube logging for now.

Download build 17.0618s below.
rvgl_17.0618s_win32.7z
rvgl_17.0618s_win64.7z
rvgl_17.0618s_linux.7z

Changelog:
- Disabled cubes info logging.
- Fixed explosions bug.
- Fixed car fading glitch during reposition.
- Alpha testing is turned on for additive blending.
Quote
Like
Share

Abc
100% Proofer
Abc
100% Proofer
Joined: 7 Apr 2009, 06:43 PM

19 Jun 2017, 03:55 AM #13

explosions were an important fps hit on weak computers.
64 bits does not only get hungrier on memory but on disk too...
it may vary on the HDD speed and whatever its a ssd or not.
i'm surprised nobody yet compared or mentioned the jailhouse rock fps between the original and the funnycubes experiment jig had done
Yes, I'm the ABC block and you can find me in Toy World 1 track! ;)
Reborn as Juest Zungo :P PS: I prefer chatting and i have Steam, Skype, Google and Microsoft account, just ask for it via PM or rarely find me in RVHouse. Also check out my interests.
Quote
Like
Share

MarvTheM
Alcoholic
MarvTheM
Alcoholic
Joined: 12 Jun 2010, 07:45 AM

20 Jun 2017, 03:21 PM #14

Does that mean the non-shader version doesn't go down to 600?
I think it goes lower in the non-shader version. I'll test it later and edit this post.

Edit: Shader version explodes better.
Quote
Like
Share

MarvTheM
Alcoholic
MarvTheM
Alcoholic
Joined: 12 Jun 2010, 07:45 AM

23 Jun 2017, 08:45 AM #15

[HIDE=Solved Error]

I'm getting this error when I'm trying to launch RVGLs on Windows 10 (Intel integrated, i5)

I reinstalled the standard RVGL build and then installed the shader version again. Then it worked.

[/HIDE]


Then I'm going to use this opportunity for questions:

How do the mirrors in the shader version work? Are they rendered with a shader or are they just duplicated geometry as it was before?

Also, is lighting still done per-vertex? I noticed that shadow boxes are, however, lights from omni-lights look smoother than before.

Is there going to be a new type of light that uses shaders rather than overriding vertex colors?

What about dynamic shadows? Could there be a new type of light (like the Sun light in Blender) that casts a global shadow?

Would it be possible to use a new shader-based lighting model that uses existing shadowboxes and lights?
We would need those kind of lights for spec and normal maps, anyway.

How would all of this mix with the light and sharp shadows already baked into the vertex colors of the .W files (and cars, too)? Wouldn't we have to disable vertex color entirely for this?

Basically, how does all of this shader magic work?
Quote
Like
Share

Gotolei
Alcoholic
Gotolei
Alcoholic
Joined: 12 Mar 2014, 12:26 AM

6 Jul 2017, 01:04 AM #16

Reposting this in here since it got buried on the Discord server, the sun in muse2 is glitched out for me:
https://streamable.com/vmkbu

Another anomaly: I'm not sure if it's specific to the linux version or what but if you start any kind of race with pos or ai nodes enabled, it messes with the gravity and breaks part of the ui:
https://streamable.com/dden4
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

16 Nov 2017, 07:27 PM #17

I'm announcing a massive update to the shader version. The key features are:

Optimized rendering:
  • Significant rewrite / optimizations since the preliminary release.
  • Now uses multiple shader programs for world, model and screen space (particles, etc.) rendering, each of them supporting various combinations depending on the mesh type. For example, a mesh requiring fog effect uses a special shader program with only fog code compiled in, which is significantly faster compared to having a single shader program with dynamic branching.
  • Colorkeying / alpha testing is only enabled for textures that need it, as this is a major bottleneck on modern cards.
  • Untextured polys now use a 1x1 pure-white texture internally.
Below is a frame rate comparison between the latest alpha and the new shader version on my laptop running Linux (click for a larger version).



Some more older screenshots follow:
  • Unlimited transparent polys (in addition to improved frame rate...)
  • Utilizes hardware face culling which better handles asymmetric polys.


Note: The shader edition has reduced CPU usage as it offloads vertex processing to the GPU. At the same time, you may experience higher memory consumption, because we allocate some huge static arrays for the draw queue.

Updated shaders: Better optimized shader code, better compatibility for old devices, properly working mesh deformation effects (eg, waterbox animation which was broken on tracks like Boat Beach).

Working alpha sorting: Transparent meshes are now rendered back to front in correct order. This is a more basic approach compared to the old renderer which sorts each poly individually. On the bright side, it prevents flickering when transparent polys are bunched close together, eg., tree leaves.



OpenGL 2.x support: The minimum requirement to run the shader edition is now OpenGL 2.0.

OpenGL ES 2.0 support: The popular version of OpenGL for Embedded Systems used on Android, iOS, etc. is now supported. Currently this can only be tested on x86 based systems, but an arm build should arrive later on. It also opens up the possibility of using ANGLE Direct3D backend on Windows (more on that below).

Multiple GL Profiles selectable: Added a new option 'GLProfile' in rvgl.ini which accepts the following values:
  • 0: Compatibility profile - allows any version of OpenGL to be initialized (the default). An error message will be displayed for versions less than 2.0.
  • 1: Core profile - attempts to initialize a 3.2+ Core profile. In some cases, driver support may be better when using a core profile.
  • 2: ES profile - attempts to initialize a GLES 2.0+ profile. This either requires a mobile GPU, or in the case of Desktop GPUs, driver support for ES emulation.
  • 3: ES profile through Driver (ANGLE, etc.): Same as above, but attempts to use an alternative ES implementation rather than the one provided by your Desktop drivers. This allows you to use Google's ANGLE library on Windows, which provides a compliant GLES2 / WebGL implementation that translates GL calls to Direct3D9 or Direct3D11. ANGLE dll's are included with this release.
Below are log messages on my device with various GL profiles in use. Notice how the Mesa open source driver only provides 3.0 support with the default Compatibility profile, while 4.5 is exposed with Core profile.
[hide=Compatibility]
GL Vendor: X.Org
GL Renderer: AMD MULLINS (DRM 2.50.0 / 4.13.12-1-ARCH, LLVM 5.0.0)
GL Version: 3.0 Mesa 17.2.5
[/hide][hide=Core]
GL Vendor: X.Org
GL Renderer: AMD MULLINS (DRM 2.50.0 / 4.13.12-1-ARCH, LLVM 5.0.0)
GL Version: 4.5 (Core Profile) Mesa 17.2.5
[/hide][hide=ES (Emulation)]
GL Vendor: X.Org
GL Renderer: AMD MULLINS (DRM 2.50.0 / 4.13.12-1-ARCH, LLVM 5.0.0)
GL Version: OpenGL ES 3.1 Mesa 17.2.5
[/hide][hide=ES Driver (Windows)]
GL Vendor: Google Inc.
GL Renderer: ANGLE (AMD Radeon™ R4 Graphics Direct3D11 vs_5_0 ps_5_0)
GL Version: OpenGL ES 2.0 (ANGLE 2.1.0.54118be67360)
[/hide]

Multi-threaded assets loading: Now uses a shared OpenGL context which enables fast loading of assets in background while rendering in the main thread. Which means the loading screen, along with intros, is now back (and should be slightly faster).

Download build 17.1115s below:
rvgl_17.1115s_win32.7z
rvgl_17.1115s_win64.7z
rvgl_17.1115s_linux.7z

Note: This build should be extracted over the latest stable alpha, which is 17.1021a. It is compatible with 17.1021a online.

Huki
Quote
Like
Share

Pyves
Regular
Pyves
Regular
Joined: 17 Jul 2011, 03:56 PM

17 Nov 2017, 06:38 PM #18

Wow, nice improvements!
Quote
Like
Share

Touriga
Regular
Touriga
Regular
Joined: 23 Aug 2012, 07:07 PM

19 Nov 2017, 02:47 PM #19

Dear Huki,

I should fill up this page with thank yous... Where's my donate button ?

There is a thread going Restart Bug that I believe it should be merged here as it also relates to current version.

Million thanks.

Touriga
Quote
Like
Share

Black-Revolt001
Alcoholic
Joined: 19 Aug 2014, 06:31 PM

20 Nov 2017, 02:11 PM #20

The version 17.1115.a does not work at home, I'm blocking loading ...
In Windows Seven
Quote
Like
Share

VaiDuX461
Methanolic
VaiDuX461
Methanolic
Joined: 2 Jul 2011, 04:02 PM

20 Nov 2017, 05:20 PM #21

Black-Revolt001 @ 20 Nov 2017, 04:11 PM wrote:The version 17.1115.a does not work at home, I'm blocking loading ...
In Windows Seven
Maybe you shouldn't block the loading? :huh:

Once it's unblocked, it will most likely load.
aka VaidX47, Vaid
--------------------
>[MediaFire Stuff]< | >[Steam Profile]<
Quote
Like
Share

Black-Revolt001
Alcoholic
Joined: 19 Aug 2014, 06:31 PM

22 Nov 2017, 02:00 PM #22

Well, at the end of the file loading, I have black screen and I can do nothing.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

23 Nov 2017, 08:48 PM #23

The Shader Edition has been updated! Download build 17.1124s below:
rvgl_17.1124s_win32.7z
rvgl_17.1124s_win64.7z
rvgl_17.1124s_linux.7z

What's New:
  • Based on the latest alpha 17.1124a which was released today. read the release post
  • When running on a mobile GPU with no Desktop OpenGL support, ES profile is automatically used. Previously, GLProfile had to be manually set to 2.
  • The log messages related to shader loading are more clearly formatted.
Note: This build should be extracted over the latest alpha 17.1124a. It is only compatible with 17.1124a online.

Black&#045;Revolt001 @ 22 Nov 2017, 07:30 PM wrote:Well, at the end of the file loading, I have black screen and I can do nothing.
Can you post your re-volt.log file after running the shader version?
Quote
Like
Share

Abc
100% Proofer
Abc
100% Proofer
Joined: 7 Apr 2009, 06:43 PM

23 Nov 2017, 10:35 PM #24

Black&#045;Revolt001 @ 22 Nov 2017, 11:00 AM wrote: Well, at the end of the file loading, I have black screen and I can do nothing.
Do you listen music, tried pressing keys such as enter? do those work?
Likely your system can't handle the shaders, we need your re-volt.log located in profiles to find out, as huki said
Yes, I'm the ABC block and you can find me in Toy World 1 track! ;)
Reborn as Juest Zungo :P PS: I prefer chatting and i have Steam, Skype, Google and Microsoft account, just ask for it via PM or rarely find me in RVHouse. Also check out my interests.
Quote
Like
Share

Abc
100% Proofer
Abc
100% Proofer
Joined: 7 Apr 2009, 06:43 PM

24 Nov 2017, 05:01 AM #25

noticed a slight flicker when turning on turbo on some tracks. such as muse2, nhood2.

probably unrelated but: market1 reflections on lamps is quite off since they have the fog color
Yes, I'm the ABC block and you can find me in Toy World 1 track! ;)
Reborn as Juest Zungo :P PS: I prefer chatting and i have Steam, Skype, Google and Microsoft account, just ask for it via PM or rarely find me in RVHouse. Also check out my interests.
Quote
Like
Share