Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::BumpMap Class Reference


Normal + bump map for use with G3D::UniversalMaterial. More...

Inherits G3D::ReferenceCountedObject.

Classes

class  Settings
 
class  Specification
 

Public Member Functions

const shared_ptr< MapComponent< Image4 > > & normalBumpMap () const
 Packed normal map and bump map. More...
 
void setStorage (ImageStorage s) const
 
const Settingssettings () const
 

Static Public Member Functions

static shared_ptr< PixelTransferBuffercomputeBumpMap (const shared_ptr< PixelTransferBuffer > &normalMap, float signConvention=-1.0f)
 
More...
 
static shared_ptr< PixelTransferBuffercomputeNormalMap (int width, int height, int channels, const unorm8 *src, const BumpMapPreprocess &preprocess=BumpMapPreprocess())
 
Given a monochrome, tangent-space bump map, computes a new image where the RGB channels are a tangent space normal map and the alpha channel is the original bump map. More...
 
static shared_ptr< BumpMapcreate (const shared_ptr< MapComponent< Image4 > > &normalBump, const Settings &settings)
 
static shared_ptr< BumpMapcreate (const Specification &spec)
 
static void detectNormalBumpFormat (const unorm8 *bytes, int numComponents, int numPixels, bool &hasBump, bool &hasNormal, bool &bumpInRed)
 

Protected Member Functions

 BumpMap (const shared_ptr< MapComponent< Image4 > > &normalBump, const Settings &settings)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

shared_ptr< MapComponent< Image4 > > m_normalBump
 
Settings m_settings
 

Detailed Description


Normal + bump map for use with G3D::UniversalMaterial.

Supports Blinn normal mapping, Kaneko-Welsh parallax mapping, and Tatarchuk style parallax occlusion mapping.

Constructor & Destructor Documentation

◆ BumpMap()

G3D::BumpMap::BumpMap ( const shared_ptr< MapComponent< Image4 > > &  normalBump,
const Settings settings 
)
protected

Member Function Documentation

◆ computeBumpMap()

static shared_ptr<PixelTransferBuffer> G3D::BumpMap::computeBumpMap ( const shared_ptr< PixelTransferBuffer > &  normalMap,
float  signConvention = -1.0f 
)
static


Parameters
signConventionSet the sign convention based on the coordinate system of your source normal map and texture coordinates. It will be fairly obvious if you choose the wrong one because the height map will be "inside out" along some dimension. -1 = G3D computeNormalMap default, +1 = 3DS Max

◆ computeNormalMap()

static shared_ptr<PixelTransferBuffer> G3D::BumpMap::computeNormalMap ( int  width,
int  height,
int  channels,
const unorm8 src,
const BumpMapPreprocess &  preprocess = BumpMapPreprocess() 
)
static


Given a monochrome, tangent-space bump map, computes a new image where the RGB channels are a tangent space normal map and the alpha channel is the original bump map.

Assumes the input image is tileable.

In the resulting image, x = red = tangent, y = green = binormal, and z = blue = normal.

◆ create() [1/2]

static shared_ptr<BumpMap> G3D::BumpMap::create ( const shared_ptr< MapComponent< Image4 > > &  normalBump,
const Settings settings 
)
static
Parameters
normalBumpHas tangent-space normals in rgb and bump elevation in a
settingsSettings

◆ create() [2/2]

static shared_ptr<BumpMap> G3D::BumpMap::create ( const Specification spec)
static

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ detectNormalBumpFormat()

static void G3D::BumpMap::detectNormalBumpFormat ( const unorm8 bytes,
int  numComponents,
int  numPixels,
bool &  hasBump,
bool &  hasNormal,
bool &  bumpInRed 
)
static

◆ normalBumpMap()

const shared_ptr<MapComponent<Image4> >& G3D::BumpMap::normalBumpMap ( ) const
inline

Packed normal map and bump map.

  • rgb = tangent-space normal
  • a = bump height

◆ setStorage()

void G3D::BumpMap::setStorage ( ImageStorage  s) const
inline

◆ settings()

const Settings& G3D::BumpMap::settings ( ) const
inline

Member Data Documentation

◆ m_normalBump

shared_ptr<MapComponent<Image4> > G3D::BumpMap::m_normalBump
protected
  • rgb = tangent-space normal
  • a = bump height

(Note that this is compressed to Image4unorm8 on the GPU)

Referenced by normalBumpMap(), and setStorage().

◆ m_settings

Settings G3D::BumpMap::m_settings
protected

Referenced by settings().


documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15