1

I'm using SceneKit and ARKit 1.5, once a surface has been mapped I apply a material to it.

I would like to only show what's under the camera in a certain radius with an alpha effect. I want to keep the material static meaning that it does not move when the camera moves, only the radius shape will move.

What kind of technique could I use for this ?

ArCore by Google does this perfectly.

Actual rendering: enter image description here

Desired Rendering: enter image description here

ARCore example: (click to see GIF)

enter image description here

Thank you!

Adrien Yvon
  • 662
  • 7
  • 18

1 Answers1

1

I would use a shader modifier to achieve that.

Using the .surface entry point you could set _surface.transparent to a value that depends on the distance between the shaded point and the point of view:

_surface.transparent = attenuation(length(_surface.position));
mnuages
  • 13,049
  • 2
  • 23
  • 40
  • Thanks for your answer, I tried to use _surface.transparent but it modifies the entire surface transparency. I'd like to make just a part of the surface transparent in a circle shape like in my pictures. How could I define a transparent / non transparent area using shaders ? – Adrien Yvon Apr 09 '18 at 19:00
  • A surface modifier is applied per-pixel. If the entire surface becomes transparent then your attenuation function needs more tuning. – mnuages Apr 09 '18 at 19:10
  • Thanks, unfortunately I don't have enough knowledge to write the attenuation function shader code at this point (though I would love too). So far using Apple doc I was able to make transparent stripes on a material but that's all. – Adrien Yvon Apr 09 '18 at 19:44