Mobile Celestia for Android

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 9 months
Location: Suzhou, China

Post #41by Markerz » 08.04.2020, 01:51

SevenSpheres wrote:I can confirm that the crash is fixed.
Good

SevenSpheres wrote:With beta3, zooming in and out is very slow. This was not the case with the previous betas.
I have not really touch that part of code, maybe its because I built it on CI, which have a different set up from my local machine (for now). So I'll wait for CI to update its configuration (which should match my local configuration) to build release for next beta.

Added after 9 hours 15 minutes:
@onetwothree

Here's something i gotta ask you for help now. In order to get most of Celestia to work, i had two tweaks in the code.

1. related to the atomosphere in this commit, i disabled atomosphere rendering for an object near enough
https://github.com/eyvallah/Celestia/commit/1f3da28c6cdfbe1364bc068b930d8449b9f4c001
This tweak took place because i noticed the flickering around the edges in iOS, please check
The attachment flickering.zip is no longer available
for an illustration

2. related to ring rendering
https://github.com/eyvallah/Celestia/commit/19d3bb2163ff61b6e4591db42f2d5e51670093f9 in the bottom
there are multiple outcomes when zooming in on Saturn with the original code.
either incorrect shape of rings
IMG_2541.PNG

or crash
in

Code: Select all

glDrawArrays(GL_POINTS, 0, 1);
of

Code: Select all

renderPoint(*this, position, {color, alpha}, pointSize, useSprites);


For 1 i think it might be related to GPU, or incorrect setting on iOS. They both might be because of use of GL4ES, but it can also be some part of code in Celestia where we weren't using OpenGL correctly. I hope you can shed some light on it so i can know where to start and possbly solve by debugging

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #42by onetwothree » 08.04.2020, 13:57

Markerz wrote:This tweak took place because i noticed the flickering around the edges in iOS, please check

Looks like precision/z-fighting issue. Is it possible to control float precision in shaders with gl4es?

Markerz wrote:there are multiple outcomes when zooming in on Saturn with the original code.

While this looks like a gl4es issue because as we discussed on github attribute 0 has special meaning in GL2 and matches VertexPointer, but it's better to fix this on our side. I'll take care.

Markerz wrote:glDrawArrays(GL_POINTS, 0, 1);
of
renderPoint(*this, position, {color, alpha}, pointSize, useSprites);

As I said this code is temporary added, just to remove fixed pipeline. Proper implementation should "put" point parameters to a buffer and then draw the full buffer using one call to glDrawArrays. Just as we do for stars.

Topic author
Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 9 months
Location: Suzhou, China

Post #43by Markerz » 09.04.2020, 02:19

onetwothree wrote:Looks like precision/z-fighting issue. Is it possible to control float precision in shaders with gl4es?

GL4ES translates desktop GL shaders to GLES, so I think float precision is controlled by precision modifier, like hmm

Code: Select all

precision highp float;



here's the original/GL4ES translated shader source of the possible atmosphere related shaders

Code: Select all

Shader source#version 120
uniform struct {
   vec3 direction;
   vec3 diffuse;
   vec3 specular;
   vec3 halfVector;
} lights[1];
uniform vec3 eyePosition;
uniform vec3 atmosphereRadius;
uniform float mieCoeff;
uniform float mieH;
uniform float mieK;
uniform vec3 rayleighCoeff;
uniform float rayleighH;
uniform vec3 scatterCoeffSum;
uniform vec3 invScatterCoeffSum;
uniform vec3 extinctionCoeff;
varying vec3 scatteredColor0;
varying vec3 scatterEx;
varying vec3 eyeDir_obj;

