0
\$\begingroup\$

I need 2 light sources looking at a different direction as per my design. This means, I cannot flag one of them as 'not-important'! I found that because I'm using 2 directional lights, drawcalls are aggrevated. Can somebody provide me a direction.

With one DL: 7 draw calls. With 2 it goes to 60 odd. It is the same case if I switch them vice versa.

\$\endgroup\$
0
\$\begingroup\$

The first question is, which RenderingPath do you use? You can choose a path at PlayerSettings|OtherSettings|RenderingPath. There are some pros and cons of each and you can read more about them and their differences, especially in performance, here.

Second important thing are your light quality settings, especially the pixel lights count. Flagging light as 'not-important' means that it could use vertex lighting instead of pixel lighting.

Since pixel lights are much more expensive than vertex lights, Unity will only render the brightest lights at per-pixel quality. The actual number of pixel lights can be set in the Quality Settings for webplayer and standalone build targets.

You can explicitly control if a light should be rendered as a vertex or pixel light using the Render Mode property. By default Unity will classify the light automatically based on how much the object is affected by the light.

You can check RenderMode property on each light you use.

Another good place to look at is how many textures are you using on your objects, how many vertices they possess and how complicated are shared you are using. All these three factors are relevant, when it comes to use built-in dynamic batching unity feature.

Also, you can experiment with point light instead of second directional light, the point light could be also attached to the camera. Can't say anything better without more knowledge of your specific case, hope that these information will give you any help.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hi Kreys, thanks for detailed response. However,I need to use Forward rendering for not to compromise on my design. I need to find out some other way! \$\endgroup\$ – MogambO Apr 28 '14 at 18:50
0
\$\begingroup\$

I have to insist on Vertex lighting for most games, I can only speak for my game and my experience though. What shaders are you using on your objects, try to stick with diffuse, and other low shaders.

Are your textures optimised? I think that could well be a problem; do you have static batching (Unity Pro)? Have you created a texture atlas?

All the above can help/ruin your DrawCall count.

(I can not comment, not enough reputation).

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

You could always write a shader to render objects in one single pass for multiple lights:

http://en.wikibooks.org/wiki/Cg_Programming/Unity/Multiple_Lights http://kylehalladay.com/blog/tutorial/bestof/2013/10/13/Multi-Light-Diffuse.html

What about shadows? Because they also add more passes, and as I remember correctly dynamic batching won't work on the shadow pass. I suggest to test your code on the device you're targeting, maybe the framerate is acceptable even with lots of draw-calls.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.