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"

Material Function Complexity vs Separate Smaller Functions?

Hi all, this is my first question here, as our studio recently switched to Unreal Engine and I was tasked into creating terrain shaders/materials, which brings me to my first question concerning material functions!

I was wondering what is best between having 1 material function that takes care of 3 textures( DIFF, SPEC and NRM), or 3 separate functions so that both functions for the DIFF and SPEC textures are rather simple, and the function for the NRM map is more complex?

I am doing World Aligned/Tri-planar projection, and the DIFF and SPEC parts are just some simple Lerps, but the NRM part does more then just Lerping. If all 3 textures go through the same function, does it mean that function gets called 3 times? If yes, wouldn't it be faster to use separate, smaller functions for the DIFF and SPEC maps instead?

Thanks for your time! Steph

Product Version: UE 4.11 Preview
Tags:
more ▼

asked Jan 21 '16 at 01:55 AM in Rendering

avatar image

Stephane Roncada
23 2 6 8

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

1 answer: sort voted first

Hey Stephane, As far as I know (and please someone, correct me if I am wrong) if you have three copies of one material function, which are assigned to Diff, Spec, Norm, it will be used three times. a material function is basically nothing more than a pre-made group of nodes. There is no advantage besides easier to use/faster to place than constantly recreating them.

so in your case, it might be better to have a separate material function for the specific thing you need it for. That said, if an input/output and the nodes between them are not connected to other input/outputs those nodes will not be called.

So if the material function has 3 inputs (X, Y, Z), and three outputs (X, Y, Z), and the nodes between them do not mix and match. (so all nodes from X do not combine with Y or Z) you could make one material function out of it.

On another unrelated note, UE4 is a physically based renderer (PBR), meaning that Diffuse is outdated, and should be replaced with Albedo. Specular map is almost never needed, and should be replaced by a roughness map for accurate realistic light reflective values. Loads of documentation on PBR: https://docs.google.com/document/d/1Fb9_KgCo0noxROKN4iT8ntTbx913e-t4Wc2nMRWPzNk/edit

more ▼

answered Jan 21 '16 at 05:21 PM

avatar image

Luos
9.3k 286 65 330

avatar image Stephane Roncada Jan 21 '16 at 05:42 PM

Hi Luos, thanks for the reply and the tips about Albedo & roughness, this helps a lot moving forward :)

(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