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"

Force Masked Materials to fully block lighting

Hi everybody. I have a question about masked materials and their shadow casting behaviour. Is it possible to set up a material, that is rendered using a regular clipping mask (= masked material) that still casts shadows as if the material was fully opaque with no masking active.

This might be a bit silly as for years people wanted the exact opposite and now that we have fancy masked shadows I would like to do it the other way again:p

As a bit of a situation sketch: Say I am making a top down game and I have an environment that is mainly exterior and a little house that I can enter.

As I enter the house I can't see my player because I'm using a fixed camera height. So I use a masked material for the roof and some additional trickery to make the roof vanish in a clean and perhaps stylized fashion.

What will happen by default is the enterior will receive the lighting from the exterior directional light as the mask starts clipping away. And we don't want that in this case. This is really cool and awesome but in this case we would want the roof mesh to still block the light. Keeping the inside shielded from the exterior light.

So is there a way to make this work via the material setup or any possibility to add an always block light flag to the material properties? A way to create light blocking volumes? Or is this not doable with a mask material due to the rendering/lighting pipeline?

I have looked for a solution in UE4 but ao far no luck.

This is just one example that would have use of this but I'm sure that this would be of great use for other things as well. For example to be able to create unique gameplay mechanics, visual illusions and so forth.

All thoughts and ideas welcome. Thanks :)

Product Version: Not Selected
more ▼

asked Apr 29 '15 at 10:22 PM in Rendering

avatar image

8 2 3 5

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

1 answer: sort voted first

Hi Brechtos,

There isn't an option to do this with a masked material due to the rendering pipeline and deferred rendering, however you are able to do this with a hidden mesh that can act as the shadow caster.

You can simply setup up a basic mesh, it doesn't have to be as detailed as the roof or any other mesh you may need. Set the flag in the mesh details panel for "Actor Hidden In Game" to true. Under the lighting tab, set the flag to true for "Cast Hidden Shadow."

This will work with Dynamic/Stationary/Static Lighting depending on your needs.

With static lighting, you will not need to set the flag for "Cast Hidden Shadow" though.

I hope this helps.


more ▼

answered Apr 30 '15 at 02:28 PM

avatar image

Tim Hobson ♦♦ STAFF
48.8k 888 103 878

avatar image Brechtos Apr 30 '15 at 02:35 PM

Thx Tim! Was the next solution to try to set up on my list but was unaware about the cast hidden shadow thing. Silly me.

Problem solved :)

(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