Reputation: 179
I've been experimenting with SCNMaterials
, focussing on emission to try and create a neon material. Not sure if it is possible, but if it could emit light, that would be great. Thanks :)
Upvotes: 1
Views: 2324
Reputation: 16256
In addition to the answer by @ProBlaster, you can also set the intensity
of the emission, not just the contents
.
This can be useful to animate an object into glowing progressively more and more: Set the contents to a bright color from the beginning, but the intensity to 0:
material.emission.contents = UIColor.white
material.emission.intensity = 0
(this will not glow)
Then, in an animation block, increase the intensity to (say) 1:
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.5
SCNTransaction.animationTimingFunction = CAMediaTimingFunction(name: .easeIn)
material.emission.intensity = 1
SCNTransaction.commit()
(Not sure you could get "automatic interpolation" of the color valued contents
property in the animation block, like you do for the float-valued intensity
)
Upvotes: 0
Reputation: 491
material.emission.contents = [NSColor greenColor];
all this does is make the material glow in it's own light.
If you wish to make other objects affected by this neon light,
you could add a light to your neon node like so:
SCNLight *mylight = [SCNLight light];
mylight.type = SCNLightTypeOmni;
mylight.color = [NSColor greenColor];
myNeonNode.light = mylight;
Hope that helped!
the power of the light can be controlled by the color you use:
Dark green will seem like a green light that is not so powerful.
Light green will seem like a green light that is more powerful.
Upvotes: 5