Commit 0ed2143e authored by Teemu Tamminen's avatar Teemu Tamminen

Added Island shader example

parent fd0d5c70
<?xml version='1.0' encoding='utf-8'?>
<application xmlns="http://qt.io/qt3dstudio/uia">
<assets initial="3d_presentation">
<presentation id="3d_presentation" src="presentations/3d_presentation.uip"/>
<dataInput metadata="" name="caustics" type="Float"/>
<dataInput metadata="" name="glasslightx" type="Ranged Number" min="-1000" max="1000"/>
<dataInput metadata="" name="lightx" type="Float"/>
<dataInput metadata="" name="time" type="Float"/>
<dataInput metadata="" name="windpower" type="Float"/>
<presentation id="LightProbe" src="presentations/LightProbe.uip"/>
</assets>
</application>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<MaterialData version="1.0">
<Property name="lightx">1</Property>
<Property name="windpower">1</Property>
<Property name="colormap" type="Texture"><![CDATA[./maps/plantLeaf.png]]></Property>
<Property name="xoffset">0.2</Property>
<Property name="yoffset">0.2</Property>
<Property name="zoffset">0.2</Property>
<Property name="mask">0.2</Property>
<Property name="sourcepath"><![CDATA[./materials/treeLeaves.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/Bush]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/Bush.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<MaterialData version="1.0">
<Property name="uEnvironmentTexture" type="Texture"><![CDATA[./presentations/LightProbe]]></Property>
<Property name="uEnvironmentMappingEnabled">True</Property>
<Property name="uBakedShadowTexture"></Property>
<Property name="uShadowMappingEnabled">False</Property>
<Property name="uFresnelPower">5.9</Property>
<Property name="roughness">0.23</Property>
<Property name="reflectivity_amount">0.44</Property>
<Property name="glass_ior">1</Property>
<Property name="glass_color">1 1 1 1</Property>
<Property name="glass_bump" type="Texture"><![CDATA[./maps/WaterNormal.jpg]]></Property>
<Property name="glass_bfactor">9</Property>
<Property name="glass_binside">False</Property>
<Property name="blur_size">22.07</Property>
<Property name="randomGradient1D" type="Texture"><![CDATA[./maps/materials/randomGradient1D.png]]></Property>
<Property name="randomGradient2D" type="Texture"><![CDATA[./maps/materials/randomGradient2D.png]]></Property>
<Property name="randomGradient3D" type="Texture"><![CDATA[./maps/materials/randomGradient3D.png]]></Property>
<Property name="randomGradient4D" type="Texture"><![CDATA[./maps/materials/randomGradient4D.png]]></Property>
<Property name="refract_depth">12.8</Property>
<Property name="bumpCoords">1 1 1</Property>
<Property name="bumpScale">1.25</Property>
<Property name="bumpBands">1</Property>
<Property name="intLightPos">0.5 0</Property>
<Property name="intLightCol">0.9 0.9 0.9 1</Property>
<Property name="intLightBrt">0</Property>
<Property name="intLightRot">0</Property>
<Property name="intLightFall">2</Property>
<Property name="sourcepath"><![CDATA[./materials/thin_glass_frosted.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/Glass]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/Glass.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<MaterialData version="1.0">
<Property name="lightx">1</Property>
<Property name="windpower">1</Property>
<Property name="grass" type="Texture"><![CDATA[./maps/grass.jpg]]></Property>
<Property name="rock" type="Texture"><![CDATA[./maps/rock.jpg]]></Property>
<Property name="sand" type="Texture"><![CDATA[./maps/sand.jpg]]></Property>
<Property name="caustics" type="Texture"><![CDATA[./maps/TexturesCom_Animated_WaterCaustics.png]]></Property>
<Property name="value">1</Property>
<Property name="row">6</Property>
<Property name="column">6</Property>
<Property name="sourcepath"><![CDATA[./materials/groundBlending.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/Ground]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/Ground.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<MaterialData version="1.0">
<Property name="lightx">1</Property>
<Property name="spacemap" type="Texture"><![CDATA[./maps/stars.jpg]]></Property>
<Property name="skymap" type="Texture"><![CDATA[./maps/sky.jpg]]></Property>
<Property name="cloudmap"></Property>
<Property name="sourcepath"><![CDATA[./materials/skybox.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/Sky]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/Sky.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<MaterialData version="1.0">
<Property name="lightx">1</Property>
<Property name="texturemap" type="Texture"><![CDATA[./maps/rock.jpg]]></Property>
<Property name="sourcepath"><![CDATA[./materials/stones.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/Stones]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/Stones.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<MaterialData version="1.0">
<Property name="time">1</Property>
<Property name="lightx">1</Property>
<Property name="windpower">1</Property>
<Property name="waveheight">0.3</Property>
<Property name="bottomheight">-0.5</Property>
<Property name="diffusemap" type="Texture"><![CDATA[./maps/WaterDiffuse.jpg]]></Property>
<Property name="caustics" type="Texture"><![CDATA[./.]]></Property>
<Property name="value">1</Property>
<Property name="row">6</Property>
<Property name="column">6</Property>
<Property name="foammap" type="Texture"><![CDATA[./.]]></Property>
<Property name="waveTexture" type="Texture"><![CDATA[./.]]></Property>
<Property name="near">8</Property>
<Property name="far">2000</Property>
<Property name="sourcepath"><![CDATA[./materials/water.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/Water]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/Water.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<Material name="blend" version="1.0">
<MetaData>
<Property formalName="Light X" name="lightx" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Wind Power" name="windpower" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Grass Texture" name="grass" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Rock Texture" name="rock" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Sand Texture" name="sand" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Caustics Map" name="caustics" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Value" name="value" type="Float" stage="vertex" default="1.0" category="Material" />
</MetaData>
<Shaders type="GLSL" version="330">
<Shader>
<VertexShader>
attribute vec3 attr_pos;
attribute vec2 attr_uv0;
attribute vec3 attr_color;
uniform mat4 modelViewProjection;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
out vec2 v_uv;
out vec3 v_col;
out vec4 v_color;
out vec4 gl_Position;
out float v_y;
out float v_light;
out vec2 v_coord0;
out vec2 v_coord1;
out float v_power;
out float v_value;
void main() {
float causticSize = 4*windpower;
v_power = windpower;
float floorV = floor(value);
float row = floor(floorV / 6) ;
float valueX = floorV - (6 * row) ;
v_coord0.x = (attr_uv0.x/causticSize) / 6 + valueX / 6;
v_coord0.y = (attr_uv0.y/causticSize) / 6 +((6 - row - 1.0) / 6);
float floorV2 = floor(value + 1.0);
float row2 = floor(floorV2 / 6) ;
float valueX2 = floorV2 - (6 * row2) ;
v_coord0.x = (attr_uv0.x/causticSize) / 6 + valueX2 / 6;
v_coord0.y = (attr_uv0.y/causticSize) / 6 +((6 - row2 - 1.0) / 6);
vec3 light_pos = vec3(lightx,250.0,-600.0);
mat4 modelview = viewMatrix * modelMatrix;
vec3 modelViewVertex = vec3(modelview * vec4(attr_pos,1.0));
vec3 modelViewNormal = vec3(modelview * vec4(attr_pos,0.0));
float distance = length(light_pos - modelViewVertex);
vec3 lightVector = normalize(light_pos - modelViewVertex);
float diffuse = max(dot(modelViewNormal, lightVector), 0.1);
diffuse = diffuse * (1.0 / (1.0 + (0.25 * distance )))*12.5;
v_light = clamp(diffuse,0.0,0.7);
diffuse = clamp(diffuse,0.3,0.9);
v_color = vec4(diffuse,diffuse,diffuse,1.0);
v_uv = attr_uv0;
v_col = attr_color;
v_y = attr_pos.z;
gl_Position = modelViewProjection * vec4(attr_pos, 1.0);
}
</VertexShader>
<FragmentShader>
in float v_y;
in vec2 v_uv;
in vec3 v_col;
in vec4 v_color;
in float v_light;
in float v_value;
in vec2 v_coord0;
in vec2 v_coord1;
in float v_power;
vec4 finalOutput;
out vec4 fragOutput;
void main() {
vec4 tex = texture(caustics, v_coord0);
vec4 tex2 = texture(caustics, v_coord1);
float blender = fract(v_value);
vec4 o_caustics = tex * (1.0 - blender) + tex2 * blender;
vec4 splatGrass = texture(grass,v_uv);
vec4 splatRock = texture(rock,v_uv);
vec4 splatSand = texture(sand,v_uv);
finalOutput = vec4(splatGrass.rgb*v_col.g,1.0);
finalOutput += vec4(splatRock.rgb*v_col.b,1.0);
finalOutput += vec4(splatSand.rgb*v_col.r,1.0);
vec4 f_caustics;
if(v_y > -0.25){
f_caustics = vec4(0.0,0.0,0.0,1.0);
}
else{
f_caustics = vec4(vec3((o_caustics.rgb*-v_y)*(1.6-v_power)),1.0);
}
vec4 ambient = vec4(0.7,0.8,1.0,1.0);
fragOutput = finalOutput*v_color + (ambient*0.2)+(f_caustics*v_light);
}
</FragmentShader>
</Shader>
</Shaders>
<Passes>
<Pass>
</Pass>
</Passes>
</Material>
<Material name="skybox" version="1.0">
<MetaData>
<Property formalName="Time" name="time" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Light X" name="lightx" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Space Texture" name="spacemap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Sky Texture" name="skymap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Cloud Texture" name="cloudmap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
</MetaData>
<Shaders type="GLSL" version="330">
<Shader>
<VertexShader>
attribute vec3 attr_pos;
attribute vec3 attr_color;
attribute vec2 attr_uv0;
uniform mat4 modelViewProjection;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
out float rotateTime;
out vec3 v_col;
out vec2 v_uv;
out vec4 v_color;
void main() {
vec3 light_pos = vec3(lightx,250.0,-600.0);
mat4 modelview = viewMatrix * modelMatrix;
vec3 modelViewVertex = vec3(modelview * vec4(attr_pos,1.0));
vec3 modelViewNormal = vec3(modelview * vec4(attr_pos,0.0));
float distance = length(light_pos - modelViewVertex);
vec3 lightVector = normalize(light_pos - modelViewVertex);
float diffuse = max(dot(modelViewNormal, lightVector), 0.1);
diffuse = diffuse * (1.0 / (1.0 + (0.25 * distance )))*2.5;
diffuse = clamp(diffuse,0.5,1.2);
v_color = vec4(diffuse,diffuse,diffuse,1.0);
v_uv = attr_uv0;
v_col = attr_color;
rotateTime = time;
gl_Position = modelViewProjection * vec4(attr_pos, 1.0);
}
</VertexShader>
<FragmentShader>
in float rotateTime;
in vec3 v_col;
in vec2 v_uv;
in vec4 v_color;
out vec4 fragOutput;
vec2 rotateUV(vec2 uv, float rot)
{
float mid = 0.5;
return vec2(
cos(rot) * (uv.x - mid) + sin(rot) * (uv.y - mid) + mid,
cos(rot) * (uv.y - mid) - sin(rot) * (uv.x - mid) + mid
);
}
void main() {
vec2 screenUV = (vec2(gl_FragCoord.x/1920,gl_FragCoord.y/1080)) / gl_FragCoord.z;
vec4 Spacetex = texture(spacemap,rotateUV(screenUV*2,rotateTime*0.01));
Spacetex += texture(spacemap,screenUV*3);
vec4 Skytex = texture(skymap,v_uv);
vec4 Cloudtex = texture(cloudmap,screenUV);
vec4 finalOutput = vec4(Spacetex.rgb*v_col.r,1.0);
finalOutput += vec4(Skytex.rgb*v_col.b,1.0);
finalOutput += vec4(Cloudtex.rgba*v_col.b);
fragOutput = finalOutput*v_color;
}
</FragmentShader>
</Shader>
</Shaders>
<Passes>
<Pass>
</Pass>
</Passes>
</Material>
<MaterialData version="1.0">
<Property name="shaderlighting">Pixel</Property>
<Property name="blendmode">Normal</Property>
<Property name="diffuse">1 1 1 1</Property>
<Property name="diffusemap"><![CDATA[./maps/stars.jpg]]></Property>
<Property name="specularamount">0</Property>
<Property name="specularroughness">0</Property>
<Property name="opacity">100</Property>
<Property name="emissivecolor">1 1 1 1</Property>
<Property name="emissivepower">0</Property>
<Property name="bumpamount">0.5</Property>
<Property name="displaceamount">20</Property>
<Property name="translucentfalloff">1</Property>
<Property name="diffuselightwrap">0</Property>
<Property name="specularmodel">Default</Property>
<Property name="speculartint">1 1 1 1</Property>
<Property name="ior">1.5</Property>
<Property name="fresnelPower">0</Property>
<Property name="vertexcolors">False</Property>
<Property name="sourcepath"></Property>
<Property name="importid"></Property>
<Property name="importfile">../maps/stars.jpg</Property>
<Property name="type">Material</Property>
<Property name="name"><![CDATA[materials/stars]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Island_ShaderExample/3d_presentation/materials/stars.materialdef]]></Property>
<TextureData name="diffusemap">
<Property name="scaleu">1</Property>
<Property name="scalev">1</Property>
<Property name="mappingmode">UV Mapping</Property>
<Property name="tilingmodehorz">No Tiling</Property>
<Property name="tilingmodevert">No Tiling</Property>
<Property name="rotationuv">0</Property>
<Property name="positionu">0</Property>
<Property name="positionv">0</Property>
<Property name="pivotu">0</Property>
<Property name="pivotv">0</Property>
<Property name="subpresentation"></Property>
<Property name="sourcepath"><![CDATA[./maps/stars.jpg]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">Image</Property>
<Property name="name"><![CDATA[Image]]></Property>
</TextureData>
</MaterialData>
\ No newline at end of file
<Material name="stones" version="1.0">
<MetaData>
<Property formalName="Light X" name="lightx" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Texture" name="texturemap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
</MetaData>
<Shaders type="GLSL" version="330">
<Shader>
<VertexShader>
attribute vec3 attr_pos;
attribute vec2 attr_uv0;
uniform mat4 modelViewProjection;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
out vec2 uv;
out vec4 gl_Position;
out vec4 v_color;
void main() {
uv = attr_uv0;
vec3 light_pos = vec3(lightx,250.0,-600.0);
mat4 modelview = viewMatrix * modelMatrix;
vec3 modelViewVertex = vec3(modelview * vec4(attr_pos,1.0));
vec3 modelViewNormal = vec3(modelview * vec4(attr_pos,0.0));
float distance = length(light_pos - modelViewVertex);
vec3 lightVector = normalize(light_pos - modelViewVertex);
float diffuse = max(dot(modelViewNormal, lightVector), 0.1);
diffuse = diffuse * (1.0 / (1.0 + (0.25 * distance )))*2.5;
diffuse = clamp(diffuse,0.3,0.9);
v_color = vec4(diffuse,diffuse,diffuse,1.0);
gl_Position = modelViewProjection * vec4(attr_pos, 1.0);
}
</VertexShader>
<FragmentShader>
in vec2 uv;
in vec4 v_color;
out vec4 fragOutput;
void main() {
vec4 uv_colorOutput = texture(texturemap,uv);
vec4 ambient = vec4(0.7,0.8,1.0,1.0);
fragOutput = uv_colorOutput*v_color+(ambient*0.2);
}
</FragmentShader>
</Shader>
</Shaders>
<Passes>
<Pass>
</Pass>
</Passes>
</Material>
<Material name="treeLeaves" version="1.0">
<MetaData>
<Property formalName="Light X" name="lightx" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Wind Power" name="windpower" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Color Map" name="colormap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="X" name="xoffset" type="Float" stage="vertex" default="0.2" category="Material" />
<Property formalName="Y" name="yoffset" type="Float" stage="vertex" default="0.2" category="Material" />
<Property formalName="Z" name="zoffset" type="Float" stage="vertex" default="0.2" category="Material" />
<Property formalName="Height mask" name="mask" type="Float" stage="vertex" default="0.2" category="Material" />
</MetaData>
<Shaders type="GLSL" version="330">
<Shader>
<VertexShader>
attribute vec3 attr_pos;
attribute vec2 attr_uv0;
attribute vec3 attr_color;
uniform mat4 modelViewProjection;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
out vec2 uv;
out vec4 gl_Position;
out vec4 v_color;
float green;
vec3 modpos;
void main() {
uv = attr_uv0;
green = attr_color.g;
vec3 light_pos = vec3(lightx,250.0,-600.0);
mat4 modelview = viewMatrix * modelMatrix;
vec3 modelViewVertex = vec3(modelview * vec4(attr_pos,1.0));
vec3 modelViewNormal = vec3(modelview * vec4(attr_pos,0.0));
float distance = length(light_pos - modelViewVertex);
vec3 lightVector = normalize(light_pos - modelViewVertex);
float diffuse = max(dot(modelViewNormal, lightVector), 0.5);
diffuse = diffuse * (1.0 / (1.0 + (0.25 * distance )))*2.5;
diffuse = clamp(diffuse,0.3,0.9);
v_color = vec4(diffuse,diffuse,diffuse,1.0);
if(attr_pos.z > mask){
modpos = vec3(attr_pos.x+((xoffset*attr_pos.z)*windpower),attr_pos.y+(yoffset*windpower),attr_pos.z+((zoffset*green)*windpower));
}
else{
modpos = attr_pos;
}
gl_Position = modelViewProjection * vec4(modpos, 1.0);
}
</VertexShader>
<FragmentShader>
in vec4 v_color;
in vec2 uv;
out vec4 fragOutput;
void main() {
vec4 uv_colorOutput = texture(colormap,uv);
vec4 ambient = vec4(0.7,0.8,1.0,uv_colorOutput.a);
fragOutput = vec4(uv_colorOutput)*vec4(v_color.r,v_color.g,v_color.b,uv_colorOutput.a)+(ambient*0.2);
}
</FragmentShader>
</Shader>
</Shaders>
<Passes>
<Pass>
<Blending source="SrcAlpha" dest="OneMinusSrcAlpha"/>
</Pass>
</Passes>
</Material>
<MaterialData version="1.0">
<Property name="colormap" type="Texture"><![CDATA[./maps/branch.png]]></Property>
<Property name="xoffset">0.2</Property>
<Property name="yoffset">0.2</Property>
<Property name="zoffset">0.2</Property>
<Property name="mask">0.2</Property>
<Property name="sourcepath"><![CDATA[./materials/treeLeaves.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/tree_branch]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Windy_Island/3d_presentation/materials/tree_branch.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<MaterialData version="1.0">
<Property name="colormap" type="Texture"><![CDATA[./maps/trunk.jpg]]></Property>
<Property name="xoffset">0.2</Property>
<Property name="yoffset">0.2</Property>
<Property name="zoffset">0.2</Property>
<Property name="mask">0.2</Property>
<Property name="sourcepath"><![CDATA[./materials/treeLeaves.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/tree_trunk]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Windy_Island/3d_presentation/materials/tree_trunk.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<Material name="water" version="1.0">
<MetaData>
<Property formalName="Time" name="time" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Light X" name="lightx" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Wind Power" name="windpower" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Wave Height" name="waveheight" type="Float" stage="vertex" default="0.2" category="Material" />
<Property formalName="Bottom Height" name="bottomheight" type="Float" stage="vertex" default="-0.5" category="Material" />
<Property formalName="Diffuse Texture" name="diffusemap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Caustics Map" name="caustics" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Row" name="row" type="Float" stage="vertex" default="6.0" category="Material" />
<Property formalName="Column" name="column" type="Float" stage="vertex" default="6.0" category="Material" />
<Property formalName="Foam Texture" name="foammap" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Wave Texture" name="waveTexture" type="Texture" filter="linear" clamp="repeat" category="Material"/>
<Property formalName="Near" name="near" type="Float" default="8.0" category="Material" />
<Property formalName="Far" name="far" type="Float" default="2000.0" category="Material" />
</MetaData>
<Shaders type="GLSL" version="330">
<Shader>
<VertexShader>
attribute vec3 attr_pos;
attribute vec3 attr_color;
attribute vec2 attr_uv0;
attribute vec4 attr_norm;
uniform mat4 modelViewProjection;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform vec3 eyePosition;
out float v_y;
out vec3 v_col;
out vec2 v_uv;
out vec3 v_pos;
out float v_power;
out vec4 v_color;
out float v_light;
out float v_lightx;
void main() {
v_lightx = lightx;
v_uv = attr_uv0;
v_col = attr_color;
v_power = windpower;
vec3 light_pos = vec3(lightx,250.0,-600.0);
mat4 modelview = viewMatrix * modelMatrix;
vec3 modelViewVertex = vec3(modelview * vec4(attr_pos,1.0));
vec3 modelViewNormal = vec3(modelview * vec4(attr_pos,0.0));
float distance = length(light_pos - modelViewVertex);
vec3 lightVector = normalize(light_pos - modelViewVertex);
float diffuse = max(dot(modelViewNormal, lightVector), 0.1);
diffuse = diffuse * (1.0 / (1.0 + (0.25 * distance )));
v_light = clamp(diffuse,0.65,0.85);
diffuse = clamp(diffuse,0.3,0.9);
v_color = vec4(diffuse,diffuse,diffuse,1.0);
v_pos = vec3(modelview * vec4(attr_pos,1.0));
float sinPos = (attr_pos.z*windpower*2)+(attr_pos.x*windpower);
sinPos += (time*(-10))*(0.4*windpower);
vec3 vertModCom = vec3(attr_pos.x,
attr_pos.y,