void main(void)
{
float NL;
vec3 eyeDir = normalize(eyePosition - gl_Vertex.xyz);
float NV = dot(gl_Normal, eyeDir);
{
    float rq = dot(eyePosition, eyeDir);
    float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
    float d = sqrt(rq * rq - qq);
    vec3 atmEnter = eyePosition + min(0.0, (-rq + d)) * eyeDir;
    vec3 atmLeave = gl_Vertex.xyz;
    vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.5;
    vec3 atmSamplePointSun = atmEnter * 0.5 + atmLeave * 0.5;
    rq = dot(atmSamplePointSun, lights[0].direction);
    qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
    d = sqrt(rq * rq - qq);
    float distSun = -rq + d;
    float distAtm = length(atmEnter - atmLeave);
    float density = 0.0;
    atmSamplePoint = atmEnter * 0.333 + atmLeave * 0.667;
    float h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
    density += exp(-h * mieH);
    atmSamplePoint = atmEnter * 0.667 + atmLeave * 0.333;
    h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
    density += exp(-h * mieH);
    vec3 sunColor = exp(-extinctionCoeff * density * distSun);
    vec3 ex = exp(-extinctionCoeff * density * distAtm);
    scatterEx = ex;
    scatteredColor0 = sunColor * (1.0 - exp(-scatterCoeffSum * density * distAtm));
}
eyeDir_obj = eyeDir;
gl_Position = ftransform();
}
:

New Shader source:
#version 100
precision highp float;
precision highp int;
uniform highp mat4 _gl4es_ModelViewProjectionMatrix;
attribute highp vec4 _gl4es_Vertex;
attribute highp vec3 _gl4es_Normal;

highp vec4 ftransform() {
 return _gl4es_ModelViewProjectionMatrix * _gl4es_Vertex;
}
float min(float a, int b) {
 return min(a, float(b));
}
float min(int a, float b) {
 return min(float(a), b);
}
float max(float a, int b) {
 return max(a, float(b));
}
float max(int a, float b) {
 return max(float(a), b);
}
uniform struct {
   vec3 direction;
   vec3 diffuse;
   vec3 specular;
   vec3 halfVector;
} lights[1];
uniform vec3 eyePosition;
uniform vec3 atmosphereRadius;
uniform float mieCoeff;
uniform float mieH;
uniform float mieK;
uniform vec3 rayleighCoeff;
uniform float rayleighH;
uniform vec3 scatterCoeffSum;
uniform vec3 invScatterCoeffSum;
uniform vec3 extinctionCoeff;
varying vec3 scatteredColor0;
varying vec3 scatterEx;
varying vec3 eyeDir_obj;

void main(void)
{
float NL;
vec3 eyeDir = normalize(eyePosition - _gl4es_Vertex.xyz);
float NV = dot(_gl4es_Normal, eyeDir);
{
    float rq = dot(eyePosition, eyeDir);
    float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
    float d = sqrt(rq * rq - qq);
    vec3 atmEnter = eyePosition + min(0.000000, (-rq + d)) * eyeDir;
    vec3 atmLeave = _gl4es_Vertex.xyz;
    vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.500000;
    vec3 atmSamplePointSun = atmEnter * 0.500000 + atmLeave * 0.500000;
    rq = dot(atmSamplePointSun, lights[0].direction);
    qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
    d = sqrt(rq * rq - qq);
    float distSun = -rq + d;
    float distAtm = length(atmEnter - atmLeave);
    float density = 0.000000;
    atmSamplePoint = atmEnter * 0.333000 + atmLeave * 0.667000;
    float h = max(0.000000, length(atmSamplePoint) - atmosphereRadius.z);
    density += exp(-h * mieH);
    atmSamplePoint = atmEnter * 0.667000 + atmLeave * 0.333000;
    h = max(0.000000, length(atmSamplePoint) - atmosphereRadius.z);
    density += exp(-h * mieH);
    vec3 sunColor = exp(-extinctionCoeff * density * distSun);
    vec3 ex = exp(-extinctionCoeff * density * distAtm);
    scatterEx = ex;
    scatteredColor0 = sunColor * (1.000000 - exp(-scatterCoeffSum * density * distAtm));
}
eyeDir_obj = eyeDir;
gl_Position = ftransform();
}

