Jump to content

Recommended Posts

Posted

Trying to rebuild the lua-gluefunctions.bmx

 

using:

 

SuperStrict

Framework leadwerks.engine

Import "D:\Game Development\Leadwerks SDK 2.3\BMX\Framework\framework.bmx"

Import lugi.generator

generateGlueCode("lua-gluefunctions.bmx")

Notify "lua-gluefunctions.bmx Generation Complete"

End

 

gives the error:

 

D:/Game Development/BlitzMax/bin/ld.exe: cannot find -lluajit

Build Error: Failed to link D:/Projects/BMAX Projects/lua gluefunctions Generator/lgfgen.exe

 

is there a module needed now?

 

 

The reason for rebuilding the lua-gluefunctions.bmx was due to errors when using the original:

 

Compile Error: Identifier '_FindTerrainShader' not found

[D:/Projects/BMAX Projects/BasicLoader/lua-gluefunctions.bmx;7518;2]

 

 

Which I suspected was down to changes in the commands.bmx

 

Anyone else having the same probs?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

ok so not just me then.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

ok Gimpy m8, will test that in a few just trying something ...

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

No probs MG

 

Here is the error that i got from the project wizard + blitzmax

 

Error: Failed to link shader program.

Vertex info

-----------

(0) : error C6007: Constant register limit exceeded; more than 1024 constant registers needed to compiled program

(0) : error C6007: Constant register limit exceeded; more than 1024 constant registers needed to compiled program

 

 

Hope this helps :lol:

 

Thanks

 

Gimpy73 :blink:

Posted

ok some progress let me sort a post out.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

Use the mod here:

 

 

 

I just copied the zeke.mod folder to the blitzmax mod folder then re-build the docs. This has allowed me to generate the lua-gluefunctions.bmx and get a working from the project wizard + blitzmax

 

This is as far as I have got.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

yep josh did that just after I mentioned it.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

Ok updated BMax , copied that LuaJit file across , rebuilt the docs.

 

Ran the project wizard , same error as above.

 

Ran the project wizard but made BMax run in debugmode , same error as above but the BMax code stops on this line :

 

material=LoadMaterial("abstract::cobblestones.mat")

 

Thanks

Gimpy73 :rolleyes:

Posted

are you pointing the wizard to the install dir. of 2.32 ?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

Here is the full error with source code :

 

Error: Failed to link shader program.

Vertex info

-----------

(0) : error C6007: Constant register limit exceeded; more than 1024 constant registers needed to compiled program

(0) : error C6007: Constant register limit exceeded; more than 1024 constant registers needed to compiled program

 

 

Vert source:
#version 120
#define LW_MAX_PASS_SIZE 1024
#define LW_INSTANCED
#define LW_SM4 
#define LW_DIFFUSE texture0
#define LW_BUMPMAP texture1

uniform vec3 terrainscale;
uniform sampler2D texture15;
uniform float terrainsize;

float GetTerrainHeight( in vec2 position ) {
float terrainresolution = terrainsize/terrainscale.x;
vec2 texcoord;
float pixelsize = 1.0 / terrainresolution;
texcoord = position.xy / terrainsize + 0.5;
texcoord += 0.5 * pixelsize;
return texture2D( texture15, texcoord ).x * terrainscale.y;
}


//uniform mat4 meshmatrix;
uniform vec2 meshlayeroffset;
uniform float meshlayerscale;
uniform float meshlayersize;
uniform float meshlayersectorsize;

uniform float instancepasssize;

uniform sampler2D texture10;

#ifdef LW_INSTANCED
#ifndef LW_SKIN
	#extension GL_EXT_gpu_shader4 : enable
	//#extension GL_EXT_bindable_uniform : enable
	//bindable uniform mat4 instancematrix[ LW_MAX_PASS_SIZE ];
	uniform mat4 instancematrix[ LW_MAX_PASS_SIZE ];
#else
	uniform mat4 animmatrix[69];
	uniform mat4 instancematrix[1];
#endif
#else
uniform mat4 instancematrix[1];
#endif

#ifdef LW_SKIN

attribute vec4 boneindices;
uniform float bonecount;

mat4 GetAnimMatrix( in int i ) {
return animmatrix[i];
/*
mat4 mat;

float f=i;
f+=0.5;

mat[0]=texture2D(texture10,vec2( 0.5/64.0, f/bonecount ));
mat[1]=texture2D(texture10,vec2( 1.5/64.0, f/bonecount ));
mat[2]=texture2D(texture10,vec2( 2.5/64.0, f/bonecount ));
mat[3]=texture2D(texture10,vec2( 3.5/64.0, f/bonecount ));		

return mat;*/
}

#endif


uniform float apptime;
uniform vec2 buffersize;
uniform float meshlayerrange;
uniform float meshlayerheight;
uniform vec3 cameraposition;
uniform float camerazoom;
uniform float vegetationviewdistance;
uniform float vegetationheight;

varying vec3 T,B,N;
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec3 cubecoord;
varying vec3 vertexposition;
varying vec4 modelvertex;
varying vec4 projectionspace;
varying vec4 refractionspace;
varying vec4 fragcolor;

#ifdef LW_PARALLAXMAP
varying vec3 eyevec;
#endif

#ifdef LW_MESHLAYER
varying float vegetationfade;
#endif

