laanlabs / SCNTechniqueGlow

Basic object glowing outline using SCNTechnique
MIT License
82 stars 12 forks source link

How to change the glow color? #3

Closed yijiasu closed 4 years ago

yijiasu commented 6 years ago

Thank you for bringing this awesome repo. I am developing an AR app using ARKit and SceneKit for 3D model management.

I would like to know how could I change the glow color? I've looked up the entire .plist file but cannot find any place that defines the glow color.

cclaan commented 6 years ago

It's currently set in the metal shader file: https://github.com/laanlabs/SCNTechniqueGlow/blob/master/SCNTechniqueGlow/NodeRender.metal#L69

yijiasu commented 6 years ago

Cool. I've found this line some minutes after I posted this issue here... But could I change the glow color by parameter rather than hardcode the color here? I mean I wish to apply glow color in runtime, and use different colors in different SceneKit objects. How could I implement this?

Thanks.

cclaan commented 6 years ago

I haven't done this, but this is probably what you should use: https://developer.apple.com/documentation/scenekit/scntechnique/1520495-setobject you'll have to expose the glow color as a uniform from the shader.

cclaan commented 6 years ago

This post has some usage of setting shader parameters along with other useful info: http://blog.simonrodriguez.fr/articles/26-08-2015_a_few_scntechnique_examples.html

willperkins commented 4 years ago

I added this feature. Check out the instructions here.