x

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"

Is there any way to get a per-material-instance random for plain StaticMesh?

I want the behavior of PerInstanceRandom, except I want it for each StaticMesh instance of a particular material I've built. I do not want to turn the mesh into a blueprint and have a construction script that creates a dynamic instance for each and configures the random number if I can avoid it. Given that each render of a given shader needs per-instance updates anyway (for things like world position, light positions, etc) then this should be possible without slowing down the renderer or requiring significantly more resources.

What I want to use it for is making procedural materials not all animate in sync.

Product Version: Not Selected
Tags:
more ▼

asked Jun 08 '14 at 12:52 AM in Rendering

avatar image

jwatte
1.2k 48 37 86

avatar image Lovecraft_K ♦♦ STAFF Jun 08 '14 at 09:21 PM

Hi jwatte -

I may need some clarification for what you are trying to do, but taking your mesh placing it into a blueprint and adding a dynamic material instance through a construction script will not incur more processes at render time than anything else you are talking about. Or am I miss understanding what you are looking for?

-Eric Ketchum

avatar image jwatte Jun 09 '14 at 02:10 AM

I want some variation between each instance of a mesh (or, really, material on mesh.) I could create a blueprint, and make the construction script clone the material to a MID, and set some "variation" parameter to a random value on the material instance. But that's a lot of work -- given that we already have, say, "Time" as an input, why can't we have "instance random" as an input for regular materials? (We already have it for instanced static meshes; this could just be extended to be supported for all kinds of materials.)

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

1 answer: sort voted first

Hi jwatte -

I think I have a better handle on what you are trying to do, here is one option by using an overlayed texture which is setup via Object Position (WS) so it will change based on where the static mesh is placed in the world. One caveat on the material, I have masked out RG from Object Position so the mesh only response to left to right movement and not up and down. You can change this based on what you mask out of the Object position.

alt text

Hope this helps you out, or at least gets you started -

Eric Ketchum

worldvarmat.jpg (136.6 kB)
more ▼

answered Jun 09 '14 at 01:39 PM

avatar image

Lovecraft_K ♦♦ STAFF
37k 701 253 732

avatar image jwatte Jun 09 '14 at 03:37 PM

Thanks! That's one way of doing it if I don't mind the value of the random to shift across the surface. In my case, think of placing rocks all over the level, and having each rock randomly taking a particular color (which could change between runs) that would be different from its neighbor. Currently, I'm solving this with a blueprint; I'm just proposing something which I think would be easy to implement and would slightly improve the workflow.

avatar image DanielW STAFF Jun 09 '14 at 06:05 PM

This would be a cool feature and can be done with reasonable performance, since there are already per-component properties being passed to the shaders. We'll add it to the list. In the meantime, seeding with WorldPosition as Eric showed is your best bet.

avatar image jwatte Jun 09 '14 at 06:27 PM

Awesome, thanks!

avatar image Davision Aug 08 '17 at 10:51 AM

Is there any news on a random node in the material editor?

(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