Light and Shadows example

Thank you for updating this! I’ve had a lot of fun playing around with this!

I was trying to create a billboard sprite similar to your billboard particleFX but am having some difficulty.

In the game object it is working correctly:

However, when I try adding it to the example scene it stretches in some unexpected ways.

Any ideas on how I could set this up correctly?

This is the code I tried to modify:

// positions are in world space
attribute highp vec4 position;
attribute mediump vec2 texcoord0;

uniform highp mat4 view_proj;
uniform highp mat4 mtx_view;
uniform highp vec4 normal;
uniform highp mat4 mtx_light;
uniform mediump vec4 param;

varying mediump vec2 var_texcoord0;
varying highp vec4 var_position;
varying highp vec4 var_view_position;
varying highp vec3 var_normal;
varying highp vec4 var_texcoord0_shadow;

//Billboard effect
attribute highp vec3 local_position;
uniform highp mat4 proj;

void main()
{

    gl_Position = (view_proj * vec4(position.xyz - local_position.xyz, 1.0)) + (proj * vec4(local_position.xy, 0.0, 0.0)); // Copied from billboard_particle/particlefx.vp
    var_texcoord0 = texcoord0;

    if(param.y < 1.) {
        var_texcoord0_shadow = mtx_light * position;
    }

    var_position = vec4(position.xyz, 1.0);
    var_view_position = mtx_view * position;
    var_normal = normalize(normal.xyz);

}

Thank you!