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 declare function in material custom node?

I want to store some codes in a function that update some of my variable that can be called from main function,i turned on shaderdeveloopment in coonfiguration but it didnt give much information float3 tex; float rh=1; float prh; float th; float pth; float ri=0; float hs; float ph; float uvd;

 void update(float ho)
 for(int i=0;i<MaxSteps;i++)
 float4 ouput={UV,ri,rh};
 return ouput;

alt text

Product Version: UE 4.13
more ▼

asked Dec 17 '16 at 12:26 PM in Rendering

avatar image

10 1 3 3

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

1 answer: sort voted first

You cannot declare a function in a custom node, yet you can do so with ease in UE4 shader files, located in Engine/Shaders.

Make your own USF file with your functions, and include it to Common.USF

Then you can call it from custom node.

more ▼

answered Dec 18 '16 at 06:16 PM

avatar image

7.8k 130 31 293

avatar image xy2015 Dec 19 '16 at 03:48 AM

That sounds too hard for me,I just inlined the function manually,also my function is to update variable inside my custom node,can this do that?thanks for the information.

(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