Would it be possible to render objects after post processing?

private cam: Camera;
onEnable() {
  this.cam = this.gameObject.getComponent(Camera);
}
onAfterRender(){
  this.cam.renderNow();
}

Something like this- typed on a phone, can’t verify right now :slightly_smiling_face:

Might be the method is called something else?
Or I’m importing the wron camera
(I might add that TypeScript is very new to me, so things move a bit slow… :sweat_smile: )
Code_lhExHIaPiA.png

by user 219335701790064640

Camera from @needle-tools/engine, not the one from three

Tried both

by user 219335701790064640

by user 219335701790064640

Then I’ll have to check later, sorry, on the go right now
You can check if intellisense gives you the right name

I scrolled through all definitions.
But there’s no hurry, I can wait :slight_smile:

Thank you anyway! :slight_smile:

by user 219335701790064640

I think its this.context.renderNow(myCam)

Or just use the threejs renderer directly, you can access it with this.context.renderer

Here’s a WIP for a custom ā€œCameraLayerā€

import { Behaviour, Camera } from "@needle-tools/engine";
import { PerspectiveCamera } from "three";

// Documentation → https://docs.needle.tools/scripting

export class CameraLayer extends Behaviour {
    
    private cam: Camera | null = null;

    onEnable() {
        // getting the Camera component from the same GameObject
        this.cam = this.gameObject.getComponent(Camera);
        if (!this.cam) {
            console.warn("CameraLayer requires a Camera component");
            this.enabled = false;
        }
    }

    onAfterRender(): void {
        if (!this.cam) return;
        // we remember the current background as we want to turn it off for the layer
        const currentBackground = this.scene.background;
        // we don't want automatic color clear anymore here
        this.context.renderer.autoClearColor = false;
        // if this is a Perspective Cam, update the aspect
        if (this.cam.cam instanceof PerspectiveCamera) {
            this.context.updateAspect(this.cam.cam);
        }
        // clear background, render, and restore the background
        this.scene.background = null;
        this.context.renderNow(this.cam.cam);
        this.scene.background = currentBackground;
    }
}

I can not for the life of me get the other camera to render :person_shrugging:

I’ve copied your code and have to cameras in my scene. Both cameras, as of now, is set to render the whole scene but from differen angles. But I only see what ā€œMain Cameraā€ is rendering.
Is there perhaps some setup in the scene I am missing?

by user 219335701790064640

Updated the code, now it should work :slightly_smiling_face:

Make sure the component is on the ā€œlayeredā€ camera
Make sure your main camera is tagged ā€œMainCameraā€

Here’s how it should look for two cameras, the second one just draws on top of everything.

So weird. The code makes every sense as well?

Here’s a screen grab of the two cameras aswell (FX Camera is the layered one)
Is there something I’m doing wrong?


by user 219335701790064640

looks ok. maybe put it on ā€œdefaultā€ layer for now for testing?

I made a texture the render target and put a Raw image on top of the screen to confirm that the camera is indeed working, but I can’t seem to get it to render to the screen.
This is very confusing, it should work :sweat_smile:

by user 219335701790064640

Is it possible to get a videocall or something? Another day perhaps?

If I can get this method to work I’m pretty much set regarding the project I’m working on

by user 219335701790064640

Can you make an empty scene with just two cameras (one MainCamera) and a cube, and the second cam having the script?