LoginSignup
0
1

More than 3 years have passed since last update.

SceneKitで環境マップ

Posted at

SCNScene *scene = [SCNScene sceneNamed:@"art.scnassets/my_scene.scn"];

// 背景に表示用
scene.background.contents = @[@"art.scnassets/px.png", @"art.scnassets/nx.png", @"art.scnassets/py.png", @"art.scnassets/ny.png", @"art.scnassets/pz.png", @"art.scnassets/nz.png"];

// ライティング用
scene.lightingEnvironment.contents = @[@"art.scnassets/px.png", @"art.scnassets/nx.png", @"art.scnassets/py.png", @"art.scnassets/ny.png", @"art.scnassets/pz.png", @"art.scnassets/nz.png"];

// モデル
SCNNode *modelNode = [scene.rootNode childNodeWithName:@"MyModel" recursively:YES];
SCNMaterial *material =[[SCNMaterial alloc] init];
material.locksAmbientWithDiffuse = true;
material.diffuse.contents = [UIColor redColor];
material.roughness.contents = @0.02;
material.lightingModelName = SCNLightingModelPhysicallyBased;

modelNode.geometry.firstMaterial = material;

[scene.rootNode addChildNode:modelNode];

真っ先にほしい環境マップではあるのだけれど、そのままの情報がなかった。
.hdrを使えたりするのかもしれない。Swiftでも同じ。Swiftが何かは知らない。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1