...
 
Commits (28)
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://qt.io/qt3dstudio/uia">
<assets initial="CoffeeMaker">
<presentation id="CoffeeMaker" src="CoffeeMaker.uip"/>
<presentation id="CoffeeMaker" src="presentations/CoffeeMaker.uip"/>
</assets>
<statemachine ref="#logic">
......
......@@ -15,20 +15,18 @@
void frag()
{
float radius = vig_radius;
vec4 origColor = texture2D_0(TexCoord);
vec2 uv = TexCoord.xy;
vec2 center = vec2(0.5);
vec4 bg = origColor;
uv *= 1.0 - uv.yx;
float vig = uv.x*uv.y * vig_strenght;
uv *= 1.0 - uv.yx;
float vig = uv.x * uv.y * vig_strenght;
vig = pow(vig, vig_radius);
vec4 vigmixcolor = vec4(vig_color,vig) * vec4(vig);
gl_FragColor = vec4(mix(origColor,vigmixcolor,1.0-vig));
vec4 vigColor = vec4(vig_color.xyz, vig) * vig;
gl_FragColor = mix(origColor, vigColor, 1.0 - vig);
}
]]></FragmentShader>
</Shader>
......
......@@ -10,7 +10,6 @@
<file alias="LightSlider.qml">qml/HomeAutom/LightSlider.qml</file>
<file alias="RoomLabel.qml">qml/HomeAutom/RoomLabel.qml</file>
<file alias="LightSwitch.qml">qml/HomeAutom/LightSwitch.qml</file>
<file>uip/houseStudio.uip</file>
<file>uip/maps/Ground.png</file>
<file>uip/maps/HouseGroundOpacitymap.png</file>
<file>uip/maps/HouseTexture.png</file>
......@@ -32,8 +31,6 @@
<file>uip/models/House/meshes/Windows.mesh</file>
<file>uip/models/House/House.import</file>
<file>uip/models/Light/Light.import</file>
<file>uip/House/meshes/house1.mesh</file>
<file>uip/House/meshes/roof1.mesh</file>
<file>uip/maps/BathroomLightmap.png</file>
<file>uip/maps/BedRoomLightmap.png</file>
<file>uip/maps/EntranceLightmap.png</file>
......@@ -51,5 +48,6 @@
<file>qml/imports/Style/qmldir</file>
<file>qml/imports/Style/Style.qml</file>
<file>uip/houseStudio.uia</file>
<file>uip/presentations/houseStudio.uip</file>
</qresource>
</RCC>
......@@ -12,7 +12,7 @@ KNX_BOARD {
CONFIG += c++11
}
QT += qml quick 3dstudioruntime2
QT += qml quick
CONFIG += resources_big
......
......@@ -59,7 +59,6 @@
#if defined(KNX_BACKEND)
#include "qmlknxdemo.h"
#endif
#include <q3dsruntimeglobal.h>
// Uncomment for 1280x900 window
//#define FIXEDWINDOW
......@@ -78,7 +77,15 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat());
#if defined(Q_OS_MACOS)
QSurfaceFormat openGLFormat;
openGLFormat.setRenderableType(QSurfaceFormat::OpenGL);
openGLFormat.setProfile(QSurfaceFormat::CoreProfile);
openGLFormat.setMajorVersion(4);
openGLFormat.setMinorVersion(1);
openGLFormat.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(openGLFormat);
#endif
// Define size variants for scaling
qreal refDpi = 96.;
......
......@@ -50,7 +50,7 @@
import QtQuick 2.8
import QtQuick.Controls 2.1
import QtStudio3D 2.0
import QtStudio3D.OpenGL 2.4
Item {
id: home
......@@ -220,7 +220,7 @@ Item {
}
}
onPresentationReady: {
onPresentationLoaded: {
home.studio3DPresentationReady();
}
}
......@@ -364,15 +364,18 @@ Item {
onRedColorChanged: {
home.red = redColor;
currentTempTarget.setValue(Qt.vector3d(redColor, home.green, home.blue));
if (currentTempTarget)
currentTempTarget.setValue(Qt.vector3d(redColor, home.green, home.blue));
}
onBlueColorChanged: {
home.blue = blueColor;
currentTempTarget.setValue(Qt.vector3d(home.red, home.green, blueColor));
if (currentTempTarget)
currentTempTarget.setValue(Qt.vector3d(home.red, home.green, blueColor));
}
onGreenColorChanged: {
home.green = greenColor;
currentTempTarget.setValue(Qt.vector3d(home.red, greenColor, home.blue));
if (currentTempTarget)
currentTempTarget.setValue(Qt.vector3d(home.red, greenColor, home.blue));
}
onEconomyChanged: {
......
<?xml version="1.0" encoding="UTF-8" ?>
<UIP Version="1" >
<Project Revision="1" >
<Graph >
<Group id="__import__root__" >
<Model id="Ground" name="Ground" orientation="Right Handed" position="-0.957248 -0.10826 -2.79746" rotation="0 -0 0" rotationorder="XYZr" scale="1.73739 1 1.00748" sourcepath=".\meshes\Ground.mesh#1" >
<Material id="phong1" name="phong1" blendmode="Normal" diffuse="0.233766 0.233766 0.233766" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="roof1" name="roof1" orientation="Right Handed" position="0 0 -0" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\roof1.mesh#1" >
<Material id="BaseWall" name="BaseWall" blendmode="Normal" diffuse="0.552284 0.552284 0.552284" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
<Material id="roof" name="roof" blendmode="Normal" diffuse="0.0609137 0.0609137 0.0609137" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
<Material id="lambert1" name="lambert1" blendmode="Normal" diffuse="1 1 1" emissivepower="0" opacity="100" specularamount="0" />
</Model>
<Group id="Group_HeatAreas" name="Group_HeatAreas" orientation="Right Handed" position="0 5.53285 -0" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" >
<Model id="Heat_MasterBedroom" name="Heat_MasterBedroom" orientation="Right Handed" position="-6.01453 0.0613521 -9.90316" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_MasterBedroom.mesh#1" >
<Material id="masterbedroomheat" name="masterbedroomheat" blendmode="Normal" diffuse="0.15472 0.15096 0.14256" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_Entrance" name="Heat_Entrance" orientation="Right Handed" position="0.0827332 1.40091 -12.9964" rotation="8.53363 -0 0" rotationorder="XYZr" scale="0.852158 1 0.900558" sourcepath=".\meshes\Heat_Entrance.mesh#1" >
<Material id="entrance" name="entrance" blendmode="Normal" diffuse="0.519797 0.519797 0.519797" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_BedRoom" name="Heat_BedRoom" orientation="Right Handed" position="6.03439 1.73831 -10.6134" rotation="7.55792 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_BedRoom.mesh#1" >
<Material id="bedroom" name="bedroom" blendmode="Normal" diffuse="0.24488 0.388 0.46264" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_DressRoom" name="Heat_DressRoom" orientation="Right Handed" position="8.02201 2.41339 -5.07462" rotation="8.34257 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_DressRoom.mesh#1" >
<Material id="dressroom" name="dressroom" blendmode="Normal" diffuse="0.714721 0.714721 0.714721" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_Toilet" name="Heat_Toilet" orientation="Right Handed" position="3.90588 2.58136 -5.05141" rotation="5.57327 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_Toilet.mesh#1" >
<Material id="toilet" name="toilet" blendmode="Normal" diffuse="0.19208 0.24752 0.37672" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_StoreRoom" name="Heat_StoreRoom" orientation="Right Handed" position="2.97044 0.814303 -17.1022" rotation="8.02365 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_StoreRoom.mesh#1" >
<Material id="storeroom" name="storeroom" blendmode="Normal" diffuse="0.166497 0.166497 0.166497" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_Sauna" name="Heat_Sauna" orientation="Right Handed" position="-7.99717 0.0613521 7.72293" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_Sauna.mesh#1" >
<Material id="sauna1" name="sauna1" blendmode="Normal" diffuse="0.24984 0.24984 0.24984" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_BathRoom" name="Heat_BathRoom" orientation="Right Handed" position="-8.61282 1.1588 -1.06378" rotation="0 -0 0" rotationorder="XYZr" scale="1.04514 1 1" sourcepath=".\meshes\Heat_BathRoom.mesh#1" >
<Material id="bathroom" name="bathroom" blendmode="Normal" diffuse="0.4 0.4 0.4" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="Heat_LivingRoom" name="Heat_LivingRoom" orientation="Right Handed" position="2.34465 3.80193 4.35739" rotation="7.88151 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Heat_LivingRoom.mesh#1" >
<Material id="livingroom" name="livingroom" blendmode="Normal" diffuse="0.24984 0.23336 0.16168" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
</Group>
<Group id="Group_house" name="Group_house" orientation="Right Handed" position="0 0 -0" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" >
<Model id="house1" name="house1" orientation="Right Handed" position="0 0 -0" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\house1.mesh#1" >
<Material id="house2" name="house2" blendmode="Normal" diffuse="1 1 1" diffusemap="house2_diffusemap" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" >
<Image id="house2_diffusemap" name="house2_diffusemap" sourcepath=".\maps\houseShape.png" />
</Material>
</Model>
</Group>
<Model id="Windows" name="Windows" orientation="Right Handed" position="0 0 -0" rotation="0 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\meshes\Windows.mesh#1" >
<Material id="Window" name="Window" blendmode="Normal" diffuse="0.35152 0.66672 0.74704" emissivepower="0" opacity="100" specularamount="0" specularroughness="12.1818" />
</Model>
</Group>
</Graph>
<Import SrcFile="..\..\House\House.fbx" ImageDir="Images" MeshDir="Meshes" >
<Image >
<Source >.\houseShape.png</Source>
<Dest >.\maps\houseShape.png</Dest>
</Image>
<Mesh >
<Source >Heat_BathRoom</Source>
<Dest >.\meshes\Heat_BathRoom.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_Sauna</Source>
<Dest >.\meshes\Heat_Sauna.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_BedRoom</Source>
<Dest >.\meshes\Heat_BedRoom.mesh</Dest>
</Mesh>
<Mesh >
<Source >Ground</Source>
<Dest >.\meshes\Ground.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_Toilet</Source>
<Dest >.\meshes\Heat_Toilet.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_StoreRoom</Source>
<Dest >.\meshes\Heat_StoreRoom.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_LivingRoom</Source>
<Dest >.\meshes\Heat_LivingRoom.mesh</Dest>
</Mesh>
<Mesh >
<Source >house1</Source>
<Dest >.\meshes\house1.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_DressRoom</Source>
<Dest >.\meshes\Heat_DressRoom.mesh</Dest>
</Mesh>
<Mesh >
<Source >Windows</Source>
<Dest >.\meshes\Windows.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_MasterBedroom</Source>
<Dest >.\meshes\Heat_MasterBedroom.mesh</Dest>
</Mesh>
<Mesh >
<Source >roof1</Source>
<Dest >.\meshes\roof1.mesh</Dest>
</Mesh>
<Mesh >
<Source >Heat_Entrance</Source>
<Dest >.\meshes\Heat_Entrance.mesh</Dest>
</Mesh>
</Import>
</Project>
</UIP>
<?xml version="1.0" encoding="UTF-8" ?>
<application>
<assets initial="houseStudio">
<presentation id="houseStudio" src="houseStudio.uip"/>
<presentation id="houseStudio" src="presentations/houseStudio.uip"/>
<dataInput name="slideInput" type="String"/>
<dataInput name="lightEntrance" type="Ranged Number" min="0" max="100"/>
<dataInput name="lightBathRoom" type="Ranged Number" min="0" max="100"/>
......
<?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,
sin(windpower+sinPos)*(0.112*windpower));
v_y = 0.0 + vertModCom.z;
if(bottomheight > attr_pos.z){
vertModCom = attr_pos;
}
else{
vertModCom = vertModCom;
}
gl_Position = modelViewProjection * vec4(vertModCom, 1.0);
}
</VertexShader>
<FragmentShader>
in float v_y;
in vec3 v_col;
in vec2 v_uv;
in vec3 v_pos;
in float v_power;
in vec4 v_color;
in float v_light;
in float v_lightx;
out vec4 fragOutput;
vec2 newCoord;
void main(){
vec2 newCoord = v_uv;
vec4 wave = texture(waveTexture, v_uv*(1.7-v_power));
newCoord.x += wave.r * ((1.2-v_power)*v_y);
newCoord.y -= wave.b * ((1.2-v_power)*v_y);
vec4 foam = texture(foammap,newCoord*3);
vec4 color = texture(diffusemap,newCoord);
vec4 outColor = vec4(color+(foam*(v_y*4.2)))+1.0*(-v_y*2.2)*0.9;
vec4 ambient = vec4(0.7,0.8,1.0,color.a);
vec4 Output = outColor * v_color + (ambient*0.2)+(0.2*v_color);
fragOutput = vec4(Output.r,Output.g,Output.b,Output.a*v_light);
}
</FragmentShader>
</Shader>
</Shaders>
<Passes>
<Pass>
<Blending source="SrcAlpha" dest="OneMinusSrcAlpha"/>
</Pass>
</Passes>
</Material>
<MaterialData version="1.0">
<Property name="waveheight">0.2</Property>
<Property name="bottomheight">-0.5</Property>
<Property name="diffusemap" type="Texture"><![CDATA[./.]]></Property>
<Property name="sourcepath"><![CDATA[./materials/wateredge.shader]]></Property>
<Property name="importid"></Property>
<Property name="importfile"></Property>
<Property name="type">CustomMaterial</Property>
<Property name="name"><![CDATA[materials/waterEdge]]></Property>
<Property name="path"><![CDATA[C:/Users/tetammin/Desktop/Windy_Island/3d_presentation/materials/waterEdge.materialdef]]></Property>
</MaterialData>
\ No newline at end of file
<Material name="water edge" version="1.0">
<MetaData>
<Property formalName="Time" name="time" type="Float" stage="vertex" default="1.0" category="Material" />
<Property formalName="Scale" name="scale" 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"/>s
</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 viewMatrix;
uniform mat4 modelMatrix;
out vec2 v_uv;
void main() {
v_uv = attr_uv0;
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,sin(windpower+sinPos)*(0.112*windpower));
if(bottomheight > attr_pos.z){
vertModCom = attr_pos;
}
else{
vertModCom = vertModCom;
}
gl_Position = modelViewProjection * vec4(vertModCom, 1.0);
}
</VertexShader>
<FragmentShader>
in vec2 v_uv;
out vec4 fragOutput;
void main() {
fragOutput = texture(diffusemap,v_uv);
}
</FragmentShader>
</Shader>
</Shaders>
<Passes>
<Pass>
<Blending source="SrcAlpha" dest="OneMinusSrcAlpha"/>
</Pass>
</Passes>
</Material>
<?xml version="1.0" encoding="UTF-8" ?>
<UIP Version="1" >
<Project Revision="1" >
<Graph >
<Group id="__import__root__" >
<Model id="Plant" name="Plant" orientation="Right Handed" position="-293.649 9.48606 -25.8427" rotation="-90 0 0" rotationorder="XYZr" scale="100 100 100" sourcepath="meshes/Plant.mesh" >
<Material id="plant_leaf" name="plant_leaf" blendmode="Normal" diffuse="0.8 0.8 0.8 1" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
</Group>
</Graph>
<Import SrcFile="../../../../Bush.fbx" ImageDir="Images" MeshDir="Meshes" >
<Mesh >
<Source >Plant</Source>
<Dest >meshes/Plant.mesh</Dest>
</Mesh>
</Import>
</Project>
</UIP>
<?xml version="1.0" encoding="UTF-8" ?>
<UIP Version="1" >
<Project Revision="1" >
<Graph >
<Group id="__import__root__" >
<Model id="Grass" name="Grass" orientation="Right Handed" position="0 0 0" rotation="-90 0 0" rotationorder="XYZr" scale="100 100 100" sourcepath="meshes/Grass.mesh" >
<Material id="grass" name="grass" blendmode="Normal" diffuse="0.8 0.8 0.8 1" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
</Group>
</Graph>
<Import SrcFile="../../../../qt-3dstudio-advanced-shader-examlpe/Blender/Grass.fbx" ImageDir="Images" MeshDir="Meshes" >
<Mesh >
<Source >Grass</Source>
<Dest >meshes/Grass.mesh</Dest>
</Mesh>
</Import>
</Project>
</UIP>
<?xml version="1.0" encoding="UTF-8" ?>
<UIP Version="1" >
<Project Revision="1" >
<Graph >
<Group id="__import__root__" >
<Model id="ground" name="ground" orientation="Right Handed" position="0 9.37874 0" rotation="-90 0 0" rotationorder="XYZr" scale="100 100 100" sourcepath="meshes/ground.mesh" >
<Material id="ground_0001" name="ground" blendmode="Normal" diffuse="0.8 0.8 0.8 1" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="BottomSphere" name="BottomSphere" orientation="Right Handed" position="0 0 0" rotation="-90 0 0" rotationorder="XYZr" scale="100 100 100" sourcepath="meshes/BottomSphere.mesh" >
<Material id="sphere" name="sphere" blendmode="Normal" diffuse="0.64 0.64 0.64 1" emissivepower="0" opacity="100" specularamount="0" specularroughness="9.60784" />
</Model>
</Group>
</Graph>
<Import SrcFile="../../../../qt-3dstudio-advanced-shader-examlpe/Blender/GroundParts.fbx" ImageDir="Images" MeshDir="Meshes" >
<Mesh >
<Source >ground</Source>
<Dest >meshes/ground.mesh</Dest>
</Mesh>
<Mesh >
<Source >BottomSphere</Source>
<Dest >meshes/BottomSphere.mesh</Dest>
</Mesh>
</Import>
</Project>
<Project Revision="2" >
<Graph >
<Group id="__import__root__" >
<Model id="ground" name="ground" orientation="Right Handed" position="0 9.37874 0" rotation="-90 0 0" rotationorder="XYZr" scale="100 100 100" sourcepath="meshes/ground.mesh" >
<Material id="ground_0001" name="ground" blendmode="Normal" diffuse="0.8 0.8 0.8 1" emissivepower="0" opacity="100" specularamount="0" specularroughness="20" />
</Model>
<Model id="BottomSphere" name="BottomSphere" orientation="Right Handed" position="0 0 0" rotation="-90 0 0" rotationorder="XYZr" scale="100 100 100" sourcepath="meshes/BottomSphere.mesh" >
<Material id="sphere" name="sphere" blendmode="Normal" diffuse="0.64 0.64 0.64 1" emissivepower="0" opacity="100" specularamount="0" specularroughness="9.60784" />
</Model>
</Group>
</Graph>
<Import SrcFile="../../../../qt-3dstudio-advanced-shader-examlpe/Blender/GroundParts.fbx" ImageDir="Images" MeshDir="Meshes" >
<Mesh >
<Source >ground</Source>
<Dest >meshes/ground.mesh</Dest>
</Mesh>
<Mesh >