- Home /
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)?
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
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, $$anonymous$$esites, etc). I was planning on getting the terrain type to deter$$anonymous$$e 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~ $$anonymous$$ute load times.
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.
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?
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.
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.
A $$anonymous$$or point, but you can technically store 4 textures in a splat map because you can use the alpha channel as well.
Unless you want to use it for transparency possibilities of course ;)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Unity Rendering Gone Weird 1 Answer
Shadows in unity 3d 1 Answer
Upgrading Unity 3.2 Problems 2 Answers
Prevent colliders intersecting. 1 Answer