Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Swift version #3

Open
noais opened this issue Jun 30, 2017 · 6 comments
Open

Swift version #3

noais opened this issue Jun 30, 2017 · 6 comments

Comments

@noais
Copy link

noais commented Jun 30, 2017

Hi @markdaws ,

I have done every parts on swift, if you want you can create branches for all parts to push the code to them.

@timothyrchew
Copy link

@markdaws Thanks for putting this together. Would love to see a Swift version.

@OxyFlax
Copy link

OxyFlax commented Jul 5, 2017

Hi @markdaws
I did the swift versions of part1, part2, part3 and part4 branches.
Can you create the new branch part1_swift based on the "Initial commit" to allow me to make a pull request? Then based on the part1_swift make a part2_swift etc... so that people would be able to follow the different commits ;)

My repo is here if you want to see https://github.com/OxyFlax/arkit-by-example

@enzyme69
Copy link

Thanks for Swift example and also Mark for nice articles! Studying now~

@enzyme69
Copy link

enzyme69 commented Jul 20, 2017

@OxyFlax I tried recreating your setup (Swift) from scratch, actually more like copy pasting code by code trying to understand the setup. Since you make it so tidy, I get 70% of the setup. Even the setting is very neatly coded.

One thing: Somewhat I am not able to get the "estimate" to affect lighting.

Questions:

  1. Do we need some kind of existing lighting in the scene for estimate to work?
  2. If we are not using PBR, will this estimate works? Is it a matter of passing the value into light?
  3. I am pretty new with PBR, I think I manage to get it working, but not quite sure if the Spherical or the IBL has any effect on the AR Objects. Wonder if we can have object being lit with just PBR, just like in Blender, when using environment light. Currently I am just getting black.

It might, but then again back to first question: I do not seem to get any light to happen, without turning on Default Light.

With Swift version, I am not seeing any light in the scene, but somewhat your cube is reacting to estimate light.

@enzyme69
Copy link

Ok, too many almost whole day, but I think the reason I am getting black is that because this thing needs to be at the very bottom! 💯

Also, intensity and image path is crucial. No error give even if we provide wrong path.

// MARK: - ARSCNViewDelegate


func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
    guard let estimate = self.sceneView.session.currentFrame?.lightEstimate else {
        return
    }
    
    // A value of 1000 is considered neutral, lighting environment intensity normalizes
    // 1.0 to neutral so we need to scale the ambientIntensity value
    let intensity = estimate.ambientIntensity / 1000.0
    self.sceneView.scene.lightingEnvironment.intensity = intensity
}

@canbal
Copy link

canbal commented Aug 7, 2017

@markdaws I didn't realize someone else already put together a Swift version and I ended up doing it as well. Here's my version: https://github.com/canbal/arkit-by-example. If interested I'm happy to create a pull request for a swift branch.

Regardless, thanks for the tutorial, it's been very helpful!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants