public class EnvMapUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EnvMapUtils.FixSeamsMethod |
static class |
EnvMapUtils.GenerationType |
Modifier and Type | Field and Description |
---|---|
static int |
NUM_SH_COEFFICIENT |
static float[] |
shBandFactor |
Modifier and Type | Method and Description |
---|---|
static TextureCubeMap |
createIrradianceMap(int size,
Image.Format imageFormat)
initialize the irradiance map
|
static TextureCubeMap |
createPrefilteredEnvMap(int size,
Image.Format imageFormat)
initialize the pem map
|
static TextureCubeMap |
duplicateCubeMap(TextureCubeMap sourceMap)
Make a duplicate of this cube Map.
|
static void |
evalShBasis(Vector3f texelVect,
float[] shDir)
Computes SH coefficient for a given textel dir The method used is the one
from this article : http://graphics.stanford.edu/papers/envmap/envmap.pdf
|
static Node |
getCubeMapCrossDebugView(TextureCubeMap cubeMap,
AssetManager assetManager)
Creates a debug Node of the given cube map to attach to the gui node
the cube map is layered this way :
|
static Node |
getCubeMapCrossDebugViewWithMipMaps(TextureCubeMap cubeMap,
AssetManager assetManager) |
static int |
getCubemapFaceTexCoordFromVector(Vector3f texelVect,
int mapSize,
Vector2f store,
EnvMapUtils.FixSeamsMethod fixSeamsMethod)
Computes the texture coordinates and the face of the cube map from the
given vector
|
static Vector4f |
getHammersleyPoint(int i,
int nbrSample,
Vector4f store) |
static float |
getMipFromRoughness(float roughness,
int miptot) |
static float |
getRoughnessFromMip(int miplevel,
int miptot) |
static int |
getSampleFromMip(int mipLevel,
int miptot) |
static Vector3f[] |
getSphericalHarmonicsCoefficents(TextureCubeMap cubeMap)
|
static Vector3f[] |
getSphericalHarmonicsCoefficents(TextureCubeMap cubeMap,
EnvMapUtils.FixSeamsMethod fixSeamsMethod)
Returns the Spherical Harmonics coefficients for this cube map.
|
static Vector3f |
getVectorFromCubemapFaceTexCoord(int x,
int y,
int mapSize,
int face,
Vector3f store,
EnvMapUtils.FixSeamsMethod fixSeamsMethod)
Computes the 3 component vector coordinates for the given face and coords
|
static Vector3f |
importanceSampleGGX(Vector4f xi,
float a2,
Vector3f normal,
Vector3f store,
TempVars vars) |
static TextureCubeMap |
makeCubeMap(Image rightImg,
Image leftImg,
Image upImg,
Image downImg,
Image backImg,
Image frontImg,
Image.Format format)
Creates a cube map from 6 images
|
static void |
prepareShCoefs(Vector3f[] shCoefs) |
public static final int NUM_SH_COEFFICIENT
public static float[] shBandFactor
public static TextureCubeMap makeCubeMap(Image rightImg, Image leftImg, Image upImg, Image downImg, Image backImg, Image frontImg, Image.Format format)
leftImg
- the west side image, also called negative x (negX) or left
imagerightImg
- the east side image, also called positive x (posX) or
right imagedownImg
- the bottom side image, also called negative y (negY) or
down imageupImg
- the up side image, also called positive y (posY) or up imagebackImg
- the south side image, also called positive z (posZ) or
back imagefrontImg
- the north side image, also called negative z (negZ) or
front imageformat
- the format of the imagepublic static TextureCubeMap duplicateCubeMap(TextureCubeMap sourceMap)
ByteBuffer.duplicate()
Use this if you need to read from the map from multiple threads, it
should guaranty the thread safety. Note that if you want to write to the
cube map you have to make sure that the different thread do not write to
the same area of the buffer. The position, limit and mark are not an
issue.sourceMap
- the map to be copied (not null, unaffected)public static Vector3f getVectorFromCubemapFaceTexCoord(int x, int y, int mapSize, int face, Vector3f store, EnvMapUtils.FixSeamsMethod fixSeamsMethod)
x
- the x texture coordinatey
- the y texture coordinatemapSize
- the size of a face of the cube mapface
- the face to considerstore
- a vector3f where the resulting vector will be storedfixSeamsMethod
- the method to fix the seamspublic static int getCubemapFaceTexCoordFromVector(Vector3f texelVect, int mapSize, Vector2f store, EnvMapUtils.FixSeamsMethod fixSeamsMethod)
texelVect
- the vector to fetch texels from the cube mapfixSeamsMethod
- the method to fix the seamsmapSize
- the size of one face of the cube mapstore
- a Vector2f where the texture coordinates will be storedpublic static int getSampleFromMip(int mipLevel, int miptot)
public static float getRoughnessFromMip(int miplevel, int miptot)
public static float getMipFromRoughness(float roughness, int miptot)
public static Vector3f[] getSphericalHarmonicsCoefficents(TextureCubeMap cubeMap)
getSphericalHarmonicsCoefficents(com.jme3.texture.TextureCubeMap, com.jme3.environment.util.EnvMapUtils.FixSeamsMethod)
the fix method used is EnvMapUtils.FixSeamsMethod.Wrap
cubeMap
- the environment cube map to compute SH forpublic static Vector3f[] getSphericalHarmonicsCoefficents(TextureCubeMap cubeMap, EnvMapUtils.FixSeamsMethod fixSeamsMethod)
cubeMap
- the environment cube map to compute SH forfixSeamsMethod
- method to fix seams when computing the SH
coefficientspublic static void evalShBasis(Vector3f texelVect, float[] shDir)
texelVect
- the input texel (not null, unaffected)shDir
- storage for the resultspublic static void prepareShCoefs(Vector3f[] shCoefs)
public static Vector3f importanceSampleGGX(Vector4f xi, float a2, Vector3f normal, Vector3f store, TempVars vars)
public static Node getCubeMapCrossDebugView(TextureCubeMap cubeMap, AssetManager assetManager)
_____ | | | +Y | _____|_____|_____ _____ | | | | | | -X | +Z | +X | -Z | |_____|_____|_____|_____| | | | -Y | |_____|
cubeMap
- the cube mapassetManager
- the asset Managerpublic static Node getCubeMapCrossDebugViewWithMipMaps(TextureCubeMap cubeMap, AssetManager assetManager)
public static TextureCubeMap createIrradianceMap(int size, Image.Format imageFormat)
size
- the size of the mapimageFormat
- the format of the imagepublic static TextureCubeMap createPrefilteredEnvMap(int size, Image.Format imageFormat)
size
- the size of the mapimageFormat
- the format of the image