0

I'm looking for an example of a billboard texture shader that I can use with SceneKit.

I have a landscape of tiny red dots that I need to render. The dots all need to face the camera head-on.

Using SceneKit, I've managed to render the landscape's geometry and I've made a pattern texture for the dots. This looks roughly like the desired output, however, the dots shouldn't be skewed along the contours of the landscape they should all look face onto the camera and be a perfect circle when viewed from any angle.

At the moment they look like this... Red dots

But the effect should be along the lines of this... Balls facing camera

I've reached out to Apple and they have suggested writing a billboard shader in Metal and plugging that into my SceneKit code as an SCNProgram.

That's a daunting task though so if anyone's done anything similar before it would be very helpful to see the code.

Mark Bridges
  • 8,228
  • 4
  • 50
  • 65

1 Answers1

0

It's not clear to me how your currently solution works. Do you have a single geometry or one for each dot? Fort billboard you would need one geometry per dot.

Here are possible solutions:

  1. Manually orientate the nodes
  2. Use a SCNBillboardConstraint
  3. This looks a lot like a point cloud, see SCNGeometryPrimitiveTypePoint and Rendering Point Clouds
mnuages
  • 13,049
  • 2
  • 23
  • 40
  • I'm generating a single geometry. The code's based on the terrain in this tutorial. https://github.com/rogerboesch/SceneKitTutorial – Mark Bridges Aug 22 '19 at 10:04
  • I've tried make a node for each dot and manually orientating them as well as using a SCNBillboardConstraint on them. This works well when I've just got a small number of dots, however, I need to draw something in the region of 1 million. Is there a technique to rendering something like that at scale that I could be missing? – Mark Bridges Aug 22 '19 at 10:13