O'Reilly logo

Learn ARCore - Fundamentals of Google ARCore by Micheal Lanham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Editing the shader

Okay, so that's all the Java code we need to write in order to calculate and set our new distance variable. Next, we want to open up the shader program and modify the code for our needs. Follow the given steps to modify the shader program:

  1. Open the point_cloud_vertex.shader file under the res/raw folder, as shown:
>
Opening point_cloud_vertex.shader
  1. Make the highlighted code changes, as follows:
uniform mat4 u_ModelViewProjection;uniform vec4 u_Color;uniform float u_PointSize;uniform float u_FurthestPoint;attribute vec4 a_Position;varying vec4 v_Color;void main() {   float t = length(a_Position)/u_FurthestPoint;   v_Color ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required