How add custom SCNTechnique pass to specific area, without messing with the rest of Sceneview fullscreen area?

123 views Asked by At

I have a ARSCNView (could be a SCNView), and i need a small rectangle area to show a different perspective from the same scene, live.

I CAN NOT USE multiple SceneViews, because if you're doing anything advanced you will know it will mess a lot of stuff, like Spatial Sounds being played with Echoes and not being able to remove sounds properly, etc.. EVEN SHARING THE SAME SCENE with multiple SceneViews. The audio is all messed up. So i gave up on multiple SceneViews with 1 scene.

So i used SCNTechnique to draw into a small are, like this:

SCNTechnique *technique = [SCNTechnique techniqueWithDictionary:@{
            @"passes":@{
                    @"dockerView":@{
                        @"outputs": @{ @"color": @"COLOR" },
                        @"draw": @"DRAW_SCENE",
                        @"colorStates": @{
                            @"clear": [NSNumber numberWithBool:NO]
                        },
                        @"pointOfView": @"camera_docker",
                        @"viewport": @"100 20 400 250",
                        @"blendStates": @{
                            @"colorOp": @"add",
                            @"alphaOp": @"add"
                        }
                    }
            },
            @"sequence":@[@"dockerView"]
        }];
        
self.sceneView.technique = technique;
//self.sceneView.antialiasingMode = SCNAntialiasingModeNone; //with or without makes no difference

But this is the result:

enter image description here

Why? What did i miss here? Why is it messing with the rest?

Does it totally reset the regular/default pass when you add a new one?

I want to keep the regular Sceneview rendering with its point of view (AND THIS CAMERA CHANGES A LOT SO I CAN'T SET IT WITH A SPECIFIC POINT OF VIEW IN A PREVIOUS PASS).

How can i just keep the Sceneview as is, and just add this pass on "viewport": @"100 20 400 250" just on top, not affecting anything that was working without the SCNTechnique?

0

There are 0 answers