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 can i spawn actors based on an image mask?

Using blueprints, is it possible to spawn actors based on an image mask?

The mask image would be Black and White. I would like to spawn a list of actors on either the black or white areas. Is that possible in blueprints?

Product Version: UE 4.20
more ▼

asked Oct 20 '18 at 10:40 AM in Blueprint Scripting

avatar image

6 1 1

avatar image ThompsonN13 Oct 20 '18 at 02:20 PM

it should be possible in theory though its not easy and may require some c++ or plugins. i tried something similar with limited success a while back. basically you need to get the pixel position and multiply it so it matches a predetermined grid, so say each pixel represents 100x100uu in world space. then you need to read the value of the pixel and round it to the nearest whole number to eliminate issues from gray. the colors should be a vector 4 so it shouldnt be too much of an issue there. then use the color value with a equal node or a in range node to determine is a spawn is needed.

when i attempted this i was actually making a voxel style world and placing cubes (z axis) based on the value of the pixel

avatar image ThompsonN13 Oct 20 '18 at 03:09 PM

hmmm last reply didnt post lets try this again. below is a working example of what your attempting to do which uses Rama's victory plugin. do note that while making this example my editor crashed several times so be cautious.

now this spawner actor works by: getting the pixels from the input texture and adding them to an array. then we get each pixel based on its position. we then get the red channel (arbitrary decision) since its a black and white image and see if its value is in a range of 0-0.5 or black. if the pixel is black we spawn a actor. the actors location is based on the pixels position multiplied by the grid size (100uu in this case). i then based the origin of the spawned actors on the location of spawner actor. i executed this script based on a custom event which can be called in the editor, see the details panel on the right.

alt text

capture.png (376.6 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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