Home Technical Talk

Some quick texturing questions.

JordanN
interpolator
Offline / Send Message
JordanN interpolator
1. Can Vertex colors be changed at run time? Example, if I have a car during day time and I want the "shadows" on it to change based on which direction it's facing.

2. Are Vertex Colors expensive to use?

3. Are Vertex Colors still used in PS4/XBO production?

4. For large environments, is it normal to have a lot of unique materials? This is after using all shortcuts and cost cutting techniques (i.e channel packing, material instances, texture atlases).

Replies

  • JedTheKrampus
    Options
    Offline / Send Message
    JedTheKrampus polycounter lvl 8
    1. You wouldn't do that by changing the vertex color data at runtime, but by creating a custom vertex shader. Typically shadows are computed into texture maps instead of vertex attributes, because vertices are usually too far apart to make the shadow look good. I suppose it could be possible in theory, but it would be like having a 16x16 lightmap on a big object, e.g. no fun.

    2. They can be expensive to use if your mesh has a billion vertices on it.

    3. It depends on the game engine and how the shaders are set up. Typically vertex attributes are used to represent low-frequency phenomena, like ambient occlusion, material masks, bone weights, UVs, tangent basis, and low-frequency normals. Guilty Gear Xrd uses all of the vertex color channels to modify things like the amount that the inverted model must be pushed out to create an outline (i.e. stroke weight). I'm sure other engines use them wherever it's efficient and useful. The nice thing about vertex colors is that they don't depend on texture resolution, so if you set up a tiling UV set you can get some things uniquely mapped with vertex color.

    4. Clarify pl0x. Are you talking about overall draw call count, number of unique shaders, number of assets that are uniquely UVd, or what? If you're on idTech or you have an Amplify Texture license for Unity you can uniquely UV whatever you want and it's fine because of ARB_sparse_texture. Otherwise you'll probably be using a lot of tilable textures combined in clever ways to hide their tilingness. If you want to know the draw call count for a current gen game see if you can attach a graphics debugger to one on your PC.
  • JordanN
    Options
    Offline / Send Message
    JordanN interpolator
    4. I'm use to UE4, so I mean the literal "materials" you create.

    For example, here are a bunch of materials I made for a Bathroom environment.
    iRW63441NI24q.png

    I will optimize them more but does it matter if I make 10 or 50 of these for a game if there are a lot of different objects?
  • JedTheKrampus
    Options
    Offline / Send Message
    JedTheKrampus polycounter lvl 8
    The real answer in my opinion is "run a profiler and see if it slows the game down too much." I don't think UE4 should have any trouble running 50 drawcalls and 50 materials, and as DX12 support gets rolled out you should have no trouble with 10,000. Of course if you have a 4k texture on each of those you'll have problems. Don't do that, or if you insist on being able to do that pester Epic to support megatextures properly.
  • billymcguffin
    Options
    Offline / Send Message
    billymcguffin polycounter lvl 11
    In UE4, I guess usually you'll have a generic "master" material which has basic functionality and standardized texture inputs, and then you'd parameterize it and create a bunch of material instances based on the one master material. For instance, if you had a floor tile material, a wallpaper material and a counter top material, and for each of those materials you had albedo, roughness and normal, you could make one material and just create a material instance for each surface. Then you'd also make different materials for cloth things and clear things because they have different base functionality.

    I don't believe they have realtime performance benefits, but they do allow for faster iteration because changing a parameter in a material instance doesn't require you to recompile the base material.

    Here's the UE4 docmuentation on material instances: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/MaterialInstances/index.html

    Hope that helps!
  • Ashaman73
    Options
    Offline / Send Message
    Ashaman73 polycounter lvl 6
    JordanN wrote: »
    1. Can Vertex colors be changed at run time? Example, if I have a car during day time and I want the "shadows" on it to change based on which direction it's facing.

    JordanN wrote: »
    2. Are Vertex Colors expensive to use?
    Not really. A vertex color is usally 4 bytes only, for comparision:
    texture coords are ~4/8 bytes, position is ~12 bytes, bone weights ~4/8bytes, normal ~8/12bytes, tangentspace >=8bytes

    JordanN wrote: »
    3. Are Vertex Colors still used in PS4/XBO production?
    Why not ? Nowadays your engine defines the attributes which are associated with a vertex. Therefor vertex color could be used as visual representation of a custom vertex attribute, eg to blend different textures or just to add some more tinting/variation to the same texture etc.
Sign In or Register to comment.