x


How do I fix directional light problem with multiple instances of prefab?

This works perfectly in the editor (mac). On the iOS device (iPad 3) it does not work correctly. I'm instantiating a simple low poly object multiple times. I'm using the mobile / diffuse shader with an opaque texture.

If I instantiate one prefab the directional lighting works correctly.

If I instantiate several the lighting dims on all objects. They are still lit but appear at 50% brightness.

I've tried switching the shader to an unlit variation and this works as expected. It appears related to directional lighting but, as yet, I haven't figured out the cause.

Thanks!

more ▼

asked Jul 03 '12 at 08:12 AM

idunlop_oefun gravatar image

idunlop_oefun
209 1 2 4

Try to the inspecter window the the model that you are using and set normals to calculate instead of import

Jul 03 '12 at 12:44 PM vatsalAtFEI

Yeah, already tried that. It made no difference. A single instance works, it breaks when there is two or more instances.

Jul 03 '12 at 05:35 PM idunlop_oefun

If I replace my models with a unity cube it works as expected. So it's definitely related to the model. I tried exporting as collada and wavefront - both have the same issue / doesn't work.

Jul 03 '12 at 06:50 PM idunlop_oefun

In case anyone is interested, I've submitted this issue with example as a bug. This is the unity project showing the issue: https://www.dropbox.com/s/d9nfd0zgtpdvkrd/directionalLightBug.zip

Jul 03 '12 at 07:26 PM idunlop_oefun

I too am seeing this issue. See my question here (http://answers.unity3d.com/questions/278948/why-does-the-lighting-on-an-object-change-when-mul.html)

It appears to have something to do with the object's scale. In the directionalLightBug project, if you change the object's scale to 1, the lighting behaves as expected. If the scale is 0.5, the lighting is twice as intense. If the scale is 2 the lighting is half as intense. Basically the light intensity seems to be inversely proportional to the objects scale.

Jul 04 '12 at 06:29 PM zmeinaz
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I believe this is a bug. However, until Unity either a) fixes it or b) explains why this breaks I have figured out a workaround.

I created a simple script that instantiates a unique material for each instance of my prefab and sets the 'Renderer.Material' property with this new Material instance.

The downside is that this breaks batching. I'll update this answer if I hear back from Unity.

See comment from zmeinaz for alternate workaround.

Update: It's now fixed according to Unity. I assume that means it will be in the next build (> 3.5.3f3).

Update: This is still broken in 3.5.4f1 when testing on iOS device (iPad 3).

Update: This is now working in 3.5.5f2 (tested on iPad 3 / iOS 6b4).

more ▼

answered Jul 03 '12 at 10:21 PM

idunlop_oefun gravatar image

idunlop_oefun
209 1 2 4

I am still seeing this issue with Unity 3.5.4f1. Anyone else?

Aug 01 '12 at 04:38 AM zmeinaz

Yes - still broken on iPad 3 for me in 3.5.4f1.

Aug 02 '12 at 03:31 AM idunlop_oefun
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1953
x425
x286
x42

asked: Jul 03 '12 at 08:12 AM

Seen: 964 times

Last Updated: Aug 10 '12 at 06:38 PM