POV-Ray : Newsgroups : povray.general : superimposing text : Re: superimposing text Server Time
2 Aug 2024 22:18:24 EDT (-0400)
  Re: superimposing text  
From: Shay
Date: 28 Jun 2004 17:39:34
Message: <40e09016$1@news.povray.org>
Jim Charter wrote:
> 
> Bingo.  Thanks Louis.

You're scenes are perhaps too complex for this method. Text objects are 
slow anyway and will be terrible with high-quality radiosity and/or 
multiple lights. What I do is call scenes from a small "wrapper" and 
setup my ini file as a two-frame animation. The first frame is my scene, 
the second frame labels it. This also makes it easier to keep multiple 
pictures. Here's an example. I made it so you could cut-paste-run it to 
check it out, but in reality, it would require that your main scene file 
create a text file with all of the information you want to print. 
Uncomment the commented lines and delete the lines labeled "fake line" 
to get the real thing.

  -Shay

// for example, file saved as "text_label.pov"
#include "strings.inc"

#if ( 0 ) // fake line
//#if ( frame_number = 0 )
	#include "my_scene.pov"
#else
//	#include "my_data.pov"
	camera {
		orthographic
		location <0,0,-1>
		look_at  <0,0,0>
		right 1*x
		up 1*y
	}
	box {
		<-0.5, -0.5, 1>, <0.5, 0.5, 1>
		texture {
			pigment {
//				image_map { sys "text_label1.bmp" }
				wood // fake line
			}
			finish { ambient 1 }
			translate -.5
		}
	}
#end

#macro Write ( String )
	#ifndef ( LineNumber )
		#declare LineNumber = 0;
	#else
		#declare LineNumber = LineNumber + 1;
	#end
	text {
		ttf
		"crystal.ttf",
		String,
		1,
		0
		scale .02
		pigment { rgb <1,1,1> }
		finish { ambient 1 }
	 	translate <-.49,.48,0>
		translate y*-.025*LineNumber
	}
#end

// in practice, variables like PTS and PTE
// would be defined in your data file
#local PTS = .008;
#local PTE = .04;

#local PtsString = concat ( "pretrace_start = ", Str(PTS) )
#local PteString = concat ( "pretrace_end = ", Str(PTE) )

Write ( PtsString )
Write ( PteString )


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.