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"

Gradient material along spline

Hi there,
Is there a way to adjust a gradient map (linear gradient node in base color) along a whole spline while using spline mesh component ?

If I simply set a LinearGradient as a diffuse in a material, that gradient repeats for each mesh added along the spline (basically one mesh between 2 points of the spline). I want one single gradient along the whole spline length.
Thanks a lot !

Product Version: UE 4.20
Tags:
more ▼

asked Dec 05 '18 at 12:47 PM in Rendering

avatar image

Teapot Creation
145 19 26 38

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Alright here is one solution I just found :
In my material, I put a Linear Gradient function into the alpha input of a Lerp node. In A, set a scalar parameter (named Color_A), in B another one (named Color_B).
In the actor (just a spline component), I create spline mesh components for each segment as usual, and a dynamic material instance for each one. For each segment, I have to devine Color_A and Color_B so that the whole spline covers 0 to 1 (so ie 3 segments : one from 0 to 0,33, the second from 0,34 to 0,66, the third from 0,67 to 1).

See screenshots to figure it out easier.
Let's I have to try this to use these values to UVs in order to use a mask...

pipe_material pipe_meshes_creation pipe_meshes_materials

more ▼

answered Dec 06 '18 at 09:21 AM

avatar image

Teapot Creation
145 19 26 38

avatar image redbox Dec 06 '18 at 09:28 AM

And where is the difference between this and solution I proposed?

The same you assign material instance to every spline mesh and adjust its values. But in this case you use DynamicMaterialInstance which is little bit expensive than simple MI )))

avatar image Teapot Creation Dec 06 '18 at 09:51 AM

Yeah after reflexion it looks similar. I've understood in your proposition that you said to make specific materials to manually apply to each segment. In my setup the whole thing is set on construction (so not so much expensive), adjusted if you move or add/delete some points.
I probably just misunderstood your proposition, thanks a lot though ;)

avatar image redbox Dec 06 '18 at 09:32 AM

I think if you need this for one particular asset in your game, it is better to make this curved model in 3dmax or so, and set it's 2nd or 3rd UV channel for desired gradient.

avatar image Teapot Creation Dec 06 '18 at 09:52 AM

That's not the aim since the spline in my case has to bu adjusted along other actors placed in the editor (and I really don't want to set the entire level in 3ds...).

avatar image redbox Dec 06 '18 at 07:31 PM

Well, I imagine project which requires this for many objects, so I've tried to implement this by myself in my experimental project.

Solution is quite simple, so I was wrong with my first opinion.

This is what I get:

alt text

Of course it depends on mesh UVs and gradient orientation in material.

My material is very similar to yours:

alt text

And here is blueprint for spline mesh actor:

alt text

material.png (71.0 kB)
res.png (517.8 kB)
bp.png (583.2 kB)
(comments are locked)
10|2000 characters needed characters left

I think, in case you want really smooth gradient from 1st to last spline mesh, the only way to do this - is use manually prepared set of material instances, and assign them one by one to spline meshes.

more ▼

answered Dec 05 '18 at 01:06 PM

avatar image

redbox
4k 79 15 99

avatar image Teapot Creation Dec 05 '18 at 02:08 PM

Well I don't mean to prepare a fixed number of assets. I want to move a gradient mask along a spline - whatever the length or the path of the spline. I want to simulate a liquid flowing into a tube.

avatar image Teapot Creation Dec 05 '18 at 02:20 PM

Actually the problem is that whatever the material I use, it is applied once for each spline mesh. I want to apply a map or adjust UVs to match the entire spline (ideally following spline UVs).

(comments are locked)
10|2000 characters needed characters left
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