Once again: per poly texture/material

Hi Xith folks!

I having the following problem and would very much appreciate your answer…

It is pretty standard while creating models with different 3D-tools to use submesh materials/coloring/texturing.
While I trying to load 3ds model which has different submesh material applied it shows up in Xith just as one solid color/material model. Multy-material (per polygon / per mesh) is kind of ignored.

I have read the topic “per poly texture” discussed here before, and as far as I understood this feature is not supported by Xith. And the reason given, was - performance issues…

Of cause any model which has one mesh “divided” into submeshes with individual materials can be created as just the group of few objects - separate meshes each with its material… but sometimes, for certain particular complex geometries it is not neccessary convinient to do so… I mean… for example I would have difficulties to convince the person who draws models for me to stick to that rule… His point would be - well, in many cases it is considerably less hassle to create the model using submesh materials rather than creating separate objects…

I wonder, on which “level” the “per submesh texturing/materials” is not supported? I mean is it not implemented specifically in Xith? Or probably in JOGL/LWJGL? Because OpenGL itself does support this feature…

What about performance issues… well - it depends… I think everybody can just make their choice which way to go…

Are there any other reasons why this feature is dropped?

How difficult would be to implement “per submesh” materials/textures in Xith? Are there any plans to add this in future?

Will apreciate the answer very much!
Sincerely,
Bohdan.

Per sub-mesh material is not implemented in Xith (LWJGL, JOGL or OpnGL have nothing to do with this).
It is not very hard to implement but the problem is that you need someone with the time and the skills to do it, which I think we are lacking.

The feature isn’t implemented because its not required. If the model being loaded has lots of materials - the loader responsible should be creating appropriate meshes for each material and adding them to the scene.

This leaves control of mesh seperation in the hands the developer - the engine merely helps out by state sorting each element to aid performance.

Kev

Thank you very much Niwak and Kev for reply!!!

A bit disagree with you Kev though, that this is just not required…
For example, what if I have some geometry wich I want to change dynamically through GeometryUpdater - some kind of surface or similar (water simulation etc.), but in some reason I specifically want this mesh to have different materials applied to different areas. But I want to modify the goemetry as whole… not thinking that I have many pieces and how to sync them in movements… You know what I mean… Of cause I can texture it the way it bring the desirable effect (to certain level) but still this is not always flexible enough…

I mean that it would be handy not just for loading the models… but in general as well…

Thanks!
Bohdan.

You know thats a really good point I hadn’t thought about before, you’re right.

However, I still think for your particular problem (artist wanting to use them) you can still just change the model loader to cope.

Kev

PS. In all honestly I expect the reason Xith3D didn’t have per poly materials implemented was because Java3D didn’t have them and no one complained there.

:slight_smile: Actually I already managed to convince (paltry but still…) my artist to redraw couple of models for me differently, so this will not obstacle me really from further development hopefully.

Your suggestion about modifying the loader to split the mesh to appropriate meshes with individual material is good idea and probably the most reasonable way to do… I see what I can do… But for now I will probably stick to different way done models (no sub-meshes etc).

But general support for the per submesh material - it could be probably valuable addition to the Xith… ummm… why not :)), Xith will have something extra on top in comparison with Java3D - yet better :))

Alright, I’m probably not at the stage when I can contribute something solid (just have not enough knowledge and understanding how the things in Xith and 3D in general works etc), but I will be thinking about this, and when I have extra-time, I will maybe try to make this feature available in Xith… It would be interesting and good learning process for me as well… moreover I believe it could be of good use to people…

P.S. Another point to it is - when you have certain capabilities you can get use off Xith - you planning your development a little bit in mind with those features available… Who nows? Maybe appearance of per mesh material feature will triger many ideas on how something could be done using it… you know… and suddenly here is the requirement for it :))))

Thanks Kev!

You’re welcome to do it :slight_smile:
And if there are also other people who need this, they’ll probably also help you coding it.

  • If you have questions about xith you’re welcome to ask them :slight_smile:

Arne

:slight_smile: Thanks Arne! Yes, I am sure I will get hands on it at some stage when I have time.

Bohdan.

Some had…:http://192.18.37.44/forums/index.php?topic=6043.0

Na, I meant no-one compained at Java3D - that post is for Xith again isn’t it?

Kev

The comments in that thread are definitally useful, thanks EgonOlsen.

The way I read this problem is that you can accomplish this with Xith3D you just have to do the work yourself. There’s nothing in Xith3D that will stop you or require renderer modifications are there?

To solve your synching problem where your terrain geom is split into multiple Shape3D’s, could you simply have them all in a TransformGroup? To make your life easier when updating your geometry, you could even add a layer which translates your coordinates into the relevent low-level Shape3D.

If you solve this problem in a nice API friendly way, it would be an excellent addittion to Xith3D.

Personally I plan to both split my geometry into smaller chunks and have several tiles in the one texture. The latter option is pretty common, warcraft 3 for example limits you to a dozen or so different tiles for the terrain.

Will.

With terrain I had a similiar issue. I solved it by the dirty way of layering different shape3d’s above each other and using an alpha-TextureUnitState that specified, where the Texture I plotted of the Shape should be displayed. This way I also got nice looking fading effects. But it is also a bit buggy, e.g. if you look from a far ditance at it, the underlying textures start to shine trough and in the course of that flicker.

Arne