Apply Transformation inside VertexFactory

I try to apply Transforms to the PositionVector inside a VertexFactory.
But somehow the Mesh isn’t scaled up, how it should. Sometimes it’s flickering or invisible.

float4 CalcWorldPosition(float4 Position, uint PrimitiveId)
#endif	// USE_INSTANCING
{
#if USE_INSTANCING
	return TransformLocalToTranslatedWorld(mul(Position, InstanceTransform).xyz, PrimitiveId);
#elif SCALE_MESH
	float3 NewPosition = Position.xyz * ScaleParameter;
	return TransformLocalToTranslatedWorld(NewPosition, PrimitiveId);
#elif USE_SPLINEDEFORM
/*
// Make transform for this point along spline
float4x3 SliceTransform = CalcSliceTransform(dot(Position.xyz, SplineMeshDir));

// Transform into mesh space
float4 LocalPos = float4(mul(Position, SliceTransform), Position.w);
// Transform from mesh to world space
return TransformLocalToTranslatedWorld(LocalPos.xyz);
*/
return INVARIANT(TransformLocalToTranslatedWorld(float3(mul(Position, CalcSliceTransform(dot(Position.xyz, SplineMeshDir))).xyz), PrimitiveId));
#else
	return TransformLocalToTranslatedWorld(Position.xyz, PrimitiveId);
#endif
}

what am i doing wrong?

not sure if it s really what you need. but you can add your own HLSL code and call it in the material editor :
there is a how to here :

thank you for this link.
seems i could use a customized VertexFactory. Currently i struggle to find the right function to modify…
i will update this question later

I found a solution. Problem now is that i don’t have shadows :frowning: but for now it’s ok

TransformLocalToTranslatedWorld(mul(Position, OffsetParameter).xyz, PrimitiveId);