About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Achieving glow with RT_SIMPLE on mobile devices
Author Message
aceio76 Offline
Silver Supporter

Post: #1
Achieving glow with RT_SIMPLE on mobile devices
Hi guys,

I'm trying to get glow to work with RT_SIMPLE set targeted for mobile. When I test on a PC, glow works, but on the mobile device (android in this case), glow does not work.

Here is how the renderer and display is set:
Code:
Renderer.type(RT_SIMPLE);
   Renderer.simplePrecision(false);
   D.glowAllow(true);   // enable glow
   D.bloomAllow(true);  // enable glow
Then in the RM_PREPARE stage of rendering, I set the following to allow simplePrecision on the drawn meshes where glow is desired:
Code:
Renderer.simplePrecision(true);
   .... various mesh drawPrepare() calls ...
   Renderer.simplePrecision(false);

This approach provides the glow effect intended when run on a pc but doesn't seem to apply when run on an android device.

Am I missing a setting that needs to be set when the app is run on an Android device that would prevent glow from working?

Thanks.
01-01-2016 07:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Achieving glow with RT_SIMPLE on mobile devices
Hi,

On Android there was an issue related to alpha channel (where glow intensity is stored) the OS would display the screen as black, because of that I had to disable glow in some cases on Android. I will check if I can do something about it. But please keep in mind that fullscreen effects are very slow on mobile. Just bloom is slow, while glow is even slower. You can enable bloom to see the performance slowdown, with bloom enabled I think glow should work always on mobile.
01-01-2016 10:11 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #3
RE: Achieving glow with RT_SIMPLE on mobile devices
Hi Esenthel, welcome back! Hope you had a good vacation over at Thailand. That is one of the places I want to visit and explore one day.

I am trying to explore how to provide glow effects for a mobile game project set with RT_SIMPLE. Without the glow, many of the special effects are simply just flat :(

If there isn't a native way via the engine to provide this, I wonder who else would be interested in working with me to write a custom material-based glow shader? pfft

The glow map is only using the blue channel right?
01-02-2016 04:54 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Achieving glow with RT_SIMPLE on mobile devices
Hi,

Many thanks :> Hope you're having a nice time during Christmas/New Year period as well smile
I've just done some checks, could you try forcing bloom for example with these settings:
Code:
D.bloomOriginal(1).bloomScale(0.6).bloomCut(0.3);
D.glowAllow(true);   // enable glow
D.bloomAllow(true);  // enable bloom

Also please don't do this:
Code:
Renderer.simplePrecision(true);
   .... various mesh drawPrepare() calls ...
   Renderer.simplePrecision(false);
As this may kill performance.
I've added this header function comment:
Code:
RendererClass& simplePrecision(Bool   per_pixel);   Bool        simplePrecision    ()C {return _simple_prec  ;} // set/get precision of the RT_SIMPLE renderer, default=true  (false for Mobile), the change is NOT instant, avoid calling real-time
Calling this method requires resetting shaders of all meshes, which may be slow.

For now please use
Code:
Renderer.simplePrecision(true);
inside InitPre just once, but in next engine version I will update the shaders, so that glow will work regardless of Renderer.simplePrecision.

Please let me know if that makes glow work on your device.
01-02-2016 02:44 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #5
RE: Achieving glow with RT_SIMPLE on mobile devices
Thanks Esenthel,

Unfortunately, those settings still do not let glow effects to show on the android devices I've tried (S6, S3, Note 3). The primary reason for using the above approach where Renderer.simplePrecision(false) then only enabled (set to true) later when surrounding the desired meshes is because I am using Renderer.simpleVertexFogRange(..) and it only works with Renderer.simplePrecision(false). Now that I know that glow is a post-process effect, I can understand why it's not advisable to turn it on and off on the fly, although I'll confess that at my stage of development, there was very little and even no effect in percceived performance degradation even on the slowest mobile device I used for testing. Comparing this with Fog (rather than using simpleVertexFogRange), Fog seem to have a more perceivable performance drop where FPS at least drops 1/3 compared to just simpleVertexFogRange even with the simplePrecision(true/false) approach.

The other exercise was to allow the ability to enable/disable glow on selected meshes on the fly.

With specific regards to fogging effects, simpleVertexFog seem to work better where it has a start and end range and the meshes that get engulfed in the fog blend better on the far end before the mesh is no longer visible. Compared with Fog(), the meshes appear to get clipped on the far end as it gets engulfed in the fog effect rather than simply blending in.

I'm really just trying to get a working combination of these features when using RT_SIMPLE for mobile.
(This post was last modified: 01-03-2016 02:22 AM by aceio76.)
01-03-2016 01:32 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Achieving glow with RT_SIMPLE on mobile devices
Hi,

Calling Renderer.simplePrecision will reduce the performance based on the amount of objects loaded. If you have many objects loaded then each call to this method will be slower. Please avoid calling this real-time.

I've just tried using the code on Galaxy Note 4:
Code:
D.glowAllow(true);
D.bloomAllow(true);
And keep default bloom settings untouched (to force bloom enabled) and it works OK.
I can see Bloom+Glow effect on Note 4.
For Android Glow will work currently only if you have Bloom enabled (D.bloomOriginal!=1 || D.bloomScale!=0 || D.bloomContrast!=1)

Perhaps your world environment settings disable bloom?

Also I'm using this commit which allows me to keep Renderer.simplePrecision per-vertex (this allows glow work regardless of Renderer.simplePrecision):
https://github.com/Esenthel/EsenthelEngi...0bf0b6da09

If you merge this commit with your branch, please remember to use "Esenthel Builder" tool afterwards. (especially "Engine Pak" option)
01-03-2016 11:00 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #7
RE: Achieving glow with RT_SIMPLE on mobile devices
That will certainly work (the updated beta source), esenthel. Thank you!

Being able to leave Renderer.simplePrecision as false and still have glow working and while being able to use simpleVertexFogColor is great! If Fog() didn't have that "clipping" effect as meshes disappear on the distance, that wouldn't be a bad alternative. The closest alternative is Sky with the horizon color and density where the far meshes blends as it fades, but it only has the far view of the horizon and no nearby fogging effect.
(This post was last modified: 01-06-2016 01:35 AM by aceio76.)
01-06-2016 01:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply