Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [3D] > PointLight Problem on Samsung Galaxy S3 ?

Author
Message
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 1st Jul 2013 05:09
Here is attached a Tier1 example project combining Lightmap + a blue Dynamic Point light. The problem is that the PointLight is not appearing on Samsung S3 (only). My shader seems to work on all other devices (i've tried a couple of things ...)

I tried it on :

- Windows > no problem. LightMap + Point Light OK
- Mac > no problem
- (android 4) Samsung Galaxy Ace > no problem
- (android 4) Google Nexus 10 > no problem
- (android 4) Samsung Galaxy S3 > OUCH ! doesn't work. No Point Light


Any Idea ?


.

Attachments

Login to view attachments
jlahtinen
14
Years of Service
User Offline
Joined: 26th Oct 2009
Location: Finland
Posted: 1st Jul 2013 14:31 Edited at: 1st Jul 2013 14:32
Tried with SGS3 and on other phone, same here. Made APK file and still same thing.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 1st Jul 2013 17:43
Its not the same issue that tegra devices have? That all stuff like light position and color neads to be passed from the vertex shader.

Pass it in to the vertex shader then to the fragment shader as an varying.

I Always do this on my shaders after Reading an article that GPUs like the ones from nivida wants it this way.

tegra devices dont accept any stuff passed in to the fragment shader if its not an varying passed from the vertex shader.

I wrote an heads up in my shader thread about this.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 1st Jul 2013 19:34
ok i will try that .. it's not a Tegra GPU but may be the same problem
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 1st Jul 2013 21:25
No ... Still doesn't work passing all the light variables to the pixel shader (still works on other devices but still not on S3 lol)

i will try to see on generic Android SDK OpenGL forums maybe :/
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Jul 2013 18:56
Do you have access to the LogCat output of the device? The Xoom and Nexus 7 tablets run the example ok.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 2nd Jul 2013 20:36 Edited at: 2nd Jul 2013 20:37
Quote: "Do you have access to the LogCat output of the device?"


Hmmm yes. I will plug my S3 on logcat


Quote: "The Xoom and Nexus 7 tablets run the example ok."


Yes .. it works on all my other devices too .. this is strange !


i will Come back with LogCat
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 2nd Jul 2013 20:50
the phone uses a mali 400 chippset that have faulty precision!

here is wath i found.

The Galaxy S3 uses a Mali 400 gpu. Unfortunately fragment shaders on these gpus only support lowp and mediump precision in the fragment shader. Although the expected result of length(tc) is less than the maximum value for a mediump float, the intermediate results will be greater.

Perhaps you could scale your vector before finding its length:


Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 3rd Jul 2013 01:12
I've tried in lowp precision and still doesn't work and don't really know what other thing i can try ...

It seems that the same problem occured in Unity 3 with the Galaxy S3 (only) and has been fixed since Unity 4 ... so it's fixable

( if it can helps => thread link : http://forum.unity3d.com/threads/152966-Shaders-falling-back-on-Galaxy-S-3 )



here is the S3 logcat (i don't see anything....) :

("New input event" are when i move the camera to see if lights are working)

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Jul 2013 02:16
Quote: "Unfortunately fragment shaders on these gpus only support lowp and mediump precision in the fragment shader"


Good find Cliff, the maximum float size for mediump is 16384.0 which is easily exceeded in dot(dir,dir) when dir is a large vector.

Mike, try the following pixel shader that scales dir down by 1000 so that it shouldn't overflow the mediump values. If it still doesn't work try increasing the value of "scale" by factors of 10 and see if it makes any difference.

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 3rd Jul 2013 09:18 Edited at: 3rd Jul 2013 09:19
Quote: "Mike, try the following pixel shader that scales dir down by 1000 so that it shouldn't overflow the mediump values. If it still doesn't work try increasing the value of "scale" by factors of 10 and see if it makes any difference.
"


Well done Cliff and Paul. Now i understand and it's working well on S3 too (and other devices it's still working) with a scale of 1000.0

Any way to fix this in a generic way inside AppGameKit before passing agk_PLightPos to pixel shader ? (it may be impossible)? or have we got to do this systematically in the future ?


.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Jul 2013 18:29 Edited at: 3rd Jul 2013 18:29
To fix it inside AppGameKit you could use a smaller world scale, i.e. using object positions of 5 and 10 instead of 500 and 1000, this would reduce the length of the vectors when they reach the shader. But there's no harm in scaling everything down inside the shader if you are dealing with distances you think might exceed 128 world units (128*128=16384).
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 3rd Jul 2013 18:37
We are here to help each other

Paul you help me alot with stupid shader questions so nice to be able to help you
I will add this to my shader thread as an heads up

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 4th Jul 2013 08:53
I actually had this problem before now that I think of it. I think I brought it up in another thread a while ago that the pointlight scaled off after a certain length, weirdly enough I only tested it on S3 and thought it happened on all mobiles. I ended up rescaling the 3d world instead. Completely forgot about that now

My hovercraft is full of eels

Login to post a reply

Server time is: 2024-05-04 03:26:47
Your offset time is: 2024-05-04 03:26:47