Loading Entities from a file
Seems there's a bug when reading .reality
file. Use .rcproject
format instead. It works.
if let anchor = try? Entity.loadAnchor(named: "AR") {
arView.scene.addAnchor(anchor)
print(anchor)
}
How to exclude model's shadows on itself?
Well, I find a simple way to achieve this but loss some material details.
Change the light model of material to SCNLightingModelConstant
and exclude model from lighting calculation of your SCNLight
.
1. set light model
SCNLightingModelConstant
only consider ambient light to shading, so We need ambient lights to keep model visible.
model.geometry.materials.firstObject.lightingModelName = SCNLightingModelConstant;
2. set category bit mask of model and lights
model.categoryBitMask = 1;
directionalLight.categoryBitMask = ~1UL;
If results of bitwise AND of categoryBitMask
is zero, node will not take consideration into light illumination, so there no self-shadows anymore. Shadows model casted will still remain in scene.
Related Topics
Spritekit Skscene Not Resizing Correctly to Fit iPhone 12
Convert Gregorian Date to Hijri Date
Nsundomanager: Capturing Reference Types Possible
Data Structure for Fast Lookup with Multiple Criteria
Swift: How to Update UI When Listening to a Stream
Closure (With Default Value) as Function Parameter
Why Is a Firestore Listener Returning .Added Twice When a Single Document Is Added
Change The 2Nd and 3Rd Pickerview Acording to What Row from The 1St Picker Is Selected
Cloudkit: How to Access Main User's Attributes
Why Run Loop Is Needed When Using Dispatchqueue.Main.Async in MAC Command Line Tool in Swift
Swiftui Sheet Shows Sheet with Wrong Data
Can't Unwrap Optional.None When Setting Window Background Color
How to Bend a Rectangle in Sprite Kit
Animate Line Under One Button to Another
What Is The Intended Use of Optional Variable/Constant in Swift
Swift 3/iOS 10/Todayextension - Userdefaults Always Returns Nil