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"

Object shadows with ARKit

I've been able to successfully compile and run the "ARSample" project from the Unreal Engine Github repository. I'm using the full production release of UE 4.17. I noticed that the 3D objects in the demo don't cast shadows onto the "real" environment image. Yet, I've seen other AR demos (in other engines and even in Unreal using Ádám Horváth's "AR Toolkit plugin") cast convincing shadows. My question is, how might I go about implementing shadows in the context of ARKit?

Product Version: UE 4.17
more ▼

asked Aug 10 '17 at 12:41 PM in Rendering

avatar image

825 27 15 57

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

1 answer: sort voted first

I found a solution! A directional light can be set to "Cast modulated shadows". One unique thing about modulated shadows is that they will show up even on surfaces that have unlit materials applied. And since unlit materials are how the ARKit camera feed is displayed in the scene, you can cast shadows onto that camera feed.

For full details on the basics of using ARKit - including a demonstration of how to get shadowing and global illumination effects - see this video tutorial I've posted: https://www.youtube.com/watch?v=Z6FAl6v0ax0

more ▼

answered Aug 11 '17 at 06:22 PM

avatar image

825 27 15 57

avatar image davidvjc Sep 12 '17 at 06:54 PM

Thanks for sharing!

avatar image iktomi Oct 16 '17 at 07:12 PM

Krxtopher, I tried this but I get no shadows on unlit materials (android or ios). (Yes mobilehdr was enabled as well as modulated shadows).

avatar image iktomi Oct 19 '17 at 12:58 AM

Nevermind. Modulated shadows work. The problem was my directional light wasn't stationary.

avatar image Naitguolf Oct 27 '17 at 10:38 AM

Hi! Did you were able to do the shadows using 4.18?

avatar image Likvidat Nov 13 '17 at 05:24 AM

I haven't been able to get it working in 4.18 at all - tried the method outlined in Krxtopher's video but the material no longer seems to be included in 4.18 (due to change in implementation).

Also tried the YCbCrToRGB material posted here, to no avail (I get a translucent white ground plane with no shadows cast on it at all): https://forums.unrealengine.com/development-discussion/ios-development/1358295-arkit-4-18-preview-1-official-ios-11-and-xcode-9-camera-feed-red

Anyone have any hints?

avatar image SebaSopp Nov 13 '17 at 09:46 AM

I use the method from this forum-thread. But I've not tested it in a mobile setting yet: https://forums.unrealengine.com/development-discussion/rendering/102794-shadow-catcher-possible-oo

avatar image Likvidat Nov 13 '17 at 09:06 PM

Thanks Seba - I'll take a look at it today and report back!

avatar image pushmatrix Feb 11 '18 at 11:28 PM

Any luck with any of it? I'd love to be able to get dynamic shadows working with unreal and ARKit.

avatar image Krxtopher Feb 12 '18 at 02:24 PM

I have gotten my original modulated shadows solution to work on 4.18 but it requires a slightly different approach to the camera pass-through material creation. I plan to post an updated video tutorial in the next couple weeks.

avatar image pushmatrix Feb 12 '18 at 04:11 PM

Really looking forward to it! :D

avatar image haowang1013 Feb 13 '18 at 09:23 AM

Try adding ARKitCameraMaterial_Mesh to a floor mesh and setup modulated shadows as Krxtopher mentioned above, then everything should work.

alt text

link text

avatar image pushmatrix Feb 13 '18 at 02:57 PM

Is that working in 4.18.3?

avatar image haowang1013 Feb 14 '18 at 02:19 AM

Yes, this is done in 4.18

avatar image Krxtopher Feb 13 '18 at 03:25 PM

I believe haowang is referring to a material called "ARKitCameraMaterial". In order to find that material, you just need to change the view settings of the content browser to enable "Show Plugin Content". Then you'll find that material under thet "AppleARKit Content" folder. I haven't tried this myself, but I did confirm that this material exists in 4.18.2.

avatar image haowang1013 Feb 14 '18 at 02:24 AM

The zip file I uploaded contains a modified version of that material, basically just use the screen coordinate as the UV. It needs further tweaking as on devices not running a 16:9 aspect ratio, not the entire camera texture is used, so the UV space needs to be clipped, similar to how the engine does it in the arkit overlay code - although I still think the implementation in 4.18.3 is buggy because it doesn’t handle all the devices and orientations correctly.

avatar image virtualHC Apr 20 '18 at 07:05 PM

I was wondering if you have found a solution to this. I've been trying to translate the UV clipping done in the overlay code but I'm still getting stretched images. This is with 4.19.

EDIT: I got it to work, at least on landscape on an iPad Pro. See my answer here https://answers.unrealengine.com/questions/769285/arkit-passthrough-camera-material-scaled-different.html?childToView=781595#answer-781595

avatar image CGough Mar 14 '18 at 07:19 PM

Hi all,

I've got Modulated Shadows set up for my AR scene and they work but they are very black, is there anything I can do about this?

avatar image haowang1013 Mar 29 '18 at 05:06 AM

If you're using the modulated shadow approach, the shadow color can be tweaked on the light itself.

(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