User Tools

Site Tools


hpl3:engine:optimizations

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:engine:optimizations [2012/10/08 13:48]
thomas [Objects]
hpl3:engine:optimizations [2015/09/17 10:59] (current)
ian.thomas [Physics]
Line 15: Line 15:
 In order to use premultiplied alpha simply copy the alpha layer in photoshop and paste it as a multiply layer on top of the rgb. Then just set the materail to use pre-multiplied alpha. Note: In order for fading to work in particles, you also need to set multiply alpha with color! In order to use premultiplied alpha simply copy the alpha layer in photoshop and paste it as a multiply layer on top of the rgb. Then just set the materail to use pre-multiplied alpha. Note: In order for fading to work in particles, you also need to set multiply alpha with color!
  
-===== Objects =====+===== Static ​Objects =====
  
 **The fewer the objects, the better**\\ **The fewer the objects, the better**\\
Line 21: Line 21:
 So how many are too many? Well it depends. Depending on how many lights are rendered, particles on screen (and overlapping),​ world reflections present etc you will have more or less time to render out objects. But to give sort of pointer, having 150 objects visible at a time is a good goal. Important note: if u have only made a single room so far, do not celebrate, if u have many connecting rooms later on, all objects will not be culled or slightly visible, adding to the total number of visible objects. A maximum figure would be 300 objects, but do not get up to this until really needed! So how many are too many? Well it depends. Depending on how many lights are rendered, particles on screen (and overlapping),​ world reflections present etc you will have more or less time to render out objects. But to give sort of pointer, having 150 objects visible at a time is a good goal. Important note: if u have only made a single room so far, do not celebrate, if u have many connecting rooms later on, all objects will not be culled or slightly visible, adding to the total number of visible objects. A maximum figure would be 300 objects, but do not get up to this until really needed!
  
-In order to reduce the number of objects there are three main ways to go about. ​+In order to reduce the number of static ​objects there are three main ways to go about. ​
   * First thing you need to know is that the game's engine will try and combine static objects ad efficiently as possible. This means that even though you place, say 100 static objects, this might end up being less than 10 in the final version. The way this can be done is if many of the objects share the same material (making it possible for the engine to combine). This means that static objects that are close by to one another should try and save the same material as much as possible. But do not go overboard on this. Do not rely on huge 4096x4096 textures for all static, and have illum textures, etc that are mostly black.   * First thing you need to know is that the game's engine will try and combine static objects ad efficiently as possible. This means that even though you place, say 100 static objects, this might end up being less than 10 in the final version. The way this can be done is if many of the objects share the same material (making it possible for the engine to combine). This means that static objects that are close by to one another should try and save the same material as much as possible. But do not go overboard on this. Do not rely on huge 4096x4096 textures for all static, and have illum textures, etc that are mostly black.
   * While the engine can combine pretty good on its own, it does not work very well with smaller objects. Because of this you should have smaller objects as groups of objects instead, for example a group of 6 mushrooms in various configurations. It is okay to have single objects, but use the groups to place the bulk of them.   * While the engine can combine pretty good on its own, it does not work very well with smaller objects. Because of this you should have smaller objects as groups of objects instead, for example a group of 6 mushrooms in various configurations. It is okay to have single objects, but use the groups to place the bulk of them.
Line 39: Line 39:
  
 **Only use spec when really needed**\\ **Only use spec when really needed**\\
-Specular means a lot of extra calculations for the light shader, and increases the perfomance cost of it by quite a bit. Because of that, make sure that not too many specular casting lights hit the same screen pixels (perferabbly fewer than one specular light per screen pixels). This often also makes the game look better. Lights with no specular can then at quite a low costbe used to simulate ambient light and light bouncing. So make sure to place those specular casting lights in places where they count!+Specular means a lot of extra calculations for the light shader, and increases the perfomance cost of it by quite a bit. Because of that, make sure that not too many specular casting lights hit the same screen pixels (perferabbly fewer than one specular light per screen pixels). This often also makes the game look better. Lights with no specular can then be used at a pretty ​low cost. This allows them to be used to simulate ambient light and light bouncing. So make sure to place those specular casting lights in places where they count!
  
 **Do not use too many shadows**\\ **Do not use too many shadows**\\
Line 57: Line 57:
 Next thing to do is to add mesh shapes (these are shapes that are added through special naming in the model file) for high polygon objects. This include things like pillars, high detail walls and more. Do not use it on everything, but consider it for everything above 500 triangles or so. For some objects, like a rubble of rocks, it is better not have have it because it can be too complex to add collision shapes. For most objects it is well worth the job though. It makes the game take up less ram and also make collision testing faster (unless a lot of geometry shapes are used that is, so do not go wild) Next thing to do is to add mesh shapes (these are shapes that are added through special naming in the model file) for high polygon objects. This include things like pillars, high detail walls and more. Do not use it on everything, but consider it for everything above 500 triangles or so. For some objects, like a rubble of rocks, it is better not have have it because it can be too complex to add collision shapes. For most objects it is well worth the job though. It makes the game take up less ram and also make collision testing faster (unless a lot of geometry shapes are used that is, so do not go wild)
  
 +===== Visibility =====
  
 +You can divide up the map into collections of geometry, making only some of it visible when necessary. To do this, check out [[hpl3:​game:​visibility_area|Visibility Areas]].
hpl3/engine/optimizations.1349704098.txt.gz ยท Last modified: 2012/10/08 13:48 by thomas