overlapping CAShapeLayer outline - iphone

I have a 3D lookalike graphic object made of several CAShapeLayers. All the shapes (both ceiling and walls) has to be stroked. Some of the shapes share an edge - that seems to be the root of the problem.
However it seems that the outline is being drawn around an existing outline of another shape.
So I got those ugly pikes around some shapes.
How to get rid of those?

Check the lineJoin and lineCap property, Setting it to kCALineJoinRound and kCALineCapRound might help you.
https://developer.apple.com/documentation/quartzcore/cashapelayer

Related

Using shader graphs to add an outline to a sprite of a tank. Despite following tutorials, the outline distorts the sprite

I'm trying to add a black outline surrounding a sprite I have for a tank.
I've tried following every tutorial I could find on 2d outlines for sprites, however almost all of them were done using a previous unity version (I'm using 2021.1.3f1) and don't seem to have any of the problems I've been having.
After using Alpha subtraction on an offset copy of the sample texture (and multiplying by a color) I then try to add it back to the original sample texture. That's when things go wrong, no matter what I've tried it keeps either chopping off the right side of the sprite (I was trying to add the left outline first), or making the right side of the sprite the opposite color of what I'm putting on the left.
What I mean by "cutting off the right", those treads should be the same thickness on the right as on the left, it's like adding the outline to one side trimmed the other.
If it matters, the sprite is a PNG I got from Kenney and then modified in Krita.
For whatever reason, changing the color of the outline seems to also change how much is getting trimmed.
I've been banging my head against this for four hours now, any ideas or suggestions are greatly appreciated.
Update: After following One Full Time Equivalent's suggestion below I do get an outline surrounding the entire sprite, but now it's distorting the colors at the edges of the sprite as seen here:
After replacing Add with Blend
After your subtraction node, put in an Absolute node, otherwise you will subtract the right edge in the alpha channel (this is exactly what you observe right now). Always be aware that you can only see half the color space and negative channels can be tricky to deal with.

How can I make the SCNCamera that i instantiated zoom into only nodes that i want in SceneKit

Pretend i have 3 nodes in total. One of the nodes is a large SCNShere and i put the camera inside this sphere and make the sphere double sided with a textured image. I then put in two smaller spheres next to each other in the center inside this sphere. I also allowCameraControl. I want to be able to zoom into these two smaller spheres without zooming into the larger sphere and messing up the detail on that sphere.
You can't put limits on the camera that's automatically created with allowCameraControl. You'll have to do your own camera management, using your own gesture recognizers.
Another solution would be to rethink your approach to the background image. Instead of using a sky sphere for the background (which is what it sounds like you're doing), use a skybox, or cube map. You can supply a cube map through the scene's background property. The SCNMaterial documentation explains the options for supply a cube map.
Hmm, I wonder what would happen if you use the large sphere's textured image/material as the scene's background, instead of putting it on an enclosing sphere?
I like the idea of using an image as the background but there are two problems. One is i looked on the web for ways to make an image the background and none of them work. Two I want the background to have depth so in order to go on that idea I need to find a way to zoom into the background and have the image pan in the opposite direction that I drag.

SceneKit HitTest Small Object in Swift

I am trying to move a cylinder using the pan gesture.
Got this working however the hittest does not work well with small objects and my big fingers.
Is there anyway I can expand the objects bounding box so it is bigger then the cylinder making it easier to be moved/hittested?
I am passing in the SCNHitTestBoundingBoxOnlyKey option so if I could expand the bounding box maybe it will work better.
I think I found a solution!
One should be able to add a bigger cylinder and make it a child note to the original cylinder. Then make it hidden, and pass the option SCNHitTestIgnoreHiddenNodesKey=NO when doing the hitTest. This way a small cylinder/object can be moved with pan gesture allthough it is smaller then a touch/finger point.

How to change polygon shape in CAShapeLayer by tapping its corners?

I am drawing a CAShapeLayer with a polygon with 8 corners. I want to change the shape of the polygon by dragging one or multiple corners at a time. How can i achieve this?
CHeers
AF
Unfortunately i have not got a solution for this yet. I kept trying different things but the only thing that slightly worked for me, which is not optimal, is to apply the transformation of the corners as multiple animations applied on the path.

how to unveil a picture in andengine

Recently i discovered andengine and I'm playing a little with it.
I would like to put a picture in background and cover it with a solid colored rectangle, and be able to cut out polygon shaped parts from the rectangle to unveil the portion of the underlying picture corresponding to that polygon... I hope I explained myself.
I'm not focusing on the polygon shape, it could also be a rectangle or a circle.
Thx in advance for your suggestions
this is a more complex problem than it sounds.
You could play around with some uncommon Blendfunctions. This could work like drawing the uncovered polygons first and blending the image only where there is a high saturation or so...
Alternatively you would seek for sth like a RenderTexture and dynamically make it more transparent where it is touched. This requires the FBO Extension, which is a core part of GLES2 and optional on GLES1.
I hope this helped :-)
Best Regards,
Nicolas