JeremyAnsel / JeremyAnsel.Media.WavefrontObj

A .Net library to handle Wavefront Obj .obj and .mtl files.
https://jeremyansel.github.io/JeremyAnsel.Media.WavefrontObj/
MIT License
10 stars 7 forks source link

Whitespace inside .mtl #7

Closed rudcode closed 12 months ago

rudcode commented 12 months ago

Hi, I have this .mtl file that have something like this

map_Bump Amaranth Seed_N.png
map_Kd Amaranth Seed_D.png

and I got this error

A filename must have an extension.

I think the error came from this line but I have no idea how to fix it properly, thank you.

JeremyAnsel commented 12 months ago

Hello, To define a new material you have to use the newmtl statement.

newmtl Amaranth
map_Bump Seed_N.png
map_Kd Seed_D.png
rudcode commented 12 months ago

Sorry, I think my explanation is not complete.

I have this file

"D:\3d\obj\Amaranth Seed.mtl"
"D:\3d\obj\Amaranth Seed.obj"
"D:\3d\obj\Amaranth Seed_D.png"
"D:\3d\obj\Amaranth Seed_N.png"

this is the content of "Amaranth Seed.mtl"

newmtl Amaranth_Seed
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 1
map_Bump Amaranth Seed_N.png
map_Kd Amaranth Seed_D.png

The problem is if you have whitespace in texture filename.

JeremyAnsel commented 12 months ago

Hello, Thanks for the explain. I understand now. Your PR seems good. I've merged it.