External file and materials

General questions about Indigo, the scene format, rendering etc...
Post Reply
6 posts • Page 1 of 1
User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

External file and materials

Post by CTZn » Mon Dec 18, 2006 8:07 pm

Here's an excerpt of a exemple scene shipped with Indigo:

Code: Select all

	<mesh>
		<name>ajax</name>
		<external>
			<path>..\Ajax_Jotero_com\Ajax_Jotero_com.3ds</path>
		</external>
	</mesh>

	<model>
		<normal_smoothing>true</normal_smoothing>
		<rotation>
			<matrix>
				1 0 0 0 1 0 0 0 1
			</matrix>
		</rotation>
		<pos>-1 -0.8 0</pos>
		<scale>0.03</scale>
		<mesh_name>ajax</mesh_name>
	</model>
How to apply a material to this mesh ? Say it has no embedded material, so overrides shouldn't apply... I don't see such thing in the whole scene...

There are tags to define materials, or mesh, or model, but what links them alltogether in a renderable object ?

I'm trying to make *.obj files to work, and I believe they don't show up because of material assignements, the geometry is parsed fine tho.

OnoSendai, you said (reported by Arneoog) obj files should work. In obj files the materials are in a separate mtl file, do you see an issue here ?

Then I put a mtl file aside the obj file. The mtl file shows:

Code: Select all

newmtl Default
Ns 32
d 1
illum 2
Kd 0.8 0.8 0.8
Ks 0 0 0
So I tried the following (renderer, camera and sky have intentionally been removed for shorter lecture; they are not an issue here):

Code: Select all

<material>
	<name>lambert1</name>
	<diffuse>
		<colour>0.5 0.5 0.5</colour>
	</diffuse>
</material>

	<mesh>
		<name>tstobj</name>
		
		<external>
			<path>objtst\objtst.obj</path>
		</external>
	</mesh>

	<model>
		<pos>0 0 0</pos>
		<scale>1.0</scale>
		<mesh_name>tstobj</mesh_name>>
	</model>

	<matoverride matname="Default">
		<diffuse>
			<colour>0.737255 0.74902 0.709804</colour>
		</diffuse>
	</matoverride>
And that doesn't work either.

I know people using 3ds files won't bother with that, but at least please check the syntax, maybe I misunderstood what <matoverride> is for... atm I've just tried anything I could so any support, even just moral will be of some help :)

Thx

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Mon Dec 18, 2006 10:50 pm

Just to be clear, my question is:

How to assign a material to an external mesh wich has no material in its definition/file structure ?

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Mon Dec 18, 2006 11:24 pm

Look in the console output (log.txt) and see the names of the materials in the .3ds file.
Then define your materials with those names, *after* the mesh is defined, but *before* the model is defined.

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Tue Dec 19, 2006 1:37 am

Okay, I'll have a look OnoSendai, thank you for the precision. However my question excluded the case of a prior material definition embedded in the material. I'm just badly trying to get obj files working...

That's a mat pb I'm sure of that because the geometry is correctly built within the tree... obj files are mainly different in the way they handle materials, and there seem to be no direct way to assign an Indigo mat to an external mesh without overrides... wich need a prior mat defined within the mesh... what obj files have in a separate file (mtl)... arrgh thus my question :lol:

If I fail totally I will try to export 3ds files from Blender, I just have no clue on how to set options for them. A screen cap may help here...

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Tue Dec 19, 2006 2:21 am

I haven't really looked hard at the obj code recently.
For now, try looking in the .obj file to see what the materials are called, and try defining materials with those names.
Otherwise try defining a material called 'indigo_default'

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Tue Dec 19, 2006 3:19 am

try looking in the .obj file to see what the materials are called, and try defining materials with those names.
Actually that's exactly what I did in my first post, code #3.

Code #2 exposes the material as in a mtl file, coz obj files themselves only hang geometries, nothing else. That's my point :)

Better than parsing a mtl file, an excellent solution would be to assign an Indigo material when defining an external mesh, that is not even trying to get any material from that file. Something like:

Code: Select all

   <mesh> 
      <name>ajax</name> 
      *<material_name>diffuse</material_name>* 
      <external> 
         <path>..\Ajax_Jotero_com\Ajax_Jotero_com.3ds</path> 
      </external> 
   </mesh>
diffuse being a material previously defined in the xml.

Ok OnoSendai, I'm not meaning to push you doing what I want (in the name of what?), nor am I trying to make you defending yourself against what you did, hey ! :) just wanted to expose my pov and frustration here, done now, nevermind :D

Thank you for your support and your hard work !!!

Post Reply
6 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 21 guests