External Publication
Visit Post

(February 2026) Monthly WIP Screenshot Thread

jMonkeyEngine Hub February 14, 2026
Source

I’ve been playing around with vertex shaders and made some changes to PBRLighting.vert to achieve this wobble effect.

I added the following to my personal version of PBRLighting.vert:

uniform float g_Time;
uniform vec3 m_Amplitude;
uniform vec3 m_Frequency;
.
.
.
void main(){

    vec4 modelSpacePos = vec4(inPosition, 1.0);
    vec3 modelSpaceNorm = inNormal;
    vec3 modelSpaceTan  = inTangent.xyz;

    float wobble = mod(length(modelSpacePos.xyz), 2.0) - 0.5;

    modelSpacePos.x += m_Amplitude.x * sin(m_Frequency.x * (modelSpacePos.x + g_Time)) * wobble;
    modelSpacePos.y += m_Amplitude.y * sin(m_Frequency.y * (modelSpacePos.y + g_Time)) * wobble;
    modelSpacePos.z += m_Amplitude.z * sin(m_Frequency.z * (modelSpacePos.z + g_Time)) * wobble;

    lPosition = modelSpacePos.xyz;
    .
    .
    .
}

And to PBRLighting.j3md:

MaterialDef PBR Lighting {

    MaterialParameters {
        Int BoundDrawBuffer

        // Amplitude and frequency
        Vector3 Amplitude : 0.0 0.0 0.0
        Vector3 Frequency : 0.0 0.0 0.0
        .
        .
        .
    Technique {
        .
        .
        .
        WorldParameters {
            Time
            .
            .
            .
        }
    }
}

On the Java side, all I need to do is set the amplitude and frequency values in the material (on the x, y and z axes):

    material.setVector3("Amplitude", new Vector3f(.25f, .25f, .25f));
    material.setVector3("Frequency", new Vector3f(1, 2, 3));

Discussion in the ATmosphere

Loading comments...