Search Issue Tracker

By Design

Votes

0

Found in

2017.4.0f1

2018.3.0a1

2018.3.6f1

2019.1.0a1

2019.2.0a1

Issue ID

1132472

Regression

No

[iOS] Mobile Bumped Diffuse shader doesn't reflect animated light blinking

Shaders

-

To reproduce:
1. Open users attached project "LightAttnTest.zip"
2. Open "SampleScene.unity" scene
3. Enter Play mode
4. Observe as the object reflects the blinking light
5. Build to iOS
6. Deploy the Xcode project to an iOS device
7. Observe as the object does not reflect the blinking light as it's not even blinking

Expected result: the object reflects the blinking light in a similar way as in the editor
Actual result: the object doesn't reflect the blinking light on the iOS device

Reproduced on:
2017.4.0f1 2017.4.25f1 2018.3.12f1 2019.1.0b10 2019.2.0a10

Device reproduced on:
iPhone 8 Plus iOS 11.0

Notes:
Changing the shader type of ThirdEye material in the Asset folder form custom users type to Mobile/Bumped Diffuse gives the same result.
This doesn't reproduce on Android.

  1. Resolution Note (2019.3.X):

    Few points about the issue:

    1) Object scales - both the range of point light and the model use terribly small values. That can cause many undefined behaviours/artifacts in the future. So tweaking model sizes and light range value would be my main recommendation

    2) The user is correct that lightning attenuation is the cause of the problem. As attenuation is using half precision type for mobile, and editor is using floats (more about this https://docs.unity3d.com/Manual/SL-DataTypesAndPrecision.html), this creates some Inf/NaN values in the vertex shader when doing attenuation calculations. This is caused by the reason 1 - as small range and bigger point light intensity causes attenuation to be over the roof

    3) if the user doesn't want to tweak the sizes of objects it can be fixed by adding a clamp in the users shaders vertex shader with something like this:

    unity_4LightAtten0 = clamp(unity_4LightAtten0, 6.103515625e-5, 65504.0);

    This would ensure the value is in range for mobile calculations.  

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.