Page 10 of 20

Re: Android build openmw

Posted: 20 Jul 2014, 10:28
by scrawl
Nice. I already expected there are more shader issues. Ogre log?

Re: Android build openmw

Posted: 20 Jul 2014, 11:16
by sandstranger
.

Re: Android build openmw

Posted: 20 Jul 2014, 12:17
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
 

Re: Android build openmw

Posted: 20 Jul 2014, 17:46
by sandstranger
.

Re: Android build openmw

Posted: 20 Jul 2014, 18:19
by scrawl
I would prefer to fix the GLSL shaders. What errors are you getting now?

Re: Android build openmw

Posted: 21 Jul 2014, 06:19
by sandstranger
.

Re: Android build openmw

Posted: 21 Jul 2014, 08:52
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.

Re: Android build openmw

Posted: 21 Jul 2014, 11:18
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.

Re: Android build openmw

Posted: 21 Jul 2014, 13:03
by sandstranger
.

Re: Android build openmw

Posted: 21 Jul 2014, 13:17
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.