Material swapping causes weird colors

Hello,

I’ve been told in this thread to post it to bugs section here.

So I am making a simple RTS type
building system. I click on a menu, I
get a building follow my mouse cursor
until I click, at which point it is
placed.

However, while it is being dragged i
changed its material to be a different
one (transparent red), in the end I
simply set the material back to how it
was by using a temp variable where i
saved the material.

Now the problem is that the first few
buildings i place are all OK, but the
third one and so on gets weirded out.
Sometimes they get much darker,
sometimes they get wonky colors and
start glowing. Things like that.

https://forums.unrealengine.com/attachment.php?attachmentid=12482&d=1411631187

Also here are the places in blueprints where i change material.

Let me know if you need any more information.

Hey Algirdyz -

Can you post a screenshot of your material setup?

Thank You

Eric Ketchum

The ones that already exist on the model are basic materials that I found in UE4 I did not change them.
Then I switch the meshes to this material. Very simple. Solid color and translucency.
Then I change it back to the one that was on the mesh before.

Hey Algirdyz -

I have come across a similar issue of this bright flaring in the past that may or may not be connected with what you are experiencing. Do you still experience the bright flaring if you set ‘r.Cache.LightingCacheDimension’ console variable to 128, you will need to do this in the Consolevariable.ini file in the Config sub-directory of your engine’s install.

Let me know -

Eric Ketchum

If you meant that I should enter a new line there like this
r.Cache.LightingCacheDimension=128
then save and start the editor, then it did not help.
But I wanted to note that the change of color does not always go glowing like that, sometimes it just becomes much darker.

I want to make sure that we are on the same page. You will need to place that variable ’ r.Cache.LightingCacheDimension=128’ into the consolevariable.ini file itself, which can be found at UnrealEngine\4.4\Engine\Config\ConsoleVariables.ini and you want to make sure that you do not include the ‘;’ before the variable, that is to comment out the variable only. Then, restart you engine.

Thank You

Eric Ketchum

yes that is exactly what I did

Hey Algirdyz -

Thank you for the confirmation I wanted to double check on the placement. What type of lighting are you using in the level and are you using straight Spawn Static Mesh’s or are you spawning Static Mesh Instances?

I will continue to work on reproducing this error while I await your response -

Thank You

Eric Ketchum

I actually spawn them as blueprint actors.
I have a BaseBuilding blueprint class where I added an empty mesh component. Then I inherit it in another blueprint where I use SetStaticMesh in the constructor to assign an actual mesh. Later on I just use SpawnActorFromClass to spawn the building.

Also, I don’t think I changed lighting since I created a top down blueprint template. I can only find the Directional light in the scene outliner if that is what you are asking. Let me know if you need any more specific info.

Hey Algridyz -

Can you try to set a Dynamic Material Instance for your spawned meshes instead of just setting a material or are you already doing this? I have built a test example of this and have not been able to replicate the exact behavior that you are expriencing. After trying the above and if that doesn’t work for you I might need to get a text project from your to look into trying to solve this for you.

Thank You

Eric Ketchum