ios - SceneKit, flip direction of SCNMaterial -
extremely new scenekit, looking here:
i have scnsphere camera @ center of it
i create scnmaterial, doublesided, , assign sphere
since camera @ center, image looks flipped vertically, when having text inside totally messes things up.
so how can flip material, or image (although later frames video), other suggestion welcome.
this solution, btw, failing on me, normalimage applied material (but image flipped when looking inside sphere), assigning flippedimage results in no material whatsoever (white screen)
let normalimage = uiimage(named: "text2.png") let ciimage = ciimage(cgimage: normalimage!.cgimage!) let flippeciimage = ciimage.imagebyapplyingtransform(cgaffinetransformmakescale(-1, 1)) let flippedimage = uiimage(ciimage: flippeciimage, scale: 1.0, orientation: .left) scenematerial.diffuse.contents = flippedimage scenematerial.specular.contents = uicolor.whitecolor() scenematerial.doublesided = true scenematerial.shininess = 0.5
instead of scaling node (which may break lighting) can flip mapping using scnmaterialproperty's contentstransform property.
material.diffuse.contentstransform = scnmatrix4makescale(1,-1,1); material.diffuse.wrapt = scnwrapmoderepeat; //or translate contentstransform (0,1,0);
Comments
Post a Comment