How to use second camera to offscreen?

I want render texture to frambuffer use other camera.but I don’t know how to do.

Hi @linsanda,

Can you please share some more information on the goal of this implementation? I am still not quite sure what you are looking for.

Best,
Sam

I want to flatten a primitive.I need render texture to frambuffer use top camera.and then put the texture and matrix of top camera in vertexShader,and then check if vertexes in the range.
sorry for my english,my english is terrible.

Cesium only has one camera, so it’s not straight forward, but you can have multiple viewers (that have one camera in them). It does mean you have to add your data (entities, maps, etc.) to each of the viewers, but as they are canvases you can essentially do what you want that way;

var v1 = new Cesium.Viewer('cesiumContainer1');
var v2 = new Cesium.Viewer('cesiumContainer2', {
    sceneMode : Cesium.SceneMode.SCENE2D
});

var redEllipse = {
    position: Cesium.Cartesian3.fromDegrees(-103.0, 40.0),
    name : 'Red ellipse on surface',
    ellipse : {
        semiMinorAxis : 250000.0,
        semiMajorAxis : 400000.0,
        material : Cesium.Color.RED.withAlpha(0.5)
    }
};

v1.entities.add(redEllipse);
v2.entities.add(redEllipse);

[source; cesium how to display multiple camera? - Stack Overflow]

Once you’ve got those, you also have access to the camera’s canvas, and the rest is timing and copying over the material.

Cheers,

Alex

3 Likes

thanks,good idea.
GIF 2022-1-18 9-49-27
t