Android build openmw

Everything about development and the OpenMW source code.
Locked
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Android build openmw

Post by scrawl »

Nice. I already expected there are more shader issues. Ogre log?
User avatar
sandstranger
Posts: 438
Joined: 19 May 2014, 19:53
Location: Oblivion

Re: Android build openmw

Post by sandstranger »

.
Last edited by sandstranger on 01 Aug 2014, 16:43, edited 1 time in total.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Android build openmw

Post by scrawl »

This should fix the max issues.

Code: Select all

diff --git a/files/materials/objects.shader b/files/materials/objects.shader
index ed75bab..7d0d392 100644
--- a/files/materials/objects.shader
+++ b/files/materials/objects.shader
@@ -210,11 +210,11 @@
 #if VERTEXCOLOR_MODE == 2
             lightResult.xyz += colour.xyz * lightDiffuse[@shIterator].xyz
                     * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
 #else
             lightResult.xyz += materialDiffuse.xyz * lightDiffuse[@shIterator].xyz
                     * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
 #endif
 
 #if @shIterator == 0
@@ -432,11 +432,11 @@
 #if VERTEXCOLOR_MODE == 2
             lightResult.xyz += colourPassthrough.xyz * lightDiffuse[@shIterator].xyz
                     * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
 #else
             lightResult.xyz += materialDiffuse.xyz * lightDiffuse[@shIterator].xyz
                     * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
 #endif
 
 #if @shIterator == 0
@@ -504,7 +504,7 @@
 
 #if ENV_MAP
         // Everything looks better with fresnel
-        float facing = 1.0 - max(abs(dot(-eyeDir, normal)), 0);
+        float facing = 1.0 - max(abs(dot(-eyeDir, normal)), 0.0);
         float envFactor = shSaturate(0.25 + 0.75 * pow(facing, 1));
 
         shOutputColour(0).xyz += shSample(envMap, UV.zw).xyz * envFactor * env_map_color;
@@ -513,7 +513,7 @@
 #if SPECULAR
         float3 light0Dir = normalize(lightPosObjSpace0.xyz);
 
-        float NdotL = max(dot(normal, light0Dir), 0);
+        float NdotL = max(dot(normal, light0Dir), 0.0);
         float3 halfVec = normalize (light0Dir + eyeDir);
 
         float shininess = matShininess;
@@ -522,7 +522,7 @@
         shininess *= (specTex.a);
 #endif
 
-        float3 specular = pow(max(dot(normal, halfVec), 0), shininess) * lightSpec0 * matSpec;
+        float3 specular = pow(max(dot(normal, halfVec), 0.0), shininess) * lightSpec0 * matSpec;
 #if SPEC_MAP
         specular *= specTex.xyz;
 #else
diff --git a/files/materials/terrain.shader b/files/materials/terrain.shader
index 1436de0..7b24ccc 100644
--- a/files/materials/terrain.shader
+++ b/files/materials/terrain.shader
@@ -175,7 +175,7 @@
 
             lightResult.xyz += lightDiffuse[@shIterator].xyz
                     * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(normal.xyz, lightDir), 0);
+                    * max(dot(normal.xyz, lightDir), 0.0);
 
 #if @shIterator == 0
             directionalResult = lightResult.xyz;
@@ -404,7 +404,7 @@ albedo = shLerp(albedo, diffuseTex, blendValues@shPropertyString(blendmap_compon
 
             lightResult.xyz += lightDiffuse[@shIterator].xyz
                     * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(normal.xyz, lightDir), 0);
+                    * max(dot(normal.xyz, lightDir), 0.0);
 #if @shIterator == 0
             float3 directionalResult = lightResult.xyz;
 #endif
@@ -444,10 +444,10 @@ albedo = shLerp(albedo, diffuseTex, blendValues@shPropertyString(blendmap_compon
         // Specular
         float3 light0Dir = normalize(lightPos0.xyz);
 
-        float NdotL = max(dot(normal, light0Dir), 0);
+        float NdotL = max(dot(normal, light0Dir), 0.0);
         float3 halfVec = normalize (light0Dir + eyeDir);
 
-        float3 specular = pow(max(dot(normal, halfVec), 0), 32) * lightSpec0;
+        float3 specular = pow(max(dot(normal, halfVec), 0.0), 32) * lightSpec0;
         shOutputColour(0).xyz += specular * (albedo.a) * shadow;
 #endif
 
User avatar
sandstranger
Posts: 438
Joined: 19 May 2014, 19:53
Location: Oblivion

Re: Android build openmw

Post by sandstranger »

.
Last edited by sandstranger on 01 Aug 2014, 16:43, edited 1 time in total.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Android build openmw

Post by scrawl »

I would prefer to fix the GLSL shaders. What errors are you getting now?
User avatar
sandstranger
Posts: 438
Joined: 19 May 2014, 19:53
Location: Oblivion

Re: Android build openmw

Post by sandstranger »

.
Last edited by sandstranger on 01 Aug 2014, 16:44, edited 1 time in total.
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Android build openmw

Post by psi29a »

Try to figure out what is wrong with glsl first.

I wouldn't be surprised if the driver in your mobile isn't exactly compliant.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Android build openmw

Post by scrawl »

Try to change [Objects] num lights to a lower value in settings.cfg, e.g. 1.
Also, try to delete all cached shaders between runs, maybe they are causing trouble.
User avatar
sandstranger
Posts: 438
Joined: 19 May 2014, 19:53
Location: Oblivion

Re: Android build openmw

Post by sandstranger »

.
Last edited by sandstranger on 01 Aug 2014, 16:44, edited 1 time in total.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Android build openmw

Post by scrawl »

It did not help . maybe problem in my patch becuase ogre used eglsurface created by sdl
Seems unlikely. In your last screenshot there are two objects actually displayed properly.

Let's comment out all lighting, like this:

Code: Select all

diff --git a/files/materials/objects.shader b/files/materials/objects.shader
index ed75bab..3801336 100644
--- a/files/materials/objects.shader
+++ b/files/materials/objects.shader
@@ -488,11 +488,13 @@
     float3 waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,0,1), waterLevel);
 #endif
 
+    /*
 #if SHADOWS || SHADOWS_PSSM
         shOutputColour(0) *= (lightResult - float4(directionalResult * (1.0-shadow),0));
 #else
         shOutputColour(0) *= lightResult;
 #endif
+*/
 
 #if EMISSIVE_MAP
         #if @shPropertyString(emissiveMapUVSet)
If you get it rendering now, then we can re-enable the lighting factors step by step to see which one is causing issues.
and than i have to commit function windowResized becuase war error when openmw runs
What was the error and what did you comment exactly?

Oh, and I still want to see the ogre log, just in case.
Locked