Can't see underlying material color

Hi, I’m trying to apply this texture on a sphere.

Checked stripes are full alpha, the others are white. The idea is to have the underlying material color show through the transparent stripes. Here’s the code:

public void simpleInitApp()
    assetManager.registerLocator("data", FileLocator.class);

    Material material;
    Geometry geometry;
    DirectionalLight light;

    material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    material.setTexture("DiffuseMap", assetManager.loadTexture("textures/Stripes.png"));
    material.setBoolean("UseAlpha", true);
    material.setBoolean("UseMaterialColors", true);
    material.setColor("Ambient", ColorRGBA.Orange);
    material.setColor("Diffuse", ColorRGBA.Orange);

    geometry = new Geometry("geometry", new Sphere(64, 64, 1.5f));
    geometry.rotate(FastMath.HALF_PI, .0f, .0f);

    light = new DirectionalLight();
    light.setDirection(new Vector3f(-.5f, -.5f, -1.0f));


But this is what I get.

Where’s the issue?
Also, is material.setColor(“Ambient”, ColorRGBA.Orange); useful in this case? I understand that lights in Phong’s model are made up of three components, but commenting out this line leaves the result unchanged. Why?

Material color will add to the diffuse map (the texture). So the white stripes become orange.

The transparent stripe won’t appear because it doesn’t apply any color to the surface, so the light doesn’t react and it stays black. The orange is surely added to it, but the color still has zero opacity.

Alpha channel on a texture allow you to hide the surface itself (meaning the mesh), not to see throught layers of texture.

If you want to blend many textures on the same material, I think you will need alpha maps, like for the terrain splatting texture

Well, we’d also probably need to know what you expect. @methusalah has done a guess… but really we don’t know what you meant to happen… and what happened is what we’d all expect to have happened.

Basically this, orange and white stripes alternating.

However, I was trying to apply this principle from the documentation, but I guess I’ve misinterpreted it in some way.

White stripes become orange because of this line (I guess ^^). Your diffuse map is blended with this color.

And for the a “bleeding” of the ambient color into the transparent areas of the diffuse map, I didn’t know it was possible but yes, I understand the doc like you are. I let someone else give more details about that point.

This hasn’t functioned in years, actually. That documentation is way out of date.

In fact, what version of JME are you using because that parameter doesn’t even exist in the lighting material anymore.

It’s JME 3.0, as in the picture. Is there an up to date documentation on the matter?

Yup, sounds convincing, but it keeps happening with ambient color and light. I guess your call on using alpha maps is the way to go.

Sorry about that… the wiki docs are usually the most out of date as it’s based on when someone volunteers to fix them. I think UseAlpha was disabled even before the first 3.0 alpha.

Sometimes the best source for information is the source, unfortunately. Javadoc next, wiki last. Also unfortunately, no generated docs for materials.

Oh I see. Well, no big deal, being forced to delve in the source only brings advantages in the long term. I know nothing on GLSL et similia though, will this be a problem?

Nah, reading it is probably not hard.

You should consider upgrading to 3.1, though… and then you could have just looked at the j3md file to see that the parameter is no longer there. 99.9% sure that the latest j3md finally removed the unused parameters. (We had no way to mark them deprecated so they just stayed unused in 3.0.)

Yep, it’s definitely in my plans after finishing my current project.

Speaking of which, this may be a stupid (and a tad OT) question, but still. I’ve managed to export a .j3o file by means of BinaryExporter (currently I’m not using the SDK), starting from an Ogre XML generated on Blender. Is there a way to the same for j3m’s?

Yeah, open it in the scene explorer… select the geometry, generate materials in the property panel… save it again. Open the .j3m from the assets folder.

Sorry, I meant without SDK.

“Hi, can I edit an image without an image editor?” Technically, yes but…

Why not just run the SDK to do this task like you would any other tool that did a specific task?

Lol ok, got the point :stuck_out_tongue:

I tried your code with the texture you provided and works fine for me.
Note that I am using JME 3.1.

Maybe you need this line in 3.0:

Then you are looking for a different effect than he is. He wants alternating strip colors… not transparency.