0
$\begingroup$

I have an 3D model that I would like to export to SceneKit in iOS. Everything is working except simple shadows underneath the object.

I looked over this question and this simple tutorial here.

What I want the end result to look like:

enter image description here

What is actually happening:

enter image description here

My steps are the following:

  1. Add a Plane Mesh under my object
  2. In the Material Options: a. Select Shadows Only option b. Transparency Option for Plane

When I export the model to Collada format I still see the plane under the object and no shadow.

$\endgroup$
  • $\begingroup$ O Looked over tutorials about how to cast shadows in Blender not in SceneKit. Certainly you don't expect shadows to be exported with the 3D model. Material properties are not exported with the model.Please see blender.stackexchange.com/questions/57531/… $\endgroup$ – Duarte Farrajota Ramos Dec 5 '17 at 19:09
  • $\begingroup$ Possible duplicate of .fbx export why there are no materials or textures? $\endgroup$ – Duarte Farrajota Ramos Dec 5 '17 at 19:09
  • $\begingroup$ In Apple's Documentation it states: "If you create a virtual object that you intend to place on a real-world flat surface in AR, include a transparent plane with a soft shadow texture below the object in your 3D asset." developer.apple.com/documentation/arkit/arscnview/… $\endgroup$ – Ranknoodle Dec 5 '17 at 20:53
  • $\begingroup$ Which goes back to the original question... how in Blender does one "include a transparent plane with a soft shadow texture below the object in your 3D asset." I have included a plane, made it transparent and clicked the shadows only option. $\endgroup$ – Ranknoodle Dec 5 '17 at 20:55
  • 1
    $\begingroup$ As I said clicking the shadow option is a Blender only material property, not SceneKit, shadows are not exported with a model, nor are Blender specific are material properties. You would have to either bake said shadow, or manually paint a texture with one using a 3rd party painting application $\endgroup$ – Duarte Farrajota Ramos Dec 6 '17 at 2:25
2
$\begingroup$

"include a transparent plane with a soft shadow texture below the object in your 3D asset."

apple docs

First let me explain why you are not getting a shadow.

When you export a object you are never going to get any of the information that comes from blender's renders (cycles or blender internal). In this case the shadow.

What is a shadow? You did not model it (and information in the model is all that you can export.) A shadow is a not a "thing" like your couch, it is not even the plane under it. A shadow is something the render engine calculates whenever some geometry occludes a light source. (Essentially it is shading the render engine adds)

Think about it your couch looks very different in cycles then it does exported and displayed in scene kit, and a shadow is just something created from the render engine.
So unless you exported your all light(s) and the settings, and scene kit had a raytracer that rendered just like cycles, then you are not going to get a shadow.


Baking

This is where baking comes in. You take all that lovely data that cycles wraps your model in, and "bake" it to a texture that can be used elsewhere.

It does not matter if you are baking the full color (you would do that for your couch) or just the shadows, the process is the same.

  1. Start by UV unwrapping the object that is going to be baked (a simple lightmap pack is sufficient.)

  2. Create a new image in the "UV Image Editor", for VR keep it small 512x512 or 1024x1024.

  3. Now in the material nodes for that object (the shadow catcher plane) add a Image Texture node, and set it to the image your just created (make sure that node is the active node).

  4. In the Properties window, Render tab scroll down to the Bake section. To bake the shadows set the Bake Type to "Shadow". Now hit the big Bake button.

So to go make to the quote from the scene kit documentation: "include a transparent plane with a soft shadow texture."
This is what they mean, somehow make an image with the shadow on it and then texture a plane with that shadow image.

Now to get this to work, you are probably going to need to invert the image because you want to drive the transparency of the plane. (Full transparent where no shadow, opaque where the shadow is.)

$\endgroup$
  • $\begingroup$ Awesome thanks for your explanation!!! Will give this a go! $\endgroup$ – Ranknoodle Dec 6 '17 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.