Are there decals?

Hello. Is there a built in way to project textures in jME? Maybe some samples?

I need decals soon and I was wondering if I would have to implement this myself.


1 Like

Not sure I understand what you mean by “project textures”, maybe show an example?

Not sure if it still works though^^

Something like this could really do with being more of a built in feature of the engine.


I agree. Decals are somehow like particle systems - a basic effect in game engines.
Maybe we find some elegant solution (e.g. a clever shader that uses a depth buffer).
For now: create a small box and project a texture from top square to bottom square.

Thanks @destroflyer that helps.

And I agree with @DannyJo this would be a great addition.

Yes it does :smile:

Okay it works. However, I get this result:

Looks like the textures expand outwards? In the video showing this off it looks perfect.

Albeit, this is from 2012… Maybe some compatibility issues have risen since then?

Two things you could try:

  1. Flip your cube (maybe it’s projecting from down under? I mean from bottom to top?)
  2. Try a very steep angle (like -1 or +1 degree instead of 0 degree) - the perspective projection seems to work but the orthographic projection (parallel frustum, i.e. 0 degrees field of view) doesn’t work.

I have a question: How do you create this nice .gif file? Is this built into jME? :chimpanzee_smile:

I’ll try it out.

And I use Gyazo

Okay so I set the texture to repeat and got this:

looks like the projection isn’t clipped by its frustum. Any ideas?

You set it to repeat and it repeats. Nice thing! :chimpanzee_closedlaugh:

Maybe there is another flag like “scale” or something like that?
I mean, maybe this “repeat” might do exactly what it should do and you just need to use a different mechanism that might have a different name?

Nah. Before it was edge clamping on a plane. now its repeating. I need it to clip.

In the first .gif that you posted it was clipped. So you can have that if you do not set “repeat”.
Maybe I don’t understand your exact problem correctly.

Have you tried all other available options?
Have you tried to use .setScale() with values like 0.5f ?

Or this: Set the UV-coordinates on the projecting thing to things like 2.0f (U) and 2.0f (V) ?

Or this: Is there no documentation with an example?

Or this: Maybe it is not possible to achieve what you whant to achieve with this software.

Nono. Notice in the first one how the jMonkey face decal has a yellow border that expands out into infinity?

It should be stopped at the frustum drawn.

Ah okay, it’s green on my screen. Or maybe yellow for people with red-green-color-blindness.

Yes, I understand now. If you look at the video here: Projective Texture Mapping There it is okay. Did you try to do it like the guy in that video: ParallelProjection GeometryList - YouTube And it still did not work? Maybe your geometry is weird (use two flat boxes instead your concave double quad (or what that weird geometry is in your .gif files).

Might be that this plugin broke with recent changes. The code is from EARLY 2012. jME 3.0 is from LATE 2013. jME 3.1 is from LATE 2015. So maybe there was a breaking change in the core code or something like that.

Bahaha. I’m not color blind. And I figured it was changes with the engine.

Might be yellow when running jME. Might become green when .gif is encoded.
Take a look and say if you see green or yellow in the .gif you posted. :chimpanzee_smile: