[SOLVED] UI Custom Shader

I’m trying to create a custom shader for an Image Element.
Here is the project:

https://playcanvas.com/project/532246/overview/ui-custom-shader

I used the Custom Shader example and changed just the line to access the model inside the element:

// var model = this.entity.model.model;
var model = this.entity.element._image._model;

It works, but the image is very small and is not respecting the anchors.
Any hint how to fix it?

I solved by fixing the vertex shader by removing the viewProjection transformation:

//gl_Position = matrix_viewProjection * matrix_model * vec4(aPosition, 1.0);
gl_Position = matrix_model * vec4(aPosition, 1.0);
1 Like