Outerra forum

Anteworld - Outerra Game => Tech demo, support, updates => Topic started by: zzz on January 27, 2015, 07:36:50 pm

Title: Applying two textures to the same geometry?
Post by: zzz on January 27, 2015, 07:36:50 pm
Is there a way to add two different materials to the same geometry? I tried importing a model with composite materials but Outerra only imported the first one. I tried adding a duplicate entry to the MTL file but with different texture settings but again it only took notice of the first one.

Having this work would also solve anyone's opacity maps problems.
Title: Re: Applying two textures to the same geometry?
Post by: KW71 on January 27, 2015, 10:48:48 pm
Yes, it is possible, confirmed in Blender and Max. If you are working in max, use multimaterial, not composite. Asign a different setID to to the faces.

EDIT:

Guess I misunderstood. If you mean blending textures (adding, multiplying... etc.), I guess not.
Title: Re: Applying two textures to the same geometry?
Post by: PytonPago on January 28, 2015, 02:31:17 am
There is another problem, if ya want to hide some stuff then, it takes just the first material of the mesh - simply said, OT is on single mesh - single material. (i think it actually separates them then during import, but ya cant then do much whyte the other material part of the mesh, as it assigns it to something unknown) But still, it isnt much of a problem to split things up a bit further and add a few more materials. (you just have to think such things trough during modelling)
Title: Re: Applying two textures to the same geometry?
Post by: zzz on January 28, 2015, 07:06:15 am
But still, it isnt much of a problem to split things up a bit further and add a few more materials. (you just have to think such things trough during modelling)

Unfortunately the texture that needs a different MTL setting to the base one is comprised of intermittent pixels and so the mesh can't be separated for it.
Title: Re: Applying two textures to the same geometry?
Post by: PytonPago on January 28, 2015, 08:48:58 am
But still, it isnt much of a problem to split things up a bit further and add a few more materials. (you just have to think such things trough during modelling)

Unfortunately the texture that needs a different MTL setting to the base one is comprised of intermittent pixels and so the mesh can't be separated for it.

 ... and making the thing several times whyte different materials, witch you swap out whan ya need it ? (hiding one mesh, showing other)
Title: Re: Applying two textures to the same geometry?
Post by: zzz on January 28, 2015, 09:11:49 am
... and making the thing several times with different materials, witch you swap out whan ya need it ? (hiding one mesh, showing other)

I'm not sure I follow. I should probably explain the purpose.

For some reason high transparency and no_light  = true results in the material not being affected by environmental lighting. This allows for non-emissive lightmaps to be made.

So here I have my base texture with normal settings
(http://i.imgur.com/5jqffNq.jpg)

My lightmap texture with modded settings during the day
(http://i.imgur.com/ECuyKUn.jpg)

And my lightmap texture with modded settings at night
(http://i.imgur.com/DpaNycI.jpg)

If my base texture uses modded settings the whole model is unaffected by light and looks bugged. What I'd like to do is have two entries in my MTL file that apply to the same geometry. One would be for the normal base texture and the other for the transparent lights. That way it looks normal during day and night. Because individual lights are mere pixels wide I can't split the mesh along the boundaries of the lightmap.
Title: Re: Applying two textures to the same geometry?
Post by: M7 on January 28, 2015, 01:32:34 pm
Looks like Uriah got the solution as he explained in the screenshot thread. If i get it right, you would need to duplicate the mesh and give one the no light=true  attribute in the .mtl and the other no light= false . But then i think you also need to add some distance between the two with the transparent one on top.
Title: Re: Applying two textures to the same geometry?
Post by: Uriah on January 28, 2015, 01:47:17 pm
That is correct, you will need a second mesh, just a few centimeters above the first with the illumination map applied to the second mesh. This mesh could be low poly too FYI. Or you could just make a mesh and cut out all the illuminated areas so the rest of the mesh isn't included, that might work best. If you choose to just duplicate the first mesh, here is what I suggest. Copy the original mesh, select all faces and extrude group a define distance. You'll have to experiment, but I've found this distance can be quite small, a cm or even less.

Use opacity map channel as illumination, (white=illum, black=non-illum), and also "alpha_masked" to true so only the illuminated areas are visible. In the day time the illumination mesh will be completely transparent, so you won't notice it is there. Angrypig said the real illumination map is nearly done, so hopefully this won't be necessary in the near future. Send me a PM if you need help, and if you send me your OTX I can edit the material to work correctly if you require.

Best regards,
Uriah
Title: Re: Applying two textures to the same geometry?
Post by: PytonPago on January 28, 2015, 02:40:17 pm
It is quite possible, that Cameny has something in mind to enable illumination textures aside normal ones, but it will be probably after the lighting update ... till then, i guess, having a second mesh for the illuminated parts is the only thing.
Title: Re: Applying two textures to the same geometry?
Post by: zzz on January 28, 2015, 02:58:57 pm
That is correct, you will need a second mesh, just a few centimeters above the first with the illumination map applied to the second mesh.

That'll work for regular objects but for any object that double-backs on itself or has opposing extrusions some will be shifted out of position. However I found that an exact duplicate of the mesh works just fine. Because my glow maps are nothing but the lights and a black background it's very easy to make the black transparent so it doesn't obscure the original mesh underneath. No z-fighting either.
Title: Re: Applying two textures to the same geometry?
Post by: Uriah on January 28, 2015, 03:08:25 pm
Interesting, I had problems where the meshes coincide, I will have to experiment more with that.

Regards,
Uriah