Skip to content
Emd4600 edited this page Mar 22, 2019 · 3 revisions

Many shaders require data from the game, such as the current time, the model position, etc. This is known as Shader Data, and it is one of the most useful features in shader creating. Using it is quite easy: you just need to declare it in the shader code, preceded by extern uniform. For example:

extern uniform float4 skinWeigts;

When the game sees your code requires data, it will send it to the shader. Keep in mind that not all data is always available: for example, using cliffColor will give unexpected results if you are in the editor and there is no planet.

Note: in Shader Builders, shader data goes in the declareCode block.

Available Shader Data

Below is a list of al the shader data used by Spore. There might be more variables that haven't been found/documented yet. Most of them also have the variable type, but some others don't; in those cases, you might need to find a shader that uses them to know their correct type.

float4 skinWeights;

float4 SkinBones[192];

float4x4 modelToClip;

float4x3 modelToCamera;

float4x3 modelToWorld;

float4x4 worldToClip;

float4x3 cameraToWorld;

float4x3 worldToCamera;

float4x4 worldToClipTranspose;

float3x4 cameraToWorldTranspose;

worldToCameraTranspose;

cameraToClip;

lightPosModel;

lightDirCamera;

float4 worldCameraPosition;

float4 worldCameraDirection;

float4 materialColor;

float4 ambient;

time;

float pulse;

float4x3 worldToModel;

float4 objectTypeColor;

float4 frameInfo;

float4 screenInfo;

struct 
{
	float4 mFrequencyMag;
	float mTime;
} mNoiseScale;

half4 customParams[2];

float4x3 geomToRTT;

float4x4 geomToRTTViewTrans;

float4 tintParams;

float4 region;

float4 materialParams;

float4 uvTweak;

float4 editorColors[2];

struct 
{ 
	float4 mColor1; 
	float4 mColor2; 
	float4 mParams; 
} editorColors;

struct 
{ 
	float4 mDir; 
	float4 mColor; 
} dirLightsWorld[4];

dirLightsModel;

float4 sunDirAndCelStrength;

float4 shCoeffs[16];

float cameraDistance;

float4 bakedPaint[2];

float4 uvSubRect;

float4 mousePosition;

float4 expandAmount;

half4 cameraParams[1];

struct 
{ 
	float4 mRangeAndStrength; 
	float4 mShadowDir;
	float4 mNestInfo; 
} shadowMapInfo;

float4 foggingCPU;

float4 patchLocation;

clipToWorld;

clipToCamera;

float4 identityColor;

struct 
{ 
	float4x4 pcaBasis0;
	float4x4 pcaBasis1;
	float4x4 pcaBasis2;
	float4x4 pcaBasis3;
	float4 pcaMean;
} pcaTexture;

float4 rolloverRegion;

float4 renderDepth;

float4 terrainTint;

utfWin;

float4 deadTerrainTint;

float4 cellStage;

terrainBrushFilterKernel;

float4 terraformValues;

float4x3 worldToPatch;

terrainBrushCubeMatRot;

terrainSynthParams;

debugPSColor;

float4 gameInfo;

ramp;

float4 sunDir;

struct
{
	float4 vSunDir;
	float4 nightLightTint;
	float4 nightLightColor;
	float4 duskLightColor;
	float4 dayLightColor;
	float4 nightShadowColor;
	float4 duskShadowColor;
	float4 dayShadowColor;
	float4 duskDawnStartEnd;
} terrainLighting;

float4 tramp[8];

beachColor;

cliffColor;

float4x4 viewTransform;

float4 shCoeffs[4];

float4 minWater[2];

float4 worldCameraNormal;

struct
{
	float4x4 worldViewProjection;
	float4 QuadFaceUVXform;
	float4 QuadMorphValue;
	float4 QuadFaceElemMap;
	float4 QuadFaceSignMap;
	float4 QuadFaceXForm[3];
} terrainTransform;

struct
{
	float4 DecalColorTint;
	float4 dirScaleU;
	float4 dirScaleV;
} decalState;

struct
{
	float4 vSunDir;
	float4 waterColor;
	float4 innerParms;
	float4 vCamPos;
	float4 sphereParms;
	float4 camParms;
	float4 illumParms;
	float4 fogParms;
	float4 nightLightTint;
	float4 nightLightColor;
	float4 duskLightColor;
	float4 dayLightColor;
	float4 nightShadowColor;
	float4 duskShadowColor;
	float4 dayShadowColor;
	float4 duskDawnStartEnd;
	float4x4 viewTransform;
} terrainState;
Clone this wiki locally