Correctly export SVGRenderer to SVG

I faced such problem. My task is to convert the imported *.obj, rotated to a convenient angle of view, into a svg file.
Here is an example
What is the problem - when exporting the mesh and geometry created by the methods of the library, the color and shape are exported correctly. But the imported obj file, with the simplest material, is exported only as a black shape :frowning:

It appears SVGRenderer needs ambient light in order to be happy. Try the following:

  • just before using SVGRenderer add AmbientLight to the scene
  • when the SVG is captured, remove the light from the scene

Here is a modified version of your btnSVGExportClick that does this:

function btnSVGExportClick(){
	// add ambient light to make SVGRenderer happy
	var ambient = new THREE.AmbientLight( 'white' );
	scene.add( ambient );
	// the original code
	var rendererSVG = new SVGRenderer();
	rendererSVG.setSize(window.innerWidth, window.innerHeight);			
	rendererSVG.render( scene, camera );		
	ExportToSVG(rendererSVG, "test.svg");
	// remove the ambient light		
	scene.remove( ambient );

Many thanks for the advice, it confirmed my suspicions about the lack of light for materials that are not emissive. I will definitely try your modification soon

You are absolutely right! Your method solved my problem!