Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to create random color on spawned decal?

Hi I have decal which I used in projectile blueprint, it is spawned at the place where bullet hits the object. The decal should have random color each time it is spawn and fade after few seconds. I made the fading working. but not 100% happy with this. I was trying to add random colors to the texture by adding setColor function into blueprint which use Global Collection Parameters, but actually it does not work at all and I don't have idea how to do this.

Here is Link to Youtube Video of what I actually achieved till now, maybe it will become clearer

I am a newbie to the UE4, so please if someone can explain me all that I will appreciate this.

Bellow I place blueprint I create on the basic projectile basis, and Material I have

alt text alt text alt text

Product Version: UE 4.10
more ▼

asked Dec 07 '15 at 11:58 AM in Blueprint Scripting

avatar image

1 2 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You can only set parameters on an Dynamic Materials Instance. The "Collection" Parameter of "Set Vector Parameter Value" is the reference to the Material of your Decal.

Dynamic Material Instance

Since that's a common topic on AnswerHub, I'll just link to one of my previous explanations on how to do Dynamic Materials :) And here is the Tutorial in the Docs.

more ▼

answered Dec 07 '15 at 12:21 PM

avatar image

859 23 9 40

avatar image Szarley Dec 07 '15 at 09:16 PM

Ok, I get that I can't manipulate decal parameters, so then how can I spawn the material on the surface at the bullet impact location?

avatar image Enlo Dec 08 '15 at 09:32 AM

no, thats not true, you can manipulate parameters. Your problem has nothing to do with decals itself; my statement holds true for every object:

Material parameters can only be changed on instanced materials. When you select a material on a actor/decal, it is static. That is good for performance, but you may not change any parametzer at runtime.

Do it like in the screenshot above, this creates an INSTANCED copy of a material and set it as the material of your decal. You then can manipulate all parameters of your material.

avatar image Szarley Dec 08 '15 at 04:37 PM

Ok, got it working somehow. But there is small issue, with apperance of the decal.

You can see it on this Youtube video

The decal gets random color but it is seen only on part of it, not always on the horizontal surfaces. Do you know what can be wrong with it?

avatar image Enlo Dec 09 '15 at 12:27 PM

I suggest you place the decal manually into the level and play around with it's orientation and the decal box height. The decal might get cut off because it's height is not big enough.

The problem with decals is, that they are a flat representation on the surface of objects which do not necessarily all have the same orentation nor are they always flat. So they can get stretched, as you can see in the screenshots of the tutorial too.

avatar image uehero Aug 16 '17 at 05:35 PM

I have the same issue here, Did anyone knew how to fix it, i tried applying dynamic material instance, but couldn't change it in game.Please help

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question