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 Emissive Value Based on Player Proximity?

I'm not really sure if something like this is even possible, but I thought I'd ask just to be sure:

To give some background, I have a Player Controller in a 2.5D side scroller I am making (2D Gameplay with 3D Assets). The game's visual style is strongly based on silhouettes and emission.

So, what I want to achieve: is that I have various surfaces that have emissive values in their materials (but they are hidden by default) and I'd like them to light up when the player is close enough. But I don't want the entire material and mesh to light up, only parts of the surface that are close to the player.

One example is that I have a log mesh and material that is driven along a spline. By default it is normal, but I can drive an alpha value that makes the crevices in the bark glow. But this affects the whole mesh, when really I'd like to be able to only make the surface that is close to the player glow, as opposed to the entire mesh.

Is this even possible to produce? Thanks.

Product Version: UE 4.19
Tags:
more ▼

asked Sep 03 '18 at 10:28 AM in Blueprint Scripting

avatar image

Raxs_Slayer
168 8 13 19

avatar image HarryHighDef Sep 03 '18 at 10:33 AM

Look into global material parameters.

You can store the players location in there then have your materials sample their own world position and the players position from the global value to do some funky things.

avatar image Raxs_Slayer Sep 03 '18 at 10:37 AM

That sounds like a plausible solution. Can you confirm that this would work? Really, all I need to do is be able to layer a disk shape over the surface when I'm close enough to it, then I can just use that as a mask. If that's possible then I'm sure I could apply it.

And would you have any links on how to get the materials world position? I can't say i have ever tried this before. So that would be a massive help, thanks!

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

1 answer: sort voted first

I'm not sure I fully understand your idea, but you can try to use simple sphere mask.

In case your camera is always on fixed distance from player, you can get camera position in material, add offset vector to it, and use it as position for sphere mask.

and use this as emissive mask for every material you want.

more ▼

answered Sep 03 '18 at 10:40 AM

avatar image

redbox
4.2k 80 17 103

avatar image redbox Sep 03 '18 at 10:42 AM

Also you can map some clamped spherical texture to camera position in world coordinates with world position offset.

For this try to start from WorldProjectedTexture material function.

avatar image Raxs_Slayer Sep 03 '18 at 10:50 AM

AHA! This is perfect! What a brilliant little bit of Ue4 functionality. And so simple. Thank you for that.

(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