Announcement

Collapse
No announcement yet.

I found a BUG!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I found a BUG!

    Terrain ignores static switches?

    Any time I have a static switch in my material that I apply to my terrain, the terrain reads the switch status from the main material. Not the material instance. Thus, if the default is TRUE, my terrain will only ever be able to use the TRUE version of the switch. If I set it to FALSE in the instance, any mesh with the instance will properly use the FALSE set of nodes. Terrain will not. Terrain continues to be TRUE.
    Terrain is defiant and argumentative.

    #2
    Here's another interesting thing I noticed.
    I haven't tested it beyond this one specific circumstance, but it hints at potentially being much more intrusive to the background performance of material instancing.

    I made a material to use with supermasks for my terrain.
    This material was set up to use 5 layers.
    A base layer and 4 masked layers.
    Each of these layers had a texture parameter for their diffuse and normals.
    each texture parameter was used 3 times to tile at different detail sizes and to eliminate tiling issues.
    I got a notification that I was using multiple parameters with the same name, but it was okay since I wanted them all to have the same value.
    I also added a texture parameter for the world normal to add the fine details back into the low res terrain map.

    I use each of the 5 diffuse and 5 normals 3 times each, which means that I actually have 15 diffuse Texture Parameter nodes and 15 normal Texture Parameter nodes.
    Since the sets of 3 use the same parameter name and the same texture, the engine only takes a single texture call for the set so that my GPU doesn't start crying.
    So, total of 12 texture samples. 5 Diffuse, 5 Normal, 1 World Normal, 1 Supermask.

    It works and I'm happy.
    I add a new layer to my map that I plan on using to control foliage mesh.
    The layer uses a non-instanced copy of the layer 1 textures in my Supermask material.
    It works and I'm happy. The engine recognized that it was a previously used texture and referenced the existing copy even though it was in a different layer and material. Yeah.

    I decide to add a 3rd layer with a new texture. In order to make room for it, I need to reduce my texture sample count. I go back to my supermask texture instance and set it to use the same diffuse and normals for 2 of the layers. This should mean that the engine will reference the existing textures just like with my first layer that I added. I should now have 2 texture samples to play with.

    I add my new layer with a non-instanced material that only uses a single texture (Diffuse). I get the Rainbow Error of DOOOM as my GPU screams in horror and cries for me to please end its suffering.

    I decide that I must have made a mistake in my math. To make sure, I go back to my supermask and set all of the mask layers to use the same material as my 1st added layer in my terrain (The one that worked).
    That should mean that most of my shader slots are open. My material references 4 textures. 1 Diffuse. 1 Normal, 1 World Normal, and 1 Supermask. My second layer references the same diffuse and normal as my mask layer.
    My 3rd layer has a unique texture.
    That's a total of 5 texture samples.

    I get a rainbow again.

    After some experimenting, what I've figured out is that every Texture Parameter uses a new texture slot even if they are set to the same texture. The exception to this is when the multiple parameters have the same parameter name. Then they all use the same reference because they are effectively the same parameter once the terrain compiles.
    Non parameter texture samples seem to be able to reference existing texture samples just fine.

    This means that instanced materials using texture parameters are potentially much more expensive than non-instanced textures. It also greatly reduces the potential gain of instanced materials. Using texture parameters is a big part of making universal/level-designer-friendly instances. The texture sampling code in the engine is very important though. The engine really needs to be able to reference existing textures with texture parameters.

    Comment


      #3
      If any mods are interested enough to want to verify these issues, just PM me and I can send you the material I made. It'd be a PITA to re-make for testing. It definitely verifies that switches fail with terrain and that texture parameters are not referencing existing texture samples properly.

      Comment


        #4
        Bump to make sure the mods have a chance to notice. It fell off the front page pretty quick last time.

        Comment


          #5
          The bugs in this thread still seem to be unfixed, so I'm bumping it.

          Comment

          Working...
          X