【问题标题】:Texture Mapping in 3D Object (.pod) not happening correctly using isgl3D使用 isgl3D 未正确进行 3D 对象 (.pod) 中的纹理映射
【发布时间】:2023-03-13 20:58:02
【问题描述】:

我使用了 3D iphone (.pod) 模型,它在 PVRShammon 中正确显示。

但是当我将该 3D 模型导入 isgl3D 时,它无法正确显示带纹理的图像,图像仅用一些线条和三角形覆盖了对象的某些区域。


_cameraController = [[Isgl3dDemoCameraController alloc] initWithCamera:self.camera andView:self];
_cameraController.orbit = 10;
_cameraController.theta = 20;
_cameraController.phi = 0;
_cameraController.doubleTapEnabled = NO;


Isgl3dPODImporter * podImporter = [Isgl3dPODImporter podImporterWithFile:@"iPhone5Spod.pod"];
[podImporter printPODInfo];
[podImporter buildSceneObjects];


Isgl3dTextureMaterial *material2 = [[[Isgl3dTextureMaterial alloc] 
                                         initWithTextureFile:@"DiffuseBody2.jpg"  
                                         shininess:0.0  
                                         precision:Isgl3dTexturePrecisionHigh  
                                         repeatX:YES  
                                         repeatY:YES] autorelease];


mesh2 = [podImporter meshAtIndex:4];
node2 = [self.scene createNodeWithMesh: mesh2 andMaterial:material2];
mesh2.normalizationEnabled = YES;
node2.position = iv3(0, 0, 0);
node2.rotationY = 180;
[podImporter addMeshesToScene:self.scene];


Isgl3dLight * light  = [Isgl3dLight lightWithHexColor:@"FFFFFF" diffuseColor:@"FFFFFF" specularColor:@"FFFFFF" attenuation:0.000];
light.lightType = DirectionalLight;
[light setDirection:-1 y:-1 z:0];


[self setSceneAmbient:[Isgl3dColorUtil rgbString:[podImporter ambientColor]]];
[self schedule:@selector(tick:)];

欲了解更多信息,请查看图片。 Output image in isgl3D view

【问题讨论】:

  • 您尝试过 PVR 图像而不是 JPEG 吗?
  • 您在哪里为纹理进行 uv 映射? isgl3d.com/tutorials/4/tutorial_3_texture_mapping
  • 您确定对象在没有纹理映射的情况下正确显示(所以当使用 isGL“非纹理”材质渲染时)?从屏幕截图来看,问题看起来与纹理无关,更像是 isGL3D 在从 .pod 文件加载顶点索引时会出现错误。您是否能够使用 isGL3D 成功加载和显示其他 .pod 文件?
  • 你初始化网格和节点对象了吗?此外,是否有理由只在索引 4 处启动网格?我会尝试:[podImporter buildSceneObjects];网格 = [podImporter meshAtIndex:0];节点= [节点创建节点WithMesh:网格和材料:纹理材料2]; node.position = posVar; node.rotationY = 180; node.doubleSided = YES;
  • 查看纹理,我认为顶点格式在组件数量方面设置不正确。 uv 都混在一起了,只有一些多边形在渲染的事实通常意味着其他的法线被翻转(因此背面被剔除)。如果 uv 和法线的顺序和浮点数不正确,或者着色器未正确使用所有字段,这仍然可以渲染某些内容。

标签: ios objective-c 3d texture-mapping isgl3d


【解决方案1】:

这只是我的两分钱。您的纹理是否符合 isgl3D 要求?

来自 isgl3D 教程 3 - 纹理映射 http://isgl3d.com/tutorials/4/tutorial_3_texture_mapping

对于标准图像文件,图像大小必须是两倍 兼容:例如 64x128、256x32 等。对于 pvr 纹理,图像文件 也必须是正方形:例如 64x64、256x256 等。

希望对您有所帮助。

【讨论】:

  • "您的纹理是否符合 isgl3D 要求?" -- 这类问题应该在评论中
  • 对不起,把它放在答案中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-01-08
  • 1970-01-01
  • 1970-01-01
  • 2013-01-22
  • 1970-01-01
  • 1970-01-01
  • 2012-09-07
相关资源
最近更新 更多