THREE.RenderTargetInspector

This is a small helper tool to view render targets and data textures, displaying thumbnails and a separate viewer window when you click on a thumb, in the viewer you can zoom in and pick the pixel values. Click on the small rectangle to save it as image. With the arrows you can place the thumbs bar where it doesn’t cover your overlay if any.

I just made it for some quick inspection and comparing of values, unfortunately it seems Firefox has a bug with drawImage using the onscreen context so it’s slow in Firefox, i’ll investigate into that when i have time. However it was quickly made for debugging of atlases and other non-visible data, if you get any issue feel free to tell. If it finds some use i might extend it.

You can also use it to debug depth maps such as from lights, to use it create it:
const inspector = new THREE.RenderTargetInspector( 200, renderer ); // 200x200 thumbs

And update it in your render loop:
inspector.update();

You can add render targets, textures and uniform objects, you might use a uniform if you want to see the changed textures or when they will be generated some time later.

inspector.add( renderTarget, 'Some render target' );
inspector.add( material.uniforms.dataTexture, 'Data texture from uniform' );
inspector.add( material.uniforms.dataTexture.value, 'Data texture' );
inspector.add( csm.lights, null, { // An array of lights
	type: 'depth'
});

The third parameter is an options object, options are:

  • onBeforeCompile
    For custom shader code.
  • type
    Currently just ‘depth’, for RGBA encoded depth maps.

Demo: THREE.RenderTargetInspector

7 Likes

@jsantell I think you may be interested in this.

1 Like

This looks really useful! The links are broken though (403/404). Is it possible to reupload / fix the links?

1 Like

Fixed, changed file structure on server ^^

hi Fyrestar i love this tool but there still some bugs could you give me the source code or the lastest version thanks a lot