Method Groups for Class Texmap

The methods in this class are grouped below.

(Links go to the Texmap Class Reference page.)

Eval Methods
Texmap::EvalColor(ShadeContext& sc)=0
Texmap::EvalMono(ShadeContext& sc)
Texmap::EvalNormalPerturb(ShadeContext& sc)=0
Texmap::HandleOwnViewPerturb()
Output Level
Texmap::SetOutputLevel(TimeValue t, float v)
Texmap::RecursInitSlotType(int sType)
Texmap::GetVPDisplayDIB(TimeValue t, TexHandleMaker& thmaker, Interval &valid, BOOL mono=FALSE, int forceW=0, int forceH=0)
Get UV Transform / Texture Tiling
Texmap::GetUVTransform(Matrix3 &uvtrans)
Texmap::GetTextureTiling()
Texmap::GetUVWSource()
Texmap::GetMapChannel()
UVGen and XYZGen Access
Texmap::GetTheUVGen()
Texmap::GetTheXYZGen()
Loading Bitmap Files
Texmap::LoadMapFiles(TimeValue t)
Texmap::RenderBitmap(TimeValue t, Bitmap *bm, float scale3D=1.0f, BOOL filter = FALSE)
Slot Type
Texmap::InitSlotType(int sType)
Texmap::RenderBitmap(TimeValue t, Bitmap *bm, float scale3D=1.0f, BOOL filter = FALSE)
Texmap::IsOutputMeaningful(ShadeContext& sc)
Texmap::IsLocalOutputMeaningful(ShadeContext& sc)
Texmap::IsHighDynamicRange( ) const;
Additional Details related to Bump Mapping
Note the following information concerning bump mapping:
The following function evaluates the normal perturbation vector in the Bitmap texture.
Point3 BMTex::EvalNormalPerturb(ShadeContext& sc) {
 Point3 dPdu, dPdv
Point2 dM
if (gbufID) sc.SetGBufferID(gbufID)
if (thebm==NULL)
 return Point3(0,0,0)
 uvGen->GetBumpDP(sc,dPdu,dPdv) // get bump basis vectors
 if (alphaAsMono)
  dM=(.01f)*uvGen->EvalDeriv(sc,&alphasamp,filterType!=FILTER_NADA)
 else
  dM=(.01f)*uvGen->EvalDeriv(sc,&mysamp,filterType!=FILTER_NADA)
 return texout->Filter(dM.x*dPdu+dM.y*dPdv)
}
 
The function GetBumpDP() returns the "bump basis vectors". These are the gradient vectors of the UVW mapping in the object coordinate space.
The following function is used to compute the U and V bump basis vectors for a triangle given the texture coordinates at the three vertices of the triangle ( tv[ ] ) and the 3D coordinates at the vertices ( v[ ] ). It is simply a solution using linear algebra for the U and V axes in terms of the XYZ coordinates. It returns:
 b[0] = DP/DU
 b[1] = DP/DV
 
This function does not compute DP/DW (the W bump basis vector), which at present is a shortcoming of the scanline renderer.
void ComputeBumpVectors(const Point3 tv[3], const Point3 v[3],
 Point3 bvec[3]) {
 float uva,uvb,uvc,uvd,uvk
 Point3 v1,v2
 
 uva = tv[1].x-tv[0].x
 uvb = tv[2].x-tv[0].x
 
 uvc = tv[1].y-tv[0].y
 uvd = tv[2].y-tv[0].y
 
 uvk = uvb*uvc - uva*uvd
 
 v1 = v[1]-v[0]
 v2 = v[2]-v[0]
 
 if (uvk!=0) {
  bvec[0] = (uvc*v2-uvd*v1)/uvk
  bvec[1] = (uva*v2-uvb*v1)/uvk
  }
 else {
  if (uva!=0)
   bvec[0] = v1/uva
  else if (uvb!=0)
   bvec[0] = v2/uvb
  else
   bvec[0] = Point3(0.0f,0.0f,0.0f)
  if (uvc!=0)
   bvec[1] = v1/uvc
  else if (uvd!=0)
   bvec[1] = v2/uvd
  else
   bvec[1] = Point3(0.0f,0.0f,0.0f)
  }
 bvec[2] = Point3(0,0,1) // TBD- How to compute this ??
 }
The three Point3's returned in bvec are stored away, and then simple returned in the function SContext::GetBumpDP()
The function UVGen::EvalDeriv() evaluates the local derivative of the texture map in the U and V directions, taking into account symmetry and scaling.
The resulting derivative, dM, is scaled down from the value returned by EvalDeriv to keep the bump perturbations in a more reasonable range.
The perturbation vector is calculated as:
 dM.x*dPdu+dM.y*dPdv
 
And then passed through the texout->Filter function, which is just the following:
Point3 Texout::Filter(Point3 c) {
if (outAmt!=1.0f) c *= outAmt
if (flags&TEXOUT_INVERT) c = -c
return c
}