Path: utzoo!utgpu!watmath!clyde!att!rutgers!cmcl2!nrl-cmf!ukma!gatech!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!valke@cs.vu.nl
From: valke@cs.vu.nl (Peter Valkenburg)
Newsgroups: comp.graphics
Subject: Texture Mapping
Keywords: texture, polygons, raster scan, fill area
Message-ID: <1737@solo9.cs.vu.nl>
Date: 1 Dec 88 23:44:59 GMT
Sender: valke@cs.vu.nl
Reply-To: valke@cs.vu.nl (Peter Valkenburg)
Organization: VU Informatica, Amsterdam
Lines: 82


			Hello,

I have the following problem:
	I want to display surfaces (polygons) in 3-D scenes containing
	user-defined textures/pictures.  As an example you can think of a
	painting which has been raster scanned and whose raster image must
	be defined to be the texture of a polygon that is the canvas part
	of the same painting in a computer generated 3-D scene of the
	Louvre (Paris, France).
	Or, to give you a more realistic idea of what I'm struggling with
	here, look at this:

	Front view of surface:

		-------------------------
		|			|
		|	    *		|
		|	   ***		|
		|	  *****		|
		|	 *******	|
		|	*********	|
		|      ***********	|
		|     *************	|
		|	   |=|		|
		|	   |=|		|
		|			|
		-------------------------


	View on the display (including perspective projection):

			 -------
			/   *   \
		       /   ***   \
	   	      /  *******  \
		     /      "      \
		    -----------------


	The questions I'd like to pose are the following:

	1) In the definition of such a texture polygon the raster image (the
	   tree) should be associated with the polygon that bounds it (the
	   square).  Given a raster image and an arbitrary polygon in 3-D
	   world coordinates, how does one link them up, i.e. how should one
	   specify the position of one relative to the other?

	2) What kind of operations should work on the special type of
	   polygon mentioned above?  The standard transformations that
	   apply to simple polygons (such as transforming to viewport
	   coordinates or clipping) could be used, but computing the
	   transformation of every raster scan "pixel" might be a very
	   costly (i.e. inefficient) way of doing things.

	3) What kind of standard operations should eventually be used to
	   display the texture polygon?  Some standard `fill area' algorithm
	   and a low-level function like set_pixel(x,y) to display the
	   polygon might do, but this would cause a lot of overhead, both in
	   terms of code to write, and of computational efficiency.

	4) Finally, since the "pixels" of the raster image need not
	   correspond with pixels on the actual display screen due to the
	   mapping (transformation) of the polygon I need an algorithm to
	   interpolate pixels in portions of the display on which the raster
	   scanned pixels are sparsely mapped, and select pixels in portions
	   on which too many pixels are mapped.

I would like to have some pointers to books/articles and, if you have any
idea how to deal with this, your opinion about these problems.
Specifically, I would be interested to know about any standard interfaces
dealing with this (as far as I know, GKS doesn't provide a convenient
set of routines).  If there is any source floating around that does the
work, I'm also happy to hear about it.  Although I finally have to work this
out in Turbo-Pascal on an IBM pc, algorithms written in any similar language
(yes, including C) running on other displays (like a sun or olivetti) would
be very valuable.

Thanx (in advance, that is).

				Peter Valkenburg (valke@cs.vu.nl)
				Prehistoric mail path: ..!mcvax!botter!valke