哪种类型的几何定义文件格式最好与射线跟踪一起使用,以包括材料的类型

StackOverflow https://stackoverflow.com/questions/4364537

  •  09-10-2019
  •  | 
  •  

我想用 .obj 格式,但我注意到它没有代表材料类型的代表,即不透明,透明,反射。是否也有一个包括该信息的通用文件格式,或者我应该接受已知的 .obj 格式并更改它,以便它包括该信息?

有帮助吗?

解决方案

您可能需要检查MTL文件。尚未(尚未)自己使用过;)

http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html

http://people.sc.fsu.edu/~jburkardt/data/obj/obj.html

干杯

其他提示

.OBJ可以引用.mtl文件,该文件可以容纳不透明,透明,反射,颜色,折射率等。

通过将以下行放在顶部来引用该文件:

mtllib *fileName*.mtl

然后,在.OBJ文件的“面部”部分中,您可以添加以下内容:

usemtl *materialName*

在MTL文件中最终您需要一些类似的部分:

# declaration of new material
newmtl *materialName*
# shininess
Ns 0.000000
# ambient colour
Ka 0.200000 0.200000 0.200000
# diffuse colour
Kd 0.800000 0.800000 0.800000
# specular colour
Ks 1.000000 1.000000 1.000000
# refractive index
Ni 1.000000
# transparency
d 1.000000
# illumination model 
illum 2
# texture
map_Kd texName.png
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top