How do I Apply Decal Texture to an Object

I am trying to load a texture onto an object as a decal (one side only).  For instance, loading a face onto a head.  How do I set the location of the decal texture and how do I apply it to the object?

Here is the code that I've tried so far which doesn't seem to work.

  // just for a test - load a texture
            Node clone = ...
   loc = BaseTable.class.getClassLoader().getResource("texture/facialFeatures.png");
            Texture texture = TextureManager.loadTexture(loc, Texture.MinificationFilter.BilinearNoMipMaps, Texture.MagnificationFilter.Bilinear);
            TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();


The ApplyMode just defines how the color of the texture will be handled.

I think you want to look into texture splatting or projected textures.

I tried splatting but that doesn't seem to be working.  Am I doing something wrong?  Is there a difference between splatting and projection?

Here is the code below.

       loc = BaseTable.class.getClassLoader().getResource("texture/facialFeatures.png");
                Texture t0 = TextureManager.loadTexture(loc,
                TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
                 ts.setTexture(t0, 0);
                 PassNode splattingPassNode = new PassNode("SplatPassNode");

                 PassNodeState passNodeState = new PassNodeState();
                // performance

Can you explain more on what kind of object you want to apply the texture ?

Is it a simple Box, a model or terrain.

If its a model i guess the best way would be to set the correct texture coordiantes in a 3d modeller.

So I am trying to create a Nintendo Mii loader.  Once I get most of the loading code finished, I plan on open sourcing it via source forge (since that's where I have all my open source projects).

Basically the face (freckles, mouth, nose, etc) are textures.  So in order to provide the diversity that Nintendo does, I need to be able to add the texture based on the mii file. 

Note, I'm using as a reference and currently am only loading the XML format provided by this site.  After I get things working with the XML, then I'll add the binary mii files.

So basically, I want to apply a texture to a loaded object (.obj).  Currently I am trying to load a texture onto a head (sort of spherical).

Can anyone help me with this?


In the xml file are x and y coordinates for the eyes for example, i guess you have to translate these somehow into texture corrdiantes for the head?

Your are correct.  There is also a rotation option on some of the components.

I've created a lookup table for the components and colors (color 4 might correspond to yellow for instance).  So what I don't know how to do is to load up textures from a file and add them as a decal to a model.

I should be open sourcing the project soon (this is in relation to a scale program I'm working on that records your weight from the wii balance board, keeps track of it, and graphs it out).  The 3D avatar code will be included so I'll post back once I have a sourceforge project created.

In the xml file are x and y coordinates for the eyes for example, i guess you have to translate these somehow into texture corrdiantes for the head?


i don't really know much about modelling/texturing  tho, hopefully someone else can help you. :)

Note, the project is now open source'd (GPLv3) on sourceforge