void main(void) {

vec4 vertexcameraposition;

mat4 mat;
vec4 color;

#ifdef LW_SKIN
//mat=meshmatrix;
mat=instancematrix[0];
#else
#ifdef LW_INSTANCED
	mat=instancematrix[ gl_InstanceID ];

	/*
	float f=gl_InstanceID;
	f+=0.5;
	mat[0]=texture2D(texture10,vec2(0.5/64.0,f/instancepasssize));
	mat[1]=texture2D(texture10,vec2(1.5/64.0,f/instancepasssize));
	mat[2]=texture2D(texture10,vec2(2.5/64.0,f/instancepasssize));
	mat[3]=texture2D(texture10,vec2(3.5/64.0,f/instancepasssize));
	*/
#else
	mat=instancematrix[0];//meshmatrix;
#endif

#endif

color.x=mat[0][3];
color.y=mat[1][3];
color.z=mat[2][3];
color.w=mat[3][3];

mat[0][3]=0.0;
mat[1][3]=0.0;
mat[2][3]=0.0;
mat[3][3]=1.0;



fragcolor = gl_Color*color;

modelvertex = gl_Vertex;

#ifdef LW_SKIN
	fragcolor=color;
	mat  = GetAnimMatrix( int(boneindices[0]) ) * gl_Color[0];
	mat += GetAnimMatrix( int(boneindices[1]) ) * gl_Color[1];
	mat += GetAnimMatrix( int(boneindices[2]) ) * gl_Color[2];
	mat += GetAnimMatrix( int(boneindices[3]) ) * gl_Color[3];
	/*
	mat = animmatrix[ int(boneindices[0]) ] * gl_Color[0];
	mat += animmatrix[ int(boneindices[1]) ] * gl_Color[1]; 
	mat += animmatrix[ int(boneindices[2]) ] * gl_Color[2];
	mat += animmatrix[ int(boneindices[3]) ] * gl_Color[3];
	*/
#endif

mat3 nmat = mat3(mat[0].xyz,mat[1].xyz,mat[2].xyz);

#ifdef LW_MESHLAYER
	mat[3].y=0.0;
#endif

modelvertex = mat * modelvertex;

#ifdef LW_MESHLAYER
	//Align to terrain height
	modelvertex.y += GetTerrainHeight(modelvertex.xz);
	//Sink into ground with distance
	float mld = length(modelvertex.xyz - cameraposition )/vegetationviewdistance;
	//mld += abs(mat[3].x-int(mat[3].x)) * 0.25;
	vegetationfade=mld;
	mld = clamp( (mld-0.75)*4.0, 0.0, 1.0 );
	modelvertex.y -= mld * vegetationheight;
#endif

#ifdef LW_SWAY
	float seed = mod(apptime / 100.0 * 0.25,360.0);
	seed += mat[3].x*33.0 + mat[3].y*67.8 + mat[3].z*123.5;
	seed += gl_Vertex.x + gl_Vertex.y + gl_Vertex.z;
	vec4 movement = vec4( vec3( gl_Color.x * gl_Normal * LW_SWAY * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);		
	modelvertex += movement;
	fragcolor = color;
#endif

vertexposition = modelvertex.xyz;
vertexcameraposition = gl_ModelViewProjectionMatrix * modelvertex;		

texcoord0=gl_MultiTexCoord0.xy;
texcoord1=gl_MultiTexCoord1.xy;

#ifdef LW_CUBEMAP
	cubecoord = modelvertex.xyz - CameraPosition;
	cubecoord = reflect( cubeCoord , normalize(nmat * gl_Normal) );
#endif

nmat = gl_NormalMatrix * nmat;

N = normalize( nmat * gl_Normal );
#ifdef LW_BUMPMAP
	T = normalize( nmat * gl_MultiTexCoord2.xyz );		
	B = normalize( nmat * gl_MultiTexCoord3.xyz );
#endif

gl_Position = vertexcameraposition;

#ifdef __GLSL_CG_DATA_TYPES
	gl_ClipVertex = gl_ModelViewMatrix * modelvertex;
#endif

#ifdef LW_PARALLAXMAP
	modelvertex = gl_ModelViewMatrix * modelvertex;
	mat3 TBN_Matrix;
    	TBN_Matrix[0] = T;
	TBN_Matrix[1] = B;
	TBN_Matrix[2] = N;
	eyevec = vec3(-modelvertex) * TBN_Matrix;
//		modelvertex = gl_ModelViewMatrix * modelvertex;
//		EyeVec = vec3(dot(T,-modelvertex), dot(B,-modelvertex), dot(N,-modelvertex));
#endif

}



Frag source:
#version 120
#define LW_MAX_PASS_SIZE 1024
#define LW_INSTANCED
#define LW_SM4 
#define LW_DIFFUSE texture0
#define LW_BUMPMAP texture1
#define LW_SPECULAR

#extension GL_ARB_draw_buffers : enable

uniform vec3 cameraposition;
uniform vec2 buffersize;
uniform vec2 camerarange;

float greyscale( in vec3 color ) {
return color.x * 0.3 + color.y * 0.59 + color.z * 0.11;
}

float DepthToZPosition(in float depth) {
return camerarange.x / (camerarange.y - depth * (camerarange.y - camerarange.x)) * camerarange.y;
}

float ZPositionToDepth(in float z) {
return (camerarange.x / (z / camerarange.y) - camerarange.y) / -(camerarange.y - camerarange.x);
}


#ifdef LW_DETAIL
uniform sampler2D LW_DETAIL;
#endif

#ifdef LW_DIFFUSE
uniform sampler2D LW_DIFFUSE;
#endif

#ifdef LW_DIFFUSE2
uniform sampler2D LW_DIFFUSE2;
#endif

#ifdef LW_SPECULARMAP
uniform sampler2D LW_SPECULARMAP;
#endif

#ifdef LW_BUMPMAP
uniform sampler2D LW_BUMPMAP;
#endif

#ifdef LW_BUMPMAP2
uniform sampler2D LW_BUMPMAP2;
#endif

#ifdef LW_BLOOM
uniform sampler2D LW_BLOOM;
#endif

#ifdef LW_CUBEMAP
uniform samplerCube LW_CUBEMAP;
#endif

#ifdef LW_GIMAP
uniform sampler2D LW_GIMAP;
#endif

#ifdef LW_PARALLAXMAP
uniform sampler2D LW_PARALLAXMAP;
varying vec3 eyevec;
#endif

#ifdef LE_REFRACTION
uniform sampler2D LE_REFRACTION;
uniform sampler2D LE_DEPTHBUFFER;
uniform float refractionstrength = 0.01;
#endif

#ifdef LW_POMMAP
vec3 vLightTS=vec3(0.577,0.577,0.577);
varying vec3 eyevec;
float depthP = 0.01;
float nMinSamples = 20;
float nMaxSamples = 50;	
#endif

#ifdef LW_MESHLAYER
varying float vegetationfade;
#endif

#ifdef LW_ALPHABLEND
uniform sampler2D LW_ALPHABLEND_INCOMINGCOLOR;
uniform sampler2D LW_ALPHABLEND_INCOMINGNORMAL;
#endif

varying vec3 vertexposition;
varying vec3 T,B,N;
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec3 cubecoord;
varying vec4 modelvertex;
varying vec4 fragcolor;

float fOcclusionShadow = 1.0;

uniform sampler2D texture14;
uniform float terrainsize;
uniform vec3 terrainscale;
uniform float bumpscale;
uniform float specular;
uniform float gloss;

//Terrain color map
uniform sampler2D texture12;

void main(void) {

vec4 diffuse = fragcolor;
vec3 normal;
float shininess = 0.0;
vec2 texcoord=texcoord0;// only use this because of parallax mapping
float selfillumination = 0.0;	

vec2 terraincoord;
float terrainresolution;

#ifdef LW_VERTEXGI
	diffuse = vec4(1);
#endif

#ifdef LW_PARALLAXMAP
	texcoord += (diffuse.w * 0.04 - 0.036) * normalize(eyevec).xy;
	//texcoord += (texture2D(LW_DIFFUSE,texcoord).w * 0.04 - 0.036) * normalize(eyevec).xy;
#endif

#ifdef LW_POMMAP
	// for POM, the heightmap is in the alpha of the diffuse so save ur diffuse with DXT5 I chose this because the alpha of DXT5 is higher precision
// from Microsoft's and Ati's implementation thank them for the source 
// Compute the ray direction for intersecting the height field profile with 
// current view ray. See the above paper for derivation of this computation. (Ati's comment)

// Compute initial parallax displacement direction: (Ati's comment)
vec2 vparallaxdirection = normalize(eyevec).xy;

// The length of this vector determines the furthest amount of displacement: (Ati's comment)
float flength         = length( eyevec );
float fparallaxlength = sqrt( flength * flength - eyevec.z * eyevec.z ) / eyevec.z; 

// Compute the actual reverse parallax displacement vector: (Ati's comment)
vec2 vParallaxOffsetTS = vparallaxdirection * fparallaxlength;

// Need to scale the amount of displacement to account for different height ranges
// in height maps. This is controlled by an artist-editable parameter: (Ati's comment)
vParallaxOffsetTS *= depthP; 

int nNumSamples;
nNumSamples = int((mix( nMinSamples, nMaxSamples, 1-dot( vparallaxdirection, N.xy ) )));	//In reference shader: int nNumSamples = (int)(lerp( nMinSamples, nMaxSamples, dot( eyeDirWS, N ) ));
float fStepSize = 1.0 / float(nNumSamples);	
float fCurrHeight = 0.0;
float fPrevHeight = 1.0;
float fNextHeight = 0.0;
int    nStepIndex = 0;
vec2 vTexOffsetPerStep = fStepSize * vParallaxOffsetTS;
vec2 vTexCurrentOffset = texcoord.xy;
float  fCurrentBound     = 1.0;
float  fParallaxAmount   = 0.0;

vec2 pt1 = vec2(0,0);
vec2 pt2 = vec2(0,0);	    

while ( nStepIndex < nNumSamples ) 
{
vTexCurrentOffset -= vTexOffsetPerStep;

// Sample height map which in this case is stored in the alpha channel of the normal map: (Ati's comment)
fCurrHeight = texture2D( LW_DIFFUSE, vTexCurrentOffset).a; 

fCurrentBound -= fStepSize;

if ( fCurrHeight > fCurrentBound ) 
{   
   pt1 = vec2( fCurrentBound, fCurrHeight );
   pt2 = vec2( fCurrentBound + fStepSize, fPrevHeight );

   nStepIndex = nNumSamples + 1;	//Exit loop
   fPrevHeight = fCurrHeight;
}
else
{
   nStepIndex++;
   fPrevHeight = fCurrHeight;
}
} 
float fDelta2 = pt2.x - pt2.y;
float fDelta1 = pt1.x - pt1.y;

float fDenominator = fDelta2 - fDelta1;

// SM 3.0 requires a check for divide by zero, since that operation will generate
// an 'Inf' number instead of 0, as previous models (conveniently) did: (Ati's comment)
if ( fDenominator == 0.0 )
{
fParallaxAmount = 0.0;
}
else
{
fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;
}
vec2 vParallaxOffset = vParallaxOffsetTS * (1 - fParallaxAmount );
texcoord = texcoord - vParallaxOffset;        

vLightTS = T * vLightTS.x + B * vLightTS.y + N * vLightTS.z;
vec2 vLightRayTS = vLightTS.xy * depthP;
// Compute the soft blurry shadows taking into account self-occlusion for
// features of the height field:
float sh0 = texture2D( LW_DIFFUSE, texcoord).a;
//float sh7 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.55).a - sh0 - 0.55 ) * 6;
//float sh6 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.44).a - sh0 - 0.44 ) * 8;
//float sh5 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.33).a - sh0 - 0.33 ) * 10;
//float sh4 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.22).a - sh0 - 0.22 ) * 12;
// Compute the actual shadow strength:
//fOcclusionShadow = 1 - max( max( max(  sh7, sh6 ), sh5 ), sh4 );
// The previous computation overbrightens the image, let's adjust for that:
//fOcclusionShadow = fOcclusionShadow* .1+.45;

//diffuse *= fOcclusionShadow;


#endif

#ifdef LW_DIFFUSE2
	vec4 diffuse2 = texture2D(LW_DIFFUSE2,texcoord);
	diffuse = vec4(1);
#endif	

#ifdef LW_DIFFUSE
	diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow;
#endif

#ifdef LW_ALPHATEST
	if (diffuse.w<0.5) {
		discard;
	}
#endif


normal = N;

#ifdef LW_BUMPMAP

	#ifdef LW_TERRAINNORMALS
		//Use terrain normals
		terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
		terrainresolution = terrainsize / terrainscale.x;
		terraincoord += 0.5 / terrainresolution;
		vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
		normal = normalize(gl_NormalMatrix*worldNormal);
	#else
		vec4 bumpcolor = texture2D(LW_BUMPMAP,texcoord);
		normal = bumpcolor.xyz * 2.0 - 1.0;
	#endif

	#ifdef LW_DETAIL
		normal += texture2D(LW_DETAIL,texcoord * 4.0).xyz * 2.0 - 1.0;
	#endif
	normal.z /= bumpscale;
	normal = T * normal.x + B * normal.y + N * normal.z;
	normal = normalize(normal);
	#ifdef LW_SPECULAR
		shininess = bumpcolor.a*specular;//*fOcclusionShadow
	#endif
	#ifdef LW_SPECULARMAP
		shininess = texture2D(LW_SPECULARMAP,texcoord).x*specular;//*fOcclusionShadow
	#endif

#else
	normal=normalize(normal);
#endif

#ifdef LW_BUMPMAP2
	vec3 normal2;
	float shininess2;

	vec4 bumpcolor2 = texture2D(LW_BUMPMAP2,texcoord);
	normal2 = bumpcolor2.xyz * 2.0 - 1.0;

	normal2.z /= bumpscale;
	normal2 = T * normal2.x + B * normal2.y + N * normal2.z;
	normal2 = normalize(normal2);
	#ifdef LW_SPECULAR
		shininess2 = bumpcolor2.a*specular;
	#endif

#endif	

#ifdef LW_TERRAINNORMALS
	#ifndef LW_BUMPMAP
		//Use terrain normals
		terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
		terrainresolution = terrainsize / terrainscale.x;
		terraincoord.x -= 0.5 / terrainresolution;
		//vec4 normsample=((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
		vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
		normal = normalize(gl_NormalMatrix*worldNormal);
		//shininess = normsample.w;
	#endif
#endif

#ifdef LW_TERRAINCOLOR
	//Use terrain color
	terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
	terrainresolution = terrainsize / terrainscale.x;
	terraincoord.x -= 0.5 / terrainresolution;
	//terraincoord.y += 0.5 / terrainresolution;
	vec4 terraincolor = texture2D(texture12,terraincoord);
	diffuse = vec4( greyscale(diffuse.xyz) * 2.0 * terraincolor.xyz,diffuse.w);

	#ifdef LW_MESHLAYER
		float temp_w=diffuse.w;
		diffuse = diffuse * (1.0-vegetationfade) + terraincolor * vegetationfade;
		diffuse.w=temp_w;
	#endif

	shininess = terraincolor.w;
#endif

#ifdef LE_REFRACTION
	diffuse.a=0.25;
	vec4 refractionvector = vec4( gl_FragCoord.x/buffersize.x, gl_FragCoord.y/buffersize.y, gl_FragCoord.z, 1.0 );
	vec4 refractionvector2 = refractionvector + refractionstrength * vec4(normal,0.0);		
	if (gl_FragCoord.z<DepthToZPosition(texture2DProj(LE_DEPTHBUFFER,refractionvector2).x)) {
		refractionvector=refractionvector2;
	}
	vec4 transparency = texture2DProj(LE_REFRACTION,refractionvector);
	diffuse = transparency * diffuse;
#endif

vec3 adjustednormal = normal*0.5+0.5;
float adjustedgloss = gloss;

shininess=clamp(shininess,0,1)*0.5;

#ifdef LW_BUMPMAP2
	shininess = fragcolor.r * shininess + (1.0-fragcolor.r) * shininess2;
	normal = fragcolor.r * normal + (1.0-fragcolor.r) * normal2;
#endif

#ifdef LW_DIFFUSE2
	diffuse = fragcolor.r * diffuse + (1.0-fragcolor.r) * diffuse2;
#endif	

//Diffuse
gl_FragData[0] = diffuse;	

//Normal
#ifdef LW_FULLBRIGHT
	gl_FragData[1] = vec4(1.0,1.0,1.0,diffuse.w);
#else
	gl_FragData[1] = vec4(adjustednormal,diffuse.w);
#endif

//Bloom
#ifdef LW_BLOOM
	vec4 bloomcolor = texture2D(LW_BLOOM,texcoord) * fragcolor;
	gl_FragData[3] = bloomcolor;
	gl_FragData[3].w = 1.0;
#else
	#ifdef LW_GIMAP
		vec4 gicolor = texture2D(LW_GIMAP,vec2(texcoord1.x,1.0-texcoord1.y));

		//We're going to clamp the results to prevent overbrightening when the lightmap environment doesn't match the dynamic lighting
		//float gilum = gicolor.r * 0.3 + gicolor.g * 0.59 + gicolor.b * 0.11;
		//float giscale = clamp(gilum,0,0.1) / gilum;
		//gicolor.x *= giscale;
		//gicolor.y *= giscale;
		//gicolor.z *= giscale;
		gicolor *= diffuse;
		gicolor.w = 0.0;
		gl_FragData[3] = gicolor;
	#else
		#ifdef LW_VERTEXGI
			gl_FragData[3] = fragcolor * diffuse;
			gl_FragData[3].w = 0.0;
		#else
			gError: Failed to link shader program.
Vertex info
-----------
(0) : error C6007: Constant register limit exceeded; more than 1024 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 1024 constant registers needed to compiled program
Vert source:
#version 120
#define LW_MAX_PASS_SIZE 1024
#define LW_INSTANCED
#define LW_SM4 
#define LW_DIFFUSE texture0
#define LW_BUMPMAP texture1
uniform vec3 terrainscale;
uniform sampler2D texture15;
uniform float terrainsize;
float GetTerrainHeight( in vec2 position ) {
float terrainresolution = terrainsize/terrainscale.x;
vec2 texcoord;
float pixelsize = 1.0 / terrainresolution;
texcoord = position.xy / terrainsize + 0.5;
texcoord += 0.5 * pixelsize;
return texture2D( texture15, texcoord ).x * terrainscale.y;
}
//uniform mat4 meshmatrix;
uniform vec2 meshlayeroffset;
uniform float meshlayerscale;
uniform float meshlayersize;
uniform float meshlayersectorsize;
uniform float instancepasssize;
uniform sampler2D texture10;
#ifdef LW_INSTANCED
#ifndef LW_SKIN
	#extension GL_EXT_gpu_shader4 : enable
	//#extension GL_EXT_bindable_uniform : enable
	//bindable uniform mat4 instancematrix[ LW_MAX_PASS_SIZE ];
	uniform mat4 instancematrix[ LW_MAX_PASS_SIZE ];
#else
	uniform mat4 animmatrix[69];
	uniform mat4 instancematrix[1];
#endif
#else
uniform mat4 instancematrix[1];
#endif
#ifdef LW_SKIN
attribute vec4 boneindices;
uniform float bonecount;
mat4 GetAnimMatrix( in int i ) {
return animmatrix[i];
/*
mat4 mat;
float f=i;
f+=0.5;

mat[0]=texture2D(texture10,vec2( 0.5/64.0, f/bonecount ));
mat[1]=texture2D(texture10,vec2( 1.5/64.0, f/bonecount ));
mat[2]=texture2D(texture10,vec2( 2.5/64.0, f/bonecount ));
mat[3]=texture2D(texture10,vec2( 3.5/64.0, f/bonecount ));		
return mat;*/
}
#endif
uniform float apptime;
uniform vec2 buffersize;
uniform float meshlayerrange;
uniform float meshlayerheight;
uniform vec3 cameraposition;
uniform float camerazoom;
uniform float vegetationviewdistance;
uniform float vegetationheight;
varying vec3 T,B,N;
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec3 cubecoord;
varying vec3 vertexposition;
varying vec4 modelvertex;
varying vec4 projectionspace;
varying vec4 refractionspace;
varying vec4 fragcolor;
#ifdef LW_PARALLAXMAP
varying vec3 eyevec;
#endif
#ifdef LW_MESHLAYER
varying float vegetationfade;
#endif
void main(void) {

vec4 vertexcameraposition;

mat4 mat;
vec4 color;
#ifdef LW_SKIN
//mat=meshmatrix;
mat=instancematrix[0];
#else
#ifdef LW_INSTANCED
	mat=instancematrix[ gl_InstanceID ];

	/*
	float f=gl_InstanceID;
	f+=0.5;
	mat[0]=texture2D(texture10,vec2(0.5/64.0,f/instancepasssize));
	mat[1]=texture2D(texture10,vec2(1.5/64.0,f/instancepasssize));
	mat[2]=texture2D(texture10,vec2(2.5/64.0,f/instancepasssize));
	mat[3]=texture2D(texture10,vec2(3.5/64.0,f/instancepasssize));
	*/
#else
	mat=instancematrix[0];//meshmatrix;
#endif

#endif
color.x=mat[0][3];
color.y=mat[1][3];
color.z=mat[2][3];
color.w=mat[3][3];
mat[0][3]=0.0;
mat[1][3]=0.0;
mat[2][3]=0.0;
mat[3][3]=1.0;

fragcolor = gl_Color*color;

modelvertex = gl_Vertex;

#ifdef LW_SKIN
	fragcolor=color;
	mat  = GetAnimMatrix( int(boneindices[0]) ) * gl_Color[0];
	mat += GetAnimMatrix( int(boneindices[1]) ) * gl_Color[1];
	mat += GetAnimMatrix( int(boneindices[2]) ) * gl_Color[2];
	mat += GetAnimMatrix( int(boneindices[3]) ) * gl_Color[3];
	/*
	mat = animmatrix[ int(boneindices[0]) ] * gl_Color[0];
	mat += animmatrix[ int(boneindices[1]) ] * gl_Color[1]; 
	mat += animmatrix[ int(boneindices[2]) ] * gl_Color[2];
	mat += animmatrix[ int(boneindices[3]) ] * gl_Color[3];
	*/
#endif

mat3 nmat = mat3(mat[0].xyz,mat[1].xyz,mat[2].xyz);

#ifdef LW_MESHLAYER
	mat[3].y=0.0;
#endif

modelvertex = mat * modelvertex;

#ifdef LW_MESHLAYER
	//Align to terrain height
	modelvertex.y += GetTerrainHeight(modelvertex.xz);
	//Sink into ground with distance
	float mld = length(modelvertex.xyz - cameraposition )/vegetationviewdistance;
	//mld += abs(mat[3].x-int(mat[3].x)) * 0.25;
	vegetationfade=mld;
	mld = clamp( (mld-0.75)*4.0, 0.0, 1.0 );
	modelvertex.y -= mld * vegetationheight;
#endif
#ifdef LW_SWAY
	float seed = mod(apptime / 100.0 * 0.25,360.0);
	seed += mat[3].x*33.0 + mat[3].y*67.8 + mat[3].z*123.5;
	seed += gl_Vertex.x + gl_Vertex.y + gl_Vertex.z;
	vec4 movement = vec4( vec3( gl_Color.x * gl_Normal * LW_SWAY * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);		
	modelvertex += movement;
	fragcolor = color;
#endif
vertexposition = modelvertex.xyz;
vertexcameraposition = gl_ModelViewProjectionMatrix * modelvertex;		
texcoord0=gl_MultiTexCoord0.xy;
texcoord1=gl_MultiTexCoord1.xy;

#ifdef LW_CUBEMAP
	cubecoord = modelvertex.xyz - CameraPosition;
	cubecoord = reflect( cubeCoord , normalize(nmat * gl_Normal) );
#endif
l_FragData[3] = vec4(0,0,0,1);
		#endif
	#endif
#endif



//Modify depth output for shadows
#ifdef LW_POMMAP
	float z = DepthToZPosition(gl_FragCoord.z);
	z = z -diffuse.a * fparallaxlength * depthP;
	gl_FragDepth = ZPositionToDepth( z );
#endif

gl_FragData[2]=vec4(shininess,gloss,0.0,diffuse.w);

/*
float c;
float temp;
temp=adjustednormal.x*100.0;
c=int(temp);
temp=adjustednormal.y*100.0;
c+=int(temp)/100.0;
temp=adjustednormal.z*100.0;
c+=int(temp)/100.0/100.0;
gl_FragData[1].x = c;
*/
}


nmat = gl_NormalMatrix * nmat;

N = normalize( nmat * gl_Normal );
#ifdef LW_BUMPMAP
	T = normalize( nmat * gl_MultiTexCoord2.xyz );		
	B = normalize( nmat * gl_MultiTexCoord3.xyz );
#endif

gl_Position = vertexcameraposition;

#ifdef __GLSL_CG_DATA_TYPES
	gl_ClipVertex = gl_ModelViewMatrix * modelvertex;
#endif
#ifdef LW_PARALLAXMAP
	modelvertex = gl_ModelViewMatrix * modelvertex;
	mat3 TBN_Matrix;
    	TBN_Matrix[0] = T;
	TBN_Matrix[1] = B;
	TBN_Matrix[2] = N;
	eyevec = vec3(-modelvertex) * TBN_Matrix;
//		modelvertex = gl_ModelViewMatrix * modelvertex;
//		EyeVec = vec3(dot(T,-modelvertex), dot(B,-modelvertex), dot(N,-modelvertex));
#endif

}
Frag source:
#version 120
#define LW_MAX_PASS_SIZE 1024
#define LW_INSTANCED
#define LW_SM4 
#define LW_DIFFUSE texture0
#define LW_BUMPMAP texture1
#define LW_SPECULAR
#extension GL_ARB_draw_buffers : enable
uniform vec3 cameraposition;
uniform vec2 buffersize;
uniform vec2 camerarange;
float greyscale( in vec3 color ) {
return color.x * 0.3 + color.y * 0.59 + color.z * 0.11;
}
float DepthToZPosition(in float depth) {
return camerarange.x / (camerarange.y - depth * (camerarange.y - camerarange.x)) * camerarange.y;
}
float ZPositionToDepth(in float z) {
return (camerarange.x / (z / camerarange.y) - camerarange.y) / -(camerarange.y - camerarange.x);
}
#ifdef LW_DETAIL
uniform sampler2D LW_DETAIL;
#endif
#ifdef LW_DIFFUSE
uniform sampler2D LW_DIFFUSE;
#endif
#ifdef LW_DIFFUSE2
uniform sampler2D LW_DIFFUSE2;
#endif
#ifdef LW_SPECULARMAP
uniform sampler2D LW_SPECULARMAP;
#endif
#ifdef LW_BUMPMAP
uniform sampler2D LW_BUMPMAP;
#endif
#ifdef LW_BUMPMAP2
uniform sampler2D LW_BUMPMAP2;
#endif
#ifdef LW_BLOOM
uniform sampler2D LW_BLOOM;
#endif
#ifdef LW_CUBEMAP
uniform samplerCube LW_CUBEMAP;
#endif
#ifdef LW_GIMAP
uniform sampler2D LW_GIMAP;
#endif
#ifdef LW_PARALLAXMAP
uniform sampler2D LW_PARALLAXMAP;
varying vec3 eyevec;
#endif
#ifdef LE_REFRACTION
uniform sampler2D LE_REFRACTION;
uniform sampler2D LE_DEPTHBUFFER;
uniform float refractionstrength = 0.01;
#endif
#ifdef LW_POMMAP
vec3 vLightTS=vec3(0.577,0.577,0.577);
varying vec3 eyevec;
float depthP = 0.01;
float nMinSamples = 20;
float nMaxSamples = 50;	
#endif
#ifdef LW_MESHLAYER
varying float vegetationfade;
#endif
#ifdef LW_ALPHABLEND
uniform sampler2D LW_ALPHABLEND_INCOMINGCOLOR;
uniform sampler2D LW_ALPHABLEND_INCOMINGNORMAL;
#endif
varying vec3 vertexposition;
varying vec3 T,B,N;
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec3 cubecoord;
varying vec4 modelvertex;
varying vec4 fragcolor;
float fOcclusionShadow = 1.0;
uniform sampler2D texture14;
uniform float terrainsize;
uniform vec3 terrainscale;
uniform float bumpscale;
uniform float specular;
uniform float gloss;
//Terrain color map
uniform sampler2D texture12;
void main(void) {

vec4 diffuse = fragcolor;
vec3 normal;
float shininess = 0.0;
vec2 texcoord=texcoord0;// only use this because of parallax mapping
float selfillumination = 0.0;	
vec2 terraincoord;
float terrainresolution;

#ifdef LW_VERTEXGI
	diffuse = vec4(1);
#endif

#ifdef LW_PARALLAXMAP
	texcoord += (diffuse.w * 0.04 - 0.036) * normalize(eyevec).xy;
	//texcoord += (texture2D(LW_DIFFUSE,texcoord).w * 0.04 - 0.036) * normalize(eyevec).xy;
#endif

#ifdef LW_POMMAP
	// for POM, the heightmap is in the alpha of the diffuse so save ur diffuse with DXT5 I chose this because the alpha of DXT5 is higher precision
// from Microsoft's and Ati's implementation thank them for the source 
// Compute the ray direction for intersecting the height field profile with 
// current view ray. See the above paper for derivation of this computation. (Ati's comment)

// Compute initial parallax displacement direction: (Ati's comment)
vec2 vparallaxdirection = normalize(eyevec).xy;

// The length of this vector determines the furthest amount of displacement: (Ati's comment)
float flength         = length( eyevec );
float fparallaxlength = sqrt( flength * flength - eyevec.z * eyevec.z ) / eyevec.z; 

// Compute the actual reverse parallax displacement vector: (Ati's comment)
vec2 vParallaxOffsetTS = vparallaxdirection * fparallaxlength;

// Need to scale the amount of displacement to account for different height ranges
// in height maps. This is controlled by an artist-editable parameter: (Ati's comment)
vParallaxOffsetTS *= depthP; 

int nNumSamples;
nNumSamples = int((mix( nMinSamples, nMaxSamples, 1-dot( vparallaxdirection, N.xy ) )));	//In reference shader: int nNumSamples = (int)(lerp( nMinSamples, nMaxSamples, dot( eyeDirWS, N ) ));
float fStepSize = 1.0 / float(nNumSamples);	
float fCurrHeight = 0.0;
float fPrevHeight = 1.0;
float fNextHeight = 0.0;
int    nStepIndex = 0;
vec2 vTexOffsetPerStep = fStepSize * vParallaxOffsetTS;
vec2 vTexCurrentOffset = texcoord.xy;
float  fCurrentBound     = 1.0;
float  fParallaxAmount   = 0.0;
vec2 pt1 = vec2(0,0);
vec2 pt2 = vec2(0,0);	    

while ( nStepIndex < nNumSamples ) 
{
vTexCurrentOffset -= vTexOffsetPerStep;
// Sample height map which in this case is stored in the alpha channel of the normal map: (Ati's comment)
fCurrHeight = texture2D( LW_DIFFUSE, vTexCurrentOffset).a; 
fCurrentBound -= fStepSize;
if ( fCurrHeight > fCurrentBound ) 
{   
   pt1 = vec2( fCurrentBound, fCurrHeight );
   pt2 = vec2( fCurrentBound + fStepSize, fPrevHeight );
   nStepIndex = nNumSamples + 1;	//Exit loop
   fPrevHeight = fCurrHeight;
}
else
{
   nStepIndex++;
   fPrevHeight = fCurrHeight;
}
} 
float fDelta2 = pt2.x - pt2.y;
float fDelta1 = pt1.x - pt1.y;

float fDenominator = fDelta2 - fDelta1;

// SM 3.0 requires a check for divide by zero, since that operation will generate
// an 'Inf' number instead of 0, as previous models (conveniently) did: (Ati's comment)
if ( fDenominator == 0.0 )
{
fParallaxAmount = 0.0;
}
else
{
fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;
}
vec2 vParallaxOffset = vParallaxOffsetTS * (1 - fParallaxAmount );
texcoord = texcoord - vParallaxOffset;        
vLightTS = T * vLightTS.x + B * vLightTS.y + N * vLightTS.z;
vec2 vLightRayTS = vLightTS.xy * depthP;
// Compute the soft blurry shadows taking into account self-occlusion for
// features of the height field:
float sh0 = texture2D( LW_DIFFUSE, texcoord).a;
//float sh7 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.55).a - sh0 - 0.55 ) * 6;
//float sh6 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.44).a - sh0 - 0.44 ) * 8;
//float sh5 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.33).a - sh0 - 0.33 ) * 10;
//float sh4 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.22).a - sh0 - 0.22 ) * 12;
// Compute the actual shadow strength:
//fOcclusionShadow = 1 - max( max( max(  sh7, sh6 ), sh5 ), sh4 );
// The previous computation overbrightens the image, let's adjust for that:
//fOcclusionShadow = fOcclusionShadow* .1+.45;
//diffuse *= fOcclusionShadow;
#endif
#ifdef LW_DIFFUSE2
	vec4 diffuse2 = texture2D(LW_DIFFUSE2,texcoord);
	diffuse = vec4(1);
#endif	

#ifdef LW_DIFFUSE
	diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow;
#endif
#ifdef LW_ALPHATEST
	if (diffuse.w<0.5) {
		discard;
	}
#endif
normal = N;

#ifdef LW_BUMPMAP
	#ifdef LW_TERRAINNORMALS
		//Use terrain normals
		terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
		terrainresolution = terrainsize / terrainscale.x;
		terraincoord += 0.5 / terrainresolution;
		vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
		normal = normalize(gl_NormalMatrix*worldNormal);
	#else
		vec4 bumpcolor = texture2D(LW_BUMPMAP,texcoord);
		normal = bumpcolor.xyz * 2.0 - 1.0;
	#endif

	#ifdef LW_DETAIL
		normal += texture2D(LW_DETAIL,texcoord * 4.0).xyz * 2.0 - 1.0;
	#endif
	normal.z /= bumpscale;
	normal = T * normal.x + B * normal.y + N * normal.z;
	normal = normalize(normal);
	#ifdef LW_SPECULAR
		shininess = bumpcolor.a*specular;//*fOcclusionShadow
	#endif
	#ifdef LW_SPECULARMAP
		shininess = texture2D(LW_SPECULARMAP,texcoord).x*specular;//*fOcclusionShadow
	#endif

#else
	normal=normalize(normal);
#endif
#ifdef LW_BUMPMAP2
	vec3 normal2;
	float shininess2;

	vec4 bumpcolor2 = texture2D(LW_BUMPMAP2,texcoord);
	normal2 = bumpcolor2.xyz * 2.0 - 1.0;

	normal2.z /= bumpscale;
	normal2 = T * normal2.x + B * normal2.y + N * normal2.z;
	normal2 = normalize(normal2);
	#ifdef LW_SPECULAR
		shininess2 = bumpcolor2.a*specular;
	#endif

#endif	

#ifdef LW_TERRAINNORMALS
	#ifndef LW_BUMPMAP
		//Use terrain normals
		terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
		terrainresolution = terrainsize / terrainscale.x;
		terraincoord.x -= 0.5 / terrainresolution;
		//vec4 normsample=((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
		vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
		normal = normalize(gl_NormalMatrix*worldNormal);
		//shininess = normsample.w;
	#endif
#endif
#ifdef LW_TERRAINCOLOR
	//Use terrain color
	terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
	terrainresolution = terrainsize / terrainscale.x;
	terraincoord.x -= 0.5 / terrainresolution;
	//terraincoord.y += 0.5 / terrainresolution;
	vec4 terraincolor = texture2D(texture12,terraincoord);
	diffuse = vec4( greyscale(diffuse.xyz) * 2.0 * terraincolor.xyz,diffuse.w);
	#ifdef LW_MESHLAYER
		float temp_w=diffuse.w;
		diffuse = diffuse * (1.0-vegetationfade) + terraincolor * vegetationfade;
		diffuse.w=temp_w;
	#endif
	shininess = terraincolor.w;
#endif

#ifdef LE_REFRACTION
	diffuse.a=0.25;
	vec4 refractionvector = vec4( gl_FragCoord.x/buffersize.x, gl_FragCoord.y/buffersize.y, gl_FragCoord.z, 1.0 );
	vec4 refractionvector2 = refractionvector + refractionstrength * vec4(normal,0.0);		
	if (gl_FragCoord.z<DepthToZPosition(texture2DProj(LE_DEPTHBUFFER,refractionvector2).x)) {
		refractionvector=refractionvector2;
	}
	vec4 transparency = texture2DProj(LE_REFRACTION,refractionvector);
	diffuse = transparency * diffuse;
#endif

vec3 adjustednormal = normal*0.5+0.5;
float adjustedgloss = gloss;

shininess=clamp(shininess,0,1)*0.5;

#ifdef LW_BUMPMAP2
	shininess = fragcolor.r * shininess + (1.0-fragcolor.r) * shininess2;
	normal = fragcolor.r * normal + (1.0-fragcolor.r) * normal2;
#endif
#ifdef LW_DIFFUSE2
	diffuse = fragcolor.r * diffuse + (1.0-fragcolor.r) * diffuse2;
#endif	

//Diffuse
gl_FragData[0] = diffuse;	
//Normal
#ifdef LW_FULLBRIGHT
	gl_FragData[1] = vec4(1.0,1.0,1.0,diffuse.w);
#else
	gl_FragData[1] = vec4(adjustednormal,diffuse.w);
#endif

//Bloom
#ifdef LW_BLOOM
	vec4 bloomcolor = texture2D(LW_BLOOM,texcoord) * fragcolor;
	gl_FragData[3] = bloomcolor;
	gl_FragData[3].w = 1.0;
#else
	#ifdef LW_GIMAP
		vec4 gicolor = texture2D(LW_GIMAP,vec2(texcoord1.x,1.0-texcoord1.y));

		//We're going to clamp the results to prevent overbrightening when the lightmap environment doesn't match the dynamic lighting
		//float gilum = gicolor.r * 0.3 + gicolor.g * 0.59 + gicolor.b * 0.11;
		//float giscale = clamp(gilum,0,0.1) / gilum;
		//gicolor.x *= giscale;
		//gicolor.y *= giscale;
		//gicolor.z *= giscale;
		gicolor *= diffuse;
		gicolor.w = 0.0;
		gl_FragData[3] = gicolor;
	#else
		#ifdef LW_VERTEXGI
			gl_FragData[3] = fragcolor * diffuse;
			gl_FragData[3].w = 0.0;
		#else
			gl_FragData[3] = vec4(0,0,0,1);
		#endif
	#endif
#endif

//Modify depth output for shadows
#ifdef LW_POMMAP
	float z = DepthToZPosition(gl_FragCoord.z);
	z = z -diffuse.a * fparallaxlength * depthP;
	gl_FragDepth = ZPositionToDepth( z );
#endif

gl_FragData[2]=vec4(shininess,gloss,0.0,diffuse.w);

/*
float c;
float temp;
temp=adjustednormal.x*100.0;
c=int(temp);
temp=adjustednormal.y*100.0;
c+=int(temp)/100.0;
temp=adjustednormal.z*100.0;
c+=int(temp)/100.0/100.0;
gl_FragData[1].x = c;
*/
}

Process complete

Posted

Thats from the wizard template program?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

There seems to be an issue with picks as well.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

did you do a clean install for 2.32 ?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

yeah, I know what you mean m8.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

Ahhh wait got it working :blink:

 

Ok i ran the wizard , it created a directory on my desktop called MyGame.

 

I then copied MyGame.bmx into the root of c:\LWE-2.32 , double clicked MyGame.bmx , BMax opened up.

 

I clicked build and it ran fine.

 

So maybe its a problem with path's ???(abstract path ??)

 

Thanks

Gimpy73 :rolleyes:

Posted

could be, sounds like it. I just used your point and pick code, camerapick "seems" to work but EntityPick crashes the apps and emitters seem all screwed up ..

 

post-12-12734851260151_thumb.jpg

 

So I can see myself rolling back to 2.31 in a short while.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Posted

No problems Gimpy always happy to try and help, but I am rolling back. Thank the big bang for backups huh. Even scripted entites in the editor seem to be non functional.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...