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"

[Closed] [Request] Make materials more like blueprint classes

Hello,

I think material editor workflow is outdated for unreal 4. What I would like to see is complete redesign of material editor to make it look more like blueprint class workflow.

Actually a material workflow is like a function with return node in blueprint class that is called every tick or? What about to create own flow control, compare variables with conditions, add local variables, access to owner actor variables, access to owner particle etc like in blueprint class? That would make materials much more flexible, dynamic and easier to use and make things like dynamic material instances and dynamic parameters redundant.

I do not know if you already think about it or I am just stupid with this suggestion than sorry if yes.

Product Version: Not Selected
Tags:
more ▼

asked Feb 28 '15 at 05:46 PM in Blueprint Scripting

avatar image

Footman
219 18 19 42

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

The question has been closed Apr 02 '15 at 05:04 PM by Footman for the following reason:

Other


1 answer: sort voted first

From what I understand Materials are just node editors for creating shaders. Shaders are programs that are run on the GPU instead of the CPU, and only work with vertex/pixel data. The GPU doesn't understand code the same way as the CPU does, and doesn't have access to the same memory that the CPU does so pointers to Actors will never work.

Materials do have flow control, the way I see it is that it just evaluates right-to-left instead of left-to-right. You can use the "If" node to do comparisons between variables, and the shader will take a different path depending on the result (< or >=).

Constant Materials are compiled before runtime to save performance, so they can't ever take variables/values as parameters at runtime. If you need to have complete control of parameters, you have to use a Dynamic Material. However, they are quite expensive, so if you have only 1-10 states or so, I would recommend making 1-10 instances of Constant Materials with overloaded parameters instead. Constant Materials are a lot faster.

Constant materials do not need really need to be updated (Unless you're using the Time function maybe?) because nothing will ever change. A Dynamic Material can be different for every object that uses it every frame, so I would guess that it would be updated per-object, per-render call. One update per object every 1/60 seconds could be very expensive, as you could well imagine.

more ▼

answered Feb 28 '15 at 08:20 PM

avatar image

riandrake
156 8 10 12

avatar image riandrake Feb 28 '15 at 08:22 PM

So the thing about Constant vs. Dynamic is basically speed vs. memory usage. Just like anything else in programming, it's all about finding a balance.

avatar image Footman Feb 28 '15 at 08:32 PM

If materials do not have same possibilities like actors do, how do they access such dynamic informations like camera position, object position, word position, vertex position, rotation etc. Even panning materials need update ticks or?

I do not say that materials should work exactly like actors. They may be converted to the shaders by the engine later. I just think the workflow is too different from blueprint workflow while there is similar functionality. Maybe set if function should be called once or some amount of frames to save performance.

avatar image riandrake Mar 02 '15 at 08:41 PM

Objects like cameras are common in rendering, as to take a world and project it into screen space you need to know things such as camera position/rotation for building a WVP matrix. But the camera would not be passed through as an actor, its members would be passed through as parameters. You can already use your own parameters, those parameters just cannot be actors; a GPU cannot evaluate a pointer like the CPU does.

Materials and shaders are very expensive by nature, and you should be using dynamic materials as little as possible. At most, the calculations done by a dynamic material could be processed once for each and every pixel on the screen every frame. I don't think blueprint is nearly optimized enough to be handling that much work.

The GPU is not faster than the CPU, it is actually much slower. The only reason the GPU can calculate vertices/pixels/particles faster than a CPU is because a CPU typically has 1-16 threads whereas the GPU can have hundreds. This makes the GPU very good at doing small operations over a large number of elements in parallel, but also very poor at evaluating conditional statements. Conditional statements deteriorate GPU performance very quickly.

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

Follow this question

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

Answers to this question