I was trying to cover the whole surface of the detected plane with a texture. Using OpenGl (like in the HelloAr sample) enables me do this like this screenshot . However i want to switch to Sceneform and i only could get something like this by following other questions in the Github. These are the codes that i used currently for texture rendering. To conclude, i do not want this spotlight texture on the plane. I want to cover whole detected plane like my first screenshot. Can you give some information about how can i achieve this? Thank you!
Texture.Sampler sampler =
Texture.Sampler.builder()
.setMagFilter(Texture.Sampler.MagFilter.LINEAR)
.setMinFilter(Texture.Sampler.MinFilter.LINEAR)
.setWrapMode(Texture.Sampler.WrapMode.REPEAT)
.build();
CompletableFuture<Texture> trigrid = Texture.builder()
.setSource(this, R.drawable.gray)
.setSampler(sampler).build();
PlaneRenderer planeRenderer = arSceneView.getPlaneRenderer();
planeRenderer.getMaterial().thenAcceptBoth(trigrid, (material, texture) -> {
material.setTexture(PlaneRenderer.MATERIAL_TEXTURE, texture);
});`
I found the solution both using other answers and combine them. Proper plane rendering can be done like below. Important point is this renderable should be called at every frame otherwise ARCore overrides it and you don't see the effect that you want. Here is a code that solves my problem.
arSceneView.getScene().addOnUpdateListener(frameTime -> {
PlaneRenderer planeRenderer = arSceneView.getPlaneRenderer();
planeRenderer.getMaterial().thenAcceptBoth(trigrid, (material, texture) -> {
material.setTexture(PlaneRenderer.MATERIAL_TEXTURE, texture);
material.setFloat(PlaneRenderer.MATERIAL_SPOTLIGHT_RADIUS, Float.MAX_VALUE);
});
});