Are there decals?

Okay … if something broke, then we would very much desire this to be repaired, I guess…
Without projective textures many things don’t work (e.g. decals or car headlights in the dark).

I think that something like that would be nice in the core engine.
Since it worked in the past and maybe works now (with minor errors perhaps), this would be a task that could be achieved with not too many efforts.

@Coredevs: What do you think? :chimpanzee_smile: (@nehon) (@pspeed) (@Momoko_Fan)

Here’s my opinion:
Decals are as important and basic as particle systems.
Projective textures are basic feature like render to texture.
TestProjectiveTextures would be a nice addition to the tests.

EDIT: Or if not core, then maybe repair the plugin code of that project by people who know enough jME graphics coding stuff to do that in a couple of minutes. I would need hours or days with my currently hibernating jME 3D knowledge… :chimpanzee_wink:

It’s chartreuse. In between yellow and green, close enough to both for their to be a legit difference of opinion on which it qualifies as… Unless you know the truth: it’s neither, it’s chartreuse!

Must admit, though, that chartreuse is a lot greener when viewed on a calibrated 95% gamut monitor set to D50 color temp than it does on a stock nexus 10 :wink:

Hehe … I have this IPS panel monitor and in the manual it states that this display can be used for art. Maybe I didn’t calibrate this device correctly, but I tend to see green even on the other two displays which have poor color support.

Chartreuse … hm … okay. Learned something new today. Thanks! :chimpanzee_closedlaugh:

Okay so the sample: TestProjectiveAnimatedTextureMapping.java works fine.

But the other two clamp/repeat on a plane based on the frustum…

Solved it!

Needed to clamp the texture coords in the frag shader. Which bring up an issue. Wouldn’t it be more efficient to use the projection frustum in a stencil test?

1 Like

Nice! Mind sharing that solution? :chimpanzee_smile:

For the stencil: I heard that there is currently no support for stencil operations in jME in this thread: [Solved]Has any function could set the ViewPort into the special region?

@Coredevs: is this still true?

Change ProjectiveTextureMapping.frag to:

varying vec4 projCoord;
varying float cosAngle;

uniform sampler2D m_ProjectiveMap;

#ifdef FALL_OFF
    uniform float m_FallOffDistance;
    uniform float m_FallOffPower;
#endif

const float SOFTNESS = 0.1;
const float SOFTNESS_INV = 1.0 / SOFTNESS;

void main() {
    vec2 finalCoord = projCoord.st / projCoord.q;
    if (projCoord.w > 0.0 && cosAngle > 0.0
        && projCoord.s > 0 && projCoord.t > 0 && finalCoord.s < 1 && finalCoord.t < 1) {
        vec4 projColor = texture2DProj(m_ProjectiveMap, projCoord);
        if (cosAngle < SOFTNESS) {
            projColor.a *= cosAngle * SOFTNESS_INV;
        }
        #ifdef FALL_OFF
            if (projCoord.w > m_FallOffDistance) {
                float maxDist = m_FallOffDistance + 1.0;
                projColor.a *= clamp(pow(maxDist - projCoord.w, m_FallOffPower), 0.0, 1.0);
            }        
        #endif
        gl_FragColor = projColor;
        return;
    }

    gl_FragColor = vec4(0.0);
}
2 Likes

Not anymore. We do support stencil operation.
Maybe @Momoko_Fan can tell you more about this.

Stencil is supported actually. A few weeks ago I played with it to make a portal-like thing:

4 Likes