Shader source#version 120
varying vec3 scatterEx;
varying vec3 eyeDir_obj;
uniform float mieK;
uniform float mieCoeff;
uniform vec3  rayleighCoeff;
uniform vec3  invScatterCoeffSum;
uniform struct {
   vec3 direction;
   vec3 diffuse;
   vec3 specular;
   vec3 halfVector;
} lights[1];
varying vec3 scatteredColor0;

void main(void)
{
vec3 color = vec3(0.0, 0.0, 0.0);
vec3 V = normalize(eyeDir_obj);
    float cosTheta = dot(V, lights[0].direction);
    float phMie = (1.0 - mieK * mieK) / ((1.0 - mieK * cosTheta) * (1.0 - mieK * cosTheta));
    float phRayleigh = 1.0;
    color += (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * scatteredColor0;
    gl_FragColor = vec4(color, dot(scatterEx, vec3(0.333, 0.333, 0.333)));
}
:

New Shader source:
#version 100
precision highp float;
precision highp int;
varying vec3 scatterEx;
varying vec3 eyeDir_obj;
uniform float mieK;
uniform float mieCoeff;
uniform vec3  rayleighCoeff;
uniform vec3  invScatterCoeffSum;
uniform struct {
   vec3 direction;
   vec3 diffuse;
   vec3 specular;
   vec3 halfVector;
} lights[1];
varying vec3 scatteredColor0;

void main(void)
{
vec3 color = vec3(0.000000, 0.000000, 0.000000);
vec3 V = normalize(eyeDir_obj);
    float cosTheta = dot(V, lights[0].direction);
    float phMie = (1.000000 - mieK * mieK) / ((1.000000 - mieK * cosTheta) * (1.000000 - mieK * cosTheta));
    float phRayleigh = 1.000000;
    color += (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * scatteredColor0;
    gl_FragColor = vec4(color, dot(scatterEx, vec3(0.333000, 0.333000, 0.333000)));
}


onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #44by onetwothree » 09.04.2020, 05:12

Looks good. I'm unable to say what's wrong with it.

Avatar
LBV 2012-26
Posts: 17
Joined: 15.04.2019
With us: 5 years 7 months

Post #45by LBV 2012-26 » 09.04.2020, 12:28

The Chinese localization is too bad :sad: . Can I help to translate the Chinese locale?

Topic author
Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 9 months
Location: Suzhou, China

Post #46by Markerz » 09.04.2020, 14:06

onetwothree wrote:Looks good. I'm unable to say what's wrong with it.
the weird thing is that Android build does not have the glitch, while iOS build has it.

LBV 2012-26 wrote:The Chinese localization is too bad :sad: . Can I help to translate the Chinese locale?
you are very welcome to contribute! Celestia relies on gettext PO files for internationalization.

you can take a look at
https://github.com/CelestiaProject/Celestia/tree/master/po and
https://github.com/CelestiaProject/Celestia/tree/master/po2

is there a Wiki page for i18n? I searched on Google for Ceelstia i18n and I cannot open the top result.

Avatar
LukeCEL
Posts: 373
Joined: 26.09.2017
With us: 7 years 1 month

Post #47by LukeCEL » 09.04.2020, 14:52

Markerz wrote:is there a Wiki page for i18n? I searched on Google for Ceelstia i18n and I cannot open the top result.

Yeah, this page (https://en.wikibooks.org/wiki/Celestia/Internationalization) has a little bit about internationalization and editing, updating, etc. .po files. It might help.

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #48by onetwothree » 09.04.2020, 15:20

LBV 2012-26 wrote:The Chinese localization is too bad :sad: . Can I help to translate the Chinese locale?

You are welcome. You can use either offline tools like https://poedit.net/ or use are online translation on https://www.transifex.com/celestia/celestia/ (you may use your github account to login).

Avatar
LBV 2012-26
Posts: 17
Joined: 15.04.2019
With us: 5 years 7 months

Post #49by LBV 2012-26 » 10.04.2020, 06:55

By the way, Celestia doesn't seem to have anti-aliasing on my device, so much so that the edges of the object are so rough that I can only force 4x MSAA on in developer mode to ease it.

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #50by onetwothree » 10.04.2020, 08:05

MSAA can only be enabled through celestia.cfg

Topic author
Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 9 months
Location: Suzhou, China

Post #51by Markerz » 10.04.2020, 09:40

onetwothree wrote:MSAA can only be enabled through celestia.cfg
yep, also, on Android/iOS some platform-specific codes are required to have it enabled, i've not really written that part. Also theres hidpi issue where contents appear blurry

Avatar
LBV 2012-26
Posts: 17
Joined: 15.04.2019
With us: 5 years 7 months

Post #52by LBV 2012-26 » 10.04.2020, 12:53

You are welcome. You can use either offline tools like https://poedit.net/ or use are online translation on https://www.transifex.com/celestia/celestia/ (you may use your github account to login).
I have sent a request to join the zh-CN team but have not yet received the pass message. Do you have localized file that can be edited (Po file on GitHub I've modified)?

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #53by onetwothree » 10.04.2020, 13:16

I have accepted your request. Currently we have only old file (https://www.transifex.com/celestia/celestia/language/zh_CN/). You can upload your updated version: follow the link, press "celestia.pot" and then select "Upload file". After uploading repeat 1st & 2nd steps but now press "Translate" button, select unreviewed translation, mark them all and change their state to "reviewed".

Avatar
SevenSpheres
Moderator
Posts: 826
Joined: 08.10.2019
With us: 5 years 1 month

Post #54by SevenSpheres » 12.04.2020, 15:41

With beta4 zooming is back to normal.
My Addons: viewtopic.php?f=23&t=19978 • Discord server admin
Celestia versions: 1.5.1, 1.6.1, 1.6.2, 1.7.0, and some unofficial versions like Celestia-ED

Topic author
Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 9 months
Location: Suzhou, China

Post #55by Markerz » 13.04.2020, 11:34

just wanna add that although we have integrated crash reporting system, everyone's still encouraged to report any bug/crash (including steps to reproduce), or feature request here. This will also have improve Celestia itself.

I can see on AppCenter that there's a few crashed in

Code: Select all

Galaxy::pick(celmath::Ray3<double> const&, double&, double&) const
in

Code: Select all

mouseButtonUp
, it seems to be from a Redmi Note 8 user, anyone knows the detail? (looks like tapping on a galaxy?)

Avatar
LBV 2012-26
Posts: 17
Joined: 15.04.2019
With us: 5 years 7 months

Post #56by LBV 2012-26 » 15.04.2020, 08:16

I have accepted your request. Currently we have only old file (https://www.transifex.com/celestia/celestia/language/zh_CN/). You can upload your updated version: follow the link, press "celestia.pot" and then select "Upload file". After uploading repeat 1st & 2nd steps but now press "Translate" button, select unreviewed translation, mark them all and change their state to "reviewed".
AvatarSevenSpheres
All the Chinese localization translations have been completed. Waiting for review.

Topic author
Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 9 months
Location: Suzhou, China

Post #57by Markerz » 15.04.2020, 10:42

LBV 2012-26 wrote:All the Chinese localization translations have been completed. Waiting for review.
Thanks for the work! On Android there will be some additional translation needed, can I count on you for translation when it is ready? :wink:

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #58by onetwothree » 15.04.2020, 13:09

LBV 2012-26 wrote:All the Chinese localization translations have been completed. Waiting for review.

I marked them as reviewed, but I don't speed Chinese :) I promoted you to coordinators so now you can review other's translations.

Avatar
LBV 2012-26
Posts: 17
Joined: 15.04.2019
With us: 5 years 7 months

Post #59by LBV 2012-26 » 16.04.2020, 01:11

Thanks for the work! On Android there will be some additional translation needed, can I count on you for translation when it is ready?
Ok. If I need to, I can use my free time to do it. :wink:

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 2 months

Post #60by onetwothree » 19.04.2020, 04:19

Markerz posted a beta version to the Play Market (available through this direct link only for now):
https://play.google.com/store/apps/details?id=space.celestia.mobilecelestia


Return to “Development”