Home Unreal Engine

How many instructions?

polycounter lvl 15
Offline / Send Message
Snader polycounter lvl 15
So I was just screwing around in UDK, and I made a pretty nice looking material - and then I looked at the statistics. Apparently it is 59 LightEnv shader instructions, and 114 vertex shader instructions. Which sounds afwully high?

firematerial.jpg

I tried cutting out things, but it'll only affect the LightEnv figure. The vertex shader stays at 114 instructions, even if I cut down to a simple texture for the alpha and the yellow Constant3 for color.

My questions:
-Did I break something with the vertex shader?
-What are normal amounts of shader instructions for a current gen material like this? A fire in say, Skyrim, or Gears of War?

Of course, deeper discussion about shader instructions is welcome in this thread too (if it grows, I'll edit this post)

Replies

  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    man something must be broken, i have done full Diffuse, Spec Gloss normals and detail normals on a vertex blend shader for 98 instructions.

    though you could easily drop down to 1 texture sample by putting both your grescale textures in to red and green of 1 texture, than masking out a channel of a texture coordniate and clamping it to get your gradient.
  • Snader
    Offline / Send Message
    Snader polycounter lvl 15
    I thought that would actually cost instructions, but save texture space? Does channel-splitting actually save shader instructions?

    (these textures, btw, were just images grabbed from google - I uninstalled photoshop earlier today because it gave issues)
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    The diffuse color, and actual texture sampling happen in the fragment/pixel shader which as you can see is rather light.

    A baseline static color into diffuse phong model generates 38 pixel shader instructions and 33 vertex instructions.
    ie this
    UDKBaseline.jpg

    Changing THAT material to blend_translucent instantly increases the vertex shader instructions over 100.

    Don't stress about it.

    The master udk character material generates 125 pixel shader instructions and 46 vertex shader instructions. Its just how and where the data is being processed.

    fwiw you have a limit of 512 pixel shader instructions in SM3. I know, in part, because I hit it the other month trying to do something nuts. :)
  • ambershee
    Offline / Send Message
    ambershee polycounter lvl 17
    On this kind of material, the blend mode only needs to be translucent or additive, and you can then render it unlit. Put your colour into the emissive instead of the diffuse slot when you do this.

    The vertex shader shouldn't really be affected after you do this. I'd check your main node settings if something changes once you start plugging a lot of stuff in.

    Edit: Vailias beat me to it.
  • Snader
    Offline / Send Message
    Snader polycounter lvl 15
    Tried messing with it a bit more. Changing it to an unlit, additive material took it down to 27 'base pass' shader instructions and 111 vertex shader ones. That definitely sounds much more efficient.

    Anyway - should I sort of disregard the amount of vertex shader instructions, and only pay attention to the other number (59 and 27)?
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    Essentially yes. You can't control the vertex shader creation much in udk's node based editor.
    Your blend mode and material type affect it, as does anything going into worldPositionOffset.

    Just set up your material how you need it and let UDk optimize it under the hood as best it can.
    There are always going to be more pixels than verts to an object, and you can control your pixel shader instructions (for the most part).

    Fewer is faster, but don't sacrifice quality for small gains. Materials used everywhere should be kept to a lower maximum than materials for set pieces or one offs, or even characters. Even still don't go too nuts. For most things you'd be hard pressed to get terribly high anyway.
    I have a character material with masked transparency, fake sss, color bent per pixel cube mapped reflection and multiple lighting models at work and it's still under 200 instructions.
  • ambershee
    Offline / Send Message
    ambershee polycounter lvl 17
    Common sense also helps. Number of instructions is a reasonable metric when judging how complex a material is; but it's not an exact science. Instruction count is not directly related to speed/efficiency as some instructions are considerably faster to handle than others.
  • kurt_hectic
    Offline / Send Message
    kurt_hectic polycounter lvl 10
    BUMP

    Can someone could share informations about this topic, how it looks like in 2014, on pc, X1 and ps4?

    Where is maximum, optimum? How many instructions should have the "base" shader for characters, environments, ground?
Sign In or Register to comment.