Which method should vertex offset be added in PBRCustomMaterial

I have placed this function in “Vertex_Definitions”:

            const vertex_offsetfunction = `  
            vec3 vertFlagAni(vec3 position,vec2 uv) 
		{
			position.y = position.y + sin((uv.x - iTime * _Speed) * _Frequence) * (uv.x * _Amplitude) ;

			return position;
		}
        `;

and I have placed this function in “Vertex_Before_PositionUpdated”,But it didn’t work

            const  vertex_positionUpdated= `
            vec3 position = vertFlagAni(position,uv);
        `;

A playground example may explains better.
You can goto Babylon.js/pbr.vertex.fx at master · BabylonJS/Babylon.js · GitHub to see where your code will be added, for you information, try to use positionUpdated = vertFlagAni(position,uv); instead the string Vertex_Before_PositionUpdated

2 Likes

cc @Evgeni_Popov

We would definitely need a PG, but I think the suggestion from @tanpopo should do it: positionUpdated = vertFlagAni(position,uv).