2016-04-05 22 views
2

、曲線がないわけではないのレンダリング:SCNText私はこのSceneKitコードを実行すると、フォントのような

let txt = SCNText(string: "Hello", extrusionDepth: 0.2) 
let textNode = SCNNode(geometry: txt) 
scene.rootNode.addChildNode(textNode) 

を、私は非常に角度テキストを取得:

Poorly rendered text

関係なく、フォントのこの操作を行うようだとシミュレータと同じようにデバイス上で動作します。ここで

は、コンテキスト内のコードです:

// create a new scene 
    let scene = SCNScene() 

    // create and add a camera to the scene 
    let cameraNode = SCNNode() 
    cameraNode.camera = SCNCamera() 
    scene.rootNode.addChildNode(cameraNode) 

    // place the camera 
    cameraNode.position = SCNVector3(x: 10, y: 0, z: 75) 

    // create and add a light to the scene 
    let lightNode = SCNNode() 
    lightNode.light = SCNLight() 
    lightNode.light!.type = SCNLightTypeOmni 
    lightNode.position = SCNVector3(x: 0, y: 10, z: 10) 
    scene.rootNode.addChildNode(lightNode) 

    // create and add an ambient light to the scene 
    let ambientLightNode = SCNNode() 
    ambientLightNode.light = SCNLight() 
    ambientLightNode.light!.type = SCNLightTypeAmbient 
    ambientLightNode.light!.color = UIColor.darkGrayColor() 
    scene.rootNode.addChildNode(ambientLightNode) 

    let txt = SCNText(string: "Hello", extrusionDepth: 0.2) 

    let textNode = SCNNode(geometry: txt) 
    scene.rootNode.addChildNode(textNode) 



    // retrieve the SCNView 
    let scnView = self.view as! SCNView 

    // set the scene to the view 
    scnView.scene = scene 

答えて

2

SCNTextは、あなたがそれを描いた場合のコアグラフィックスが行うのと同じように、あなたのテキストのための2Dベジェパスを細分化します。 flatnessプロパティを使用してスムーズにすることはできますが、「サブピクセルの滑らかさ」は得られません。

この問題を解決するには、より大きなフォントサイズを使用することができます。その結果、離散化が発生すると、ベジェ曲線のパスが大きくなり、より多くの頂点が生成されます。

関連する問題