Castle Model Viewer: How to add/select/use Texture from file?

Hi!
I’ve searched a program, which can open an *.obj files with accompanying textures.
All of applications i’ve found have no any mentions of “textures”…

Finally, a found the “Castle Model Viewer”, which definitely has some Textures settings!
But my *.obj file showing as just almost black model with no texture and lightning…
What i’m doing wrong? Can someone help me? Thanks!

Hello,

Indeed we support opening OBJ files with textures. Note that the xxx.obj file has to be accompanied by the xxx.mtl file to refer to texture names.

If the model you have doesn’t render properly, I’ll be happy to investigate. Please upload the model here (e.g. as a zip; include everything relevant to reproduce the problem – the .obj file, .mtl file, all texture files (possibly downscaled)).

P.S. Note that the OBJ format has rather poor feature set and is rather old :slight_smile: If you have any sources for the 3D model, e.g. it is made in Blender and you have source xxx.blend file, we recommend you use modern 3D formats like glTF, see

oh… I see…

I’ve got just this:

  • SomeFile.obj
  • SomeFile.png

And the model is just black. So I made a new text file:

  • SomeFile.mtl

with content:

newmtl Default
map_Kd SomeFile.png

and added lines into beginning of SomeFile.obj:

mtllib SomeFile.mtl
usemtl Default

So, the model is still black, but now, if I turns off the “Lighting Calculation” setting - it shows with texture!

Looks like “Lighting Calculation” should be disabled, if *.obj has no normals…
Perhaps, will be good, if it turns off automaticaly, when no normals…

Thanks a lot!

Indeed, the .mtl file is necessary in order to see the textures.

As for the need to toggle lighting: the normals are auto-calculated by our engine, if not provided (no vn ... lines in the OBJ file). So lack of normals shouldn’t cause the model to be black. (Unless the normals are provided, but somehow invalid, e.g. all zeroes?)

I did some testing, and the simple tree model with simple materials (only texture names), and no normals → renders OK in Castle Model Viewer.

newmtl oakstamm
map_Kd oakbark.jpg

newmtl oakblaetter
map_Kd oakleaf_fall.tga

Attaching:
tree_simple_obj.zip (177.0 KB)

So, there may be something else in your model causing the black look (when lit). If you can submit a testcase, I can investigate it :slight_smile: