Skip to content
Snippets Groups Projects
Commit 3fe7f8e1 authored by Stefano Nardo's avatar Stefano Nardo Committed by Sandro Weber
Browse files

Merged in NRRPLT-7975-add-missing-gazebo-materials (pull request #40)

[NRRPLT-7975] Add gazebo materials

* [NRRPLT-7975] Add gazebo materials

* [NRRPLT-7975] add gazebo material

* [NRRPLT-7975] Add textures

* [NRRPLT-7975] Fix folders

Approved-by: Sandro Weber
Approved-by: Manos Angelidis
parent 0f45dc18
No related branches found
No related tags found
No related merge requests found
Showing
with 514 additions and 156 deletions
...@@ -121,11 +121,13 @@ std::string OgreMaterialParser::GetMaterialAsJson() const ...@@ -121,11 +121,13 @@ std::string OgreMaterialParser::GetMaterialAsJson() const
if (textureNode) if (textureNode)
{ {
std::string textureStr = textureNode->getValue(0); std::string textureStr = textureNode->getValue(0);
index = textureStr.rfind("."); // Weird. If we force the format to png, gz3d won't find jpg
if (index != std::string::npos) // textures. Why forcing the format instead of handling an exception?
{ // index = textureStr.rfind(".");
textureStr = textureStr.substr(0, index+1) + "png"; // if (index != std::string::npos)
} // {
// textureStr = textureStr.substr(0, index+1) + "png";
// }
jsonStr += "\"texture\":\"" + textureStr + "\","; jsonStr += "\"texture\":\"" + textureStr + "\",";
} }
......
material Gazebo/OrangeTransparent
{
receive_shadows off
technique
{
pass
{
scene_blend alpha_blend
depth_write off
ambient 1.0 0.44 0.0 1
diffuse 1.0 0.44 0.0 1
texture_unit
{
colour_op_ex source1 src_current src_current 0 1 0
alpha_op_ex source1 src_manual src_current 0.4
}
}
}
}
material Gazebo/Black
{
technique
{
pass ambient
{
ambient 0 0 0
diffuse 0 0 0
specular 0.1 0.1 0.1 1 5
}
}
}
material Gazebo/BlackGlow
{
technique
{
pass ambient
{
ambient 0 0 0
diffuse 0 0 0
specular 0.1 0.1 0.1 1 5
}
}
}
\ No newline at end of file
material Gazebo/Blue
{
technique
{
pass ambient
{
ambient 0 0 1
diffuse 0 0 1
specular 0.1 0.1 0.1 1 1
}
}
}
material Gazebo/BlueGlow
{
technique
{
pass ambient
{
ambient 0 0 1
diffuse 0 0 1
specular 0.1 0.1 0.1 1 1
emissive 0 0 1
}
}
}
\ No newline at end of file
material Gazebo/Green
{
technique
{
pass ambient
{
ambient 0 1 0
diffuse 0 1 0
specular 0.1 0.1 0.1 1 1
}
}
}
material Gazebo/GreenGlow
{
technique
{
pass ambient
{
ambient 0 1 0
diffuse 0 1 0
specular 0.1 0.1 0.1 1 1
emissive 0 1 0
}
}
}
\ No newline at end of file
material Gazebo/Grey
{
technique
{
pass main
{
ambient .3 .3 .3 1.0
diffuse .7 .7 .7 1.0
specular 0.01 0.01 0.01 1 1.5
}
}
}
material Gazebo/GreyGlow
{
technique
{
pass main
{
ambient .3 .3 .3 1.0
diffuse .3 .3 .3 1.0
specular 0.1 0.1 0.1 1 1
emissive .3 .3 .3
}
}
}
material Gazebo/Red
{
technique
{
pass ambient
{
ambient 1 0 0
diffuse 1 0 0
specular 0.1 0.1 0.1 1 1
}
}
}
material Gazebo/RedGlow
{
technique
{
pass ambient
{
ambient 1 0 0
diffuse 1 0 0
specular 0.1 0.1 0.1 1 1
emissive 1 0 0
}
}
}
// This code in this file is adapted from OGRE Samples. The OGRE's license and
// copyright header is copied below.
/*
-----------------------------------------------------------------------------
OGRE (www.ogre3d.org) is made available under the MIT License.
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#version 120
varying vec2 uv;
uniform sampler2D sNormal;
uniform sampler2D sPosition;
uniform sampler2D sRandom;
// the three(four) artistic parameters
uniform float cRange;
uniform float cBias;
uniform float cAverager;
uniform float cMinimumCrease;
// Bias for the kernel size, Hack for the fixed size 11x11 stipple kernel
uniform float cKernelSize;
uniform vec4 cViewportSize;
void main()
{
// get the view space position and normal of the fragment
vec3 fragmentPosition = texture2D(sPosition, uv).xyz;
vec3 fragmentNormal = texture2D(sNormal, uv).xyz;
float totalGI = 0.0f;
const int stippleSize = 11; // must be odd
for (int i = 0; i < (stippleSize + 1) / 2; i++)
{
vec2 diagonalStart = vec2(-(stippleSize - 1.0) / 2.0, 0) + i;
for(int j = 0; j < (stippleSize + 1) / 2; j++)
{
vec2 sampleOffset = diagonalStart + vec2(j, -j);
vec2 sampleUV = uv + (sampleOffset * cViewportSize.zw * cKernelSize);
vec3 samplePos = texture2D(sPosition, sampleUV).xyz;
vec3 toCenter = samplePos - fragmentPosition;
float distance = length(toCenter);
toCenter = normalize(toCenter);
float centerContrib = clamp((dot(toCenter, fragmentNormal) - cMinimumCrease) * cBias, 0.0, 1.0);
float rangeAttenuation = 1.0f - clamp(distance / cRange, 0.0, 1.0);
totalGI += centerContrib * rangeAttenuation;
}
}
totalGI /= cAverager;
gl_FragColor = 1.0 - vec4(totalGI, totalGI, totalGI, 1.0);
}
// This code in this file is adapted from OGRE Samples. The OGRE's license and
// copyright header is copied below.
/*
-----------------------------------------------------------------------------
OGRE (www.ogre3d.org) is made available under the MIT License.
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#version 120
#extension GL_ARB_draw_buffers : enable
varying vec3 oViewPos;
varying vec3 oNormal;
uniform float cNearClipDistance;
// !!! might be 0 for infinite view projection.
uniform float cFarClipDistance;
void main()
{
float clipDistance = cFarClipDistance - cNearClipDistance;
gl_FragData[0] = vec4(normalize(oNormal).xyz, (length(oViewPos) - cNearClipDistance) / clipDistance); // normal + linear depth [0, 1]
gl_FragData[1] = vec4(oViewPos, 0.0); // view space position
}
// This code in this file is adapted from OGRE Samples. The OGRE's license and
// copyright header is copied below.
/*
-----------------------------------------------------------------------------
OGRE (www.ogre3d.org) is made available under the MIT License.
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#version 120
attribute vec4 vertex;
attribute vec3 normal;
uniform mat4 cWorldViewProj;
uniform mat4 cWorldView;
varying vec3 oViewPos;
varying vec3 oNormal;
void main()
{
// transform the vertex position to the view space
oViewPos = (cWorldView * vertex).xyz;
// transform the vertex normal to view space
oNormal = (cWorldView * vec4(normal, 0)).xyz;
gl_Position = cWorldViewProj * vertex;
}
// This code in this file is adapted from OGRE Samples. The OGRE's license and
// copyright header is copied below.
/*
-----------------------------------------------------------------------------
OGRE (www.ogre3d.org) is made available under the MIT License.
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#version 120
varying vec2 uv;
uniform sampler2D ssao;
uniform sampler2D scene;
void main()
{
gl_FragColor = vec4((texture2D(scene, uv) * texture2D(ssao, uv)).rgb, 1.0);
}
// This code in this file is adapted from OGRE Samples. The OGRE's license and
// copyright header is copied below.
/*
-----------------------------------------------------------------------------
OGRE (www.ogre3d.org) is made available under the MIT License.
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#version 120
varying vec2 uv;
uniform sampler2D sOcclusion;
void main ()
{
gl_FragColor = vec4(texture2D(sOcclusion, uv).xyz, 1);
}
uniform sampler2D diffuseMap;
void main(void)
{
float red = texture2D(diffuseMap, gl_TexCoord[0].xy).r;
float green = texture2D(diffuseMap, gl_TexCoord[1].xy).g;
float blue = texture2D(diffuseMap, gl_TexCoord[2].xy).b;
gl_FragColor = vec4( red, green, blue, 1.0 )*gl_Color;
//gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);//vec4( red, green, blue, 1.0 );
//gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 );
}
#version 120
// Values automatically defined by Ogre/OpenGL:
attribute vec4 vertex;
attribute vec2 uv0; // Red channel
attribute vec2 uv1; // Green channel
attribute vec2 uv2; // Blue channel
attribute vec4 colour; // Vertex Colour
// Load in values defined in the material:
uniform mat4 worldViewProj;
uniform vec2 eyeToSourceUVScale;
uniform vec2 eyeToSourceUVOffset;
uniform mat4 eyeRotationStart;
uniform mat4 eyeRotationEnd;
varying vec4 gl_FrontColor;
vec2 timewarpTexCoord( vec2 texCoord, mat4 rotMat )
{
vec3 transformed = (rotMat * vec4( texCoord.xy, 1, 1) ).xyz;
vec2 flattened = transformed.xy / transformed.z;
return eyeToSourceUVScale * flattened + eyeToSourceUVOffset;
}
void main(void)
{
/*float timewarpLerpFactor = 0.0;
mat4 lerpedEyeRot = eyeRotationStart * (1 - timewarpLerpFactor) + eyeRotationEnd * timewarpLerpFactor;
gl_TexCoord[0] = vec4( timewarpTexCoord( uv0, lerpedEyeRot ), 0.0, 0.0 );
gl_TexCoord[1] = vec4( timewarpTexCoord( uv1, lerpedEyeRot ), 0.0, 0.0 );
gl_TexCoord[2] = vec4( timewarpTexCoord( uv2, lerpedEyeRot ), 0.0, 0.0 );*/
gl_TexCoord[0] = vec4( eyeToSourceUVScale * uv0 + eyeToSourceUVOffset, 0.0, 0.0 );
gl_TexCoord[1] = vec4( eyeToSourceUVScale * uv1 + eyeToSourceUVOffset, 0.0, 0.0 );
gl_TexCoord[2] = vec4( eyeToSourceUVScale * uv2 + eyeToSourceUVOffset, 0.0, 0.0 );
gl_Position = worldViewProj * vertex;
gl_FrontColor = colour;
}
// This code in this file is adapted from OGRE Samples. The OGRE's license and
// copyright header is copied below.
/*
-----------------------------------------------------------------------------
OGRE (www.ogre3d.org) is made available under the MIT License.
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#version 120
varying vec2 uv;
uniform mat4 worldViewProj;
attribute vec2 uv0;
void main()
{
gl_Position = worldViewProj * gl_Vertex;
uv = uv0;
}
uniform vec4 ambient;
void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_FrontColor = gl_FrontMaterial.ambient * ambient;
}
uniform vec4 invSMSize;
uniform sampler2D map;
void main()
{
vec3 sample = vec3(0.0, 0.0, 0.0);
float radius = 9.0;
for (float x = -radius; x <= radius; x += 1.0)
{
for (float y = -radius; y <= radius; y += 1.0)
{
sample += texture2D(map, vec2(gl_TexCoord[0].x + x * invSMSize.x, gl_TexCoord[0].y + y * invSMSize.y)).rgb;
}
}
//gl_FragColor = vec4(sample / ((radius * 2.0 + 1.0) * (radius * 2.0 + 1.0)), 1.0);
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}
// The input texture, which is set up by the Ogre Compositor infrastructure.
uniform sampler2D RT;
// Mapping of undistorted to distorted uv coordinates.
uniform sampler2D distortionMap;
// Scale the input texture if necessary to crop black border
uniform vec3 scale;
void main()
{
vec2 scaleCenter = vec2(0.5, 0.5);
vec2 inputUV = (gl_TexCoord[0].xy - scaleCenter) / scale.xy + scaleCenter;
vec4 mapUV = texture2D(distortionMap, inputUV);
if (mapUV.x < 0.0 || mapUV.y < 0.0)
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
else
gl_FragColor = texture2D(RT, mapUV.xy);
}
// Simple vertex shader; just setting things up for the real work to be done in
// camera_distortion_fs.glsl.
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
// The input texture, which is set up by the Ogre Compositor infrastructure.
uniform sampler2D RT;
uniform sampler2D noiseRGBA;
uniform float time;
uniform vec3 viewport;
// light pos in clip space
uniform vec3 lightPos;
// lens flare scale
uniform float scale;
float noise(float t)
{
// 256 is the size of noiseRGBA texture
return texture2D(noiseRGBA, vec2(t, 0.0) / vec2(256.0)).x;
}
float noise(vec2 t)
{
return texture2D(noiseRGBA,(t + vec2(time)) / vec2(256.0)).x;
}
vec3 lensflare(vec2 uv,vec2 pos)
{
vec2 main = uv-pos;
vec2 uvd = uv*(length(uv));
float ang = atan(main.y, main.x);
float dist = length(main); dist = pow(dist,.1);
float n = noise(vec2((ang-time/9.0)*16.0,dist*32.0));
float f0 = 1.0/(length(uv-pos)*16.0/scale+1.0);
f0 = f0+f0*(sin((ang+time/18.0 + noise(abs(ang)+n/2.0)*2.0)*12.0)*.1+dist*.1+.8);
float f2 = max(1.0/(1.0+32.0*pow(length(uvd+0.8*pos),2.0)),.0)*00.25;
float f22 = max(1.0/(1.0+32.0*pow(length(uvd+0.85*pos),2.0)),.0)*00.23;
float f23 = max(1.0/(1.0+32.0*pow(length(uvd+0.9*pos),2.0)),.0)*00.21;
vec2 uvx = mix(uv,uvd,-0.5);
float f4 = max(0.01-pow(length(uvx+0.4*pos),2.4),.0)*6.0;
float f42 = max(0.01-pow(length(uvx+0.45*pos),2.4),.0)*5.0;
float f43 = max(0.01-pow(length(uvx+0.5*pos),2.4),.0)*3.0;
uvx = mix(uv,uvd,-.4);
float f5 = max(0.01-pow(length(uvx+0.2*pos),5.5),.0)*2.0;
float f52 = max(0.01-pow(length(uvx+0.4*pos),5.5),.0)*2.0;
float f53 = max(0.01-pow(length(uvx+0.6*pos),5.5),.0)*2.0;
uvx = mix(uv,uvd,-0.5);
float f6 = max(0.01-pow(length(uvx-0.3*pos),1.6),.0)*6.0;
float f62 = max(0.01-pow(length(uvx-0.325*pos),1.6),.0)*3.0;
float f63 = max(0.01-pow(length(uvx-0.35*pos),1.6),.0)*5.0;
vec3 c = vec3(.0);
c.r+=f2+f4+f5+f6; c.g+=f22+f42+f52+f62; c.b+=f23+f43+f53+f63;
c *= min(scale, 0.2)/0.2;
c+=vec3(f0);
return c;
}
// color modifier
vec3 cc(vec3 color, float factor, float factor2)
{
float w = color.x+color.y+color.z;
return mix(color,vec3(w)*factor,w*factor2);
}
void main()
{
// return if light is behind the view
if (lightPos.z < 0.0)
{
gl_FragColor = texture2D(RT, gl_TexCoord[0].xy);
return;
}
vec3 pos = lightPos;
// flip y
pos.y *= -1.0;
float aspect = viewport.x/viewport.y;
vec2 uv = gl_TexCoord[0].xy - 0.5;
// scale lightPos to be same range as uv
pos *= 0.5;
// fix aspect ratio
uv.x *= aspect;
pos.x *= aspect;
// compute lens flare
vec3 color = vec3(1.4,1.2,1.0)*lensflare(uv, pos.xy);
color = cc(color,.5,.1);
// apply lens flare
gl_FragColor = texture2D(RT, gl_TexCoord[0].xy) + vec4(color, 1.0);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment