Want to add Image as texture in scenekit ios

Harshil.Chokshi

I have created an object and now I am trying to add an image as a texture to the object. But for some reason the texture doesnt show up and the object appears white. I downloaded a png file and added it to Xcode and created a SCNMaterial object that uses the image.

SCNMaterial *silverMaterial = [SCNMaterial material];
silverMaterial.diffuse.contents = [UIImage imageNamed:@"silver-background"];

SCNBox *horizontalBarOne = [SCNBox boxWithWidth:11 height:0.5 length:0.5 chamferRadius:0];
SCNNode *horizontalBarOneNode = [SCNNode nodeWithGeometry:horizontalBarOne];
horizontalBarOneNode.position = SCNVector3Make(0, 2.0, 0.5);
horizontalBarOne.materials = @[silverMaterial];
[scene.rootNode addChildNode:horizontalBarOneNode];

What am I doing wrong?

beyowulf

Move "silver-background" to Assets.xcassets.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to add texture (image) to SceneKit model so that it covers the model (mesh) uniformly?

iOS+SceneKit: How to apply toon shader on texture?

Scenekit: recolor diffuse texture with shader

SceneKit - Map cube texture to box

Repeating a texture over a plane in SceneKit

Metal / Scenekit - Repeating texture on sampler

SceneKit texture mapping issue on material

SKScene texture to SceneKit problem transparency

How to add SKVideoNode to ARKit-SceneKit in iOS 11?

I want to add a image on python but cant

How to add an image as texture on a MeshElement3D?

Swift SceneKit lighting and effecting emission texture

SceneKit issues applying texture to custom geometry

Add image to Titanium iOS module

Add Label with Image in DialogViewController in IOS

Add image for tabbaritem but it not show in ios

Convert an image to a SceneKit Node

iOS Custom Geometry in SceneKit

How to add a view to SceneKit?

I want to add in database table just name of image, NOT a whole path of image and I want to do with Factory and Seeds

ffmpeg, i want to add text on video and at the same time also want to add logo image on the video

iOS - How to add sceneKit node objects on top of the front facing camera. Not ArKit

I want to continue to process image and store it when iOS App in background

I want to show activity indicator before image loading in ios

I want to add a transparent overlay to my background image in android

I want to add header with access_token for flutter upload image

want to add some text over a newly captured image in android

I want add male/female with help of this div and image into data base

I want to add image when I share my website link