• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by GADefence · Jul 03, 2011 at 05:03 AM · splatmaps

Splatmap performance question

When using multiple splatmaps, how much of a performance hit does the game take? Is it noticeable on most PCs (less then 10 years old, probably less then 5) or is it grave? Also, is the performance hit linear (2x splatmaps = double the generation time for splatmaps as before, 3x splatmaps = 3x), or exponential (2x splatmaps = 4x generation time, 3x splatmaps = 12x, etc)?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by aldonaletto · Jul 03, 2011 at 11:06 AM

At least in the terrain shader, the splatmat is a control texture where the r, g, b and a chanels are used to store the alpha values of the four textures which will actually be combined. The terrain shader always combine four textures, even if you don't define all of them - the undefined textures use default values. If you define more than 4 textures, than a second splatmap will be used, which will double the rendering time. In a rough approximation, the time taken will be proportional to INT(numTextures/4)+1

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GADefence · Jul 03, 2011 at 08:28 PM 0
Share

0

I should have been more specific - yes, I'm talking about splatmaps for terrain. I'm planning on making a city builder type game, and wanted to use a multitude of terrains (snow, water, desert, rough(mountainy) terrain, open terrain, farmland, minesites, etc). I was planning on getting the terrain type to determine a lot of aspecs of the game, since it's a 2D type game with less other objects I assume most of the load time would be loading the ground terrain but was making sure having a few splatmaps wouldn't mean 30~ minute load times.

avatar image aldonaletto · Jul 04, 2011 at 01:56 AM 1
Share

The rendering process usually is the greatest performance killer. If the terrain is rendered in 4 mS with 1 to 4 textures, for instance, it will take 16 mS to render with 13 to 16 textures. But since in a 2D game only a small part of the terrain is visible at any time, rendering this small section probably will not be a problem.
I think you will not have problems to load the terrain textures either. They are not too big or too numerous to require extraordinary loading times - most FPS games have more and bigger textures associated to the meshs.
In order to test this, you can create a simple terrain and add as many textures as you intend to use in your game (add any 512x512 textures available just to test it). Check also the rendering performance adjusting the main camera to see approximately the same terrain area you're intending to show in your 2D game. I believe you will not have problems loading the textures or rendering the scene.

avatar image chanfort · May 12, 2016 at 11:00 AM 0
Share

It was 5 years since last post, but maybe somebody is still alive here. Firstly, nice to see INT(numTextures/4)+1 expectation, which helps better planning on deciding how many splat maps to put on the project. However, I am curious if anyone could guess how it depends also on texture resolution vs number of splat maps?

For example which approach could be faster - 4 different splats with texture resolutions of 1024x1024 or 16 different splats with 512x512 textures?

I am generating procedurally various textures and wandering if I use extremely large number of splats (maybe hundreds) with low res textures (lets say 128x128) to bring more variety on the terrain. So was kind of wandering would it be worth doing so?

avatar image tanoshimi chanfort · May 12, 2016 at 11:59 AM 0
Share

The decision between 4x(1024x1024) and 16x(512x512) splats is not really one of performance - they'll give different results. The first will give a higher level of granularity of a limited number of feature types; the second will give lower granularity of more features. In terms of performance, each additional set of four textures requires one more draw call, so the second approach would be marginally more expensive.

avatar image
0

Answer by Marnix · Jul 03, 2011 at 10:13 AM

I'm not quite sure what you mean by performance, but probably FPS. And I'm not quite sure what you mean with using multiple splatmaps. So I assume that you want to use them on different objects and not multiple splatmaps on one.

A splatmap is a texture, which needs 3 extra textures for each color (R,G,B). So when using a splatmap on an object, the shader needs to do 4 texture look-ups. Also, your GPU has to accept 4 textures from a material, which all have to be sent through the bus of your pc.

Your GPU shouldn't do too many texture switches. So reusing textures is a good thing. Don't try to make all your objects splatted. It would be a better thing to bake one good texture for the object.

We could state that, using one extra splatmap with different textures to splat is: extra splatmap = 4 extra textures, so it has a linear function of y = 4x in performance. But you will not see this in your FPS counter. You should look to ms/frame instead. This gives a better indication of your drawing. Turn on the stats in your game view to see the number of draw calls and texture switches.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Peter G · Jul 03, 2011 at 02:22 PM 0
Share

A minor point, but you can technically store 4 textures in a splat map because you can use the alpha channel as well.

avatar image Marnix · Jul 03, 2011 at 02:25 PM 0
Share

Unless you want to use it for transparency possibilities of course ;)

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

C# GUI Destroy or Disable? 1 Answer

Unity iPhone Textfield 0 Answers

Weirdest Collision EVER 1 Answer

Health value isn't subtracting correctly 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges