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"

Camera position based opacity mask

I am trying to create a material function which would create a cylindrical opacity mask that would affect the objects between the player and camera. For the opacity mask, I have used the distance field function for a cylinder "vec2 d = abs(vec2(length(p.xz),p.y)) - h; return min(max(d.x,d.y),0.0) + length(max(d,0.0));" and centered it on the player location. However, my attempts at rotating it so the bottom of the cylinder stays attached to the player, while the top faces the camera, have been rather unsuccessful.

In my setup, I am trying to rotate the vector using RotateVector material function, prior to passing it to the distance field function.

Couple notes- camera boom has fixed length and is not always attached to the player(sometimes it points few meters ahead, based on the camera pitch), it also inherits player yaw. Camera pitch has 30 degree constraint.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 13 '15 at 06:52 PM in Rendering

avatar image

Nietoperz
1 1 2 3

avatar image Nietoperz Jul 15 '15 at 07:57 PM

Any ideas? Perhaps alternatives?

avatar image AndrewHurley Jul 16 '15 at 06:59 PM

Hey Nietoperz,

I am assuming if you are attempting to affect something between the player and the camera, this is a blendable/post-process material?

Would you mind elaborating on what you are attempting to achieve with this set up? In other words, how will this be applied as a function in your game/project?

Some screenshots of the issue you are having troubles with as well as the work you have thus far would really help isolate where to focus the next steps.

Thank you,

Andrew Hurley

avatar image Nietoperz Jul 21 '15 at 12:08 AM

The purpose of this setup is to create transparency circle if there is some visual obstruction between player and the camera (similar effect to the one in older isometric games). Again, camera has fixed boom length, hence the need to render transparency once the player is behind walls etc.

My current issue is that the cylindrical opacity mask I am attempting to create has a very wonky behavior. I'm not entirely sure how to solve the issue of the cylinder rotating towards the camera at all times. Rotating vector prior to passing it to distance field function gives only partial results.

I'm not sure whether screenshots will provide any better description, but I'll try and post some later.

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

1 answer: sort voted first

Hey Nietoperz,

Our community manager for the Engine Development Forums, Chance Ivey, made a simple material along with using Blueprints to drive the effect you're looking to do.

He's posted a short video, the blueprint layout, and the blueprint assets for you download as well. It may need some tweaking to get just the way you like, but it should be a good start.

The second link was made by our Senior Technical Artist, Alan Willard, who made it into a two part video series.

Wall Hiding

https://forums.unrealengine.com/showthread.php?30404-Diablo-Style-Wall-Hiding-in-Blueprints

Location Based Opacity

https://www.youtube.com/watch?v=XYPPd5oLoPM

Hopefully this is what you are looking for, and let me know if you have further questions or need additional help!

Cheers,

Andrew Hurley

more ▼

answered Jul 21 '15 at 08:15 PM

(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