init
This commit is contained in:
16
oak_tree/materials/scripts/caster_fp.glsl
Normal file
16
oak_tree/materials/scripts/caster_fp.glsl
Normal file
@@ -0,0 +1,16 @@
|
||||
varying vec4 vertex_depth;
|
||||
|
||||
uniform sampler2D tex;
|
||||
varying vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (texture2D(tex, uv).a < 0.5)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
float depth = (vertex_depth.z) / vertex_depth.w;
|
||||
|
||||
gl_FragColor = vec4(depth, depth, depth, 1.0);
|
||||
}
|
||||
16
oak_tree/materials/scripts/caster_vp.glsl
Normal file
16
oak_tree/materials/scripts/caster_vp.glsl
Normal file
@@ -0,0 +1,16 @@
|
||||
uniform mat4 world_view_proj_mat;
|
||||
uniform vec4 texel_offsets;
|
||||
|
||||
varying vec4 vertex_depth;
|
||||
|
||||
varying vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
vertex_depth = world_view_proj_mat * gl_Vertex;
|
||||
gl_Position = vertex_depth;
|
||||
gl_Position.xy += texel_offsets.zw * gl_Position.w;
|
||||
|
||||
uv = gl_MultiTexCoord0.xy;
|
||||
}
|
||||
|
||||
86
oak_tree/materials/scripts/oak_tree.material
Normal file
86
oak_tree/materials/scripts/oak_tree.material
Normal file
@@ -0,0 +1,86 @@
|
||||
material OakTree/Branch
|
||||
{
|
||||
technique
|
||||
{
|
||||
shadow_caster_material "OakTree/shadow_caster_alpha"
|
||||
|
||||
pass
|
||||
{
|
||||
alpha_rejection greater 128
|
||||
|
||||
texture_unit
|
||||
{
|
||||
texture branch_diffuse.png
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
material OakTree/Bark
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
texture_unit
|
||||
{
|
||||
texture bark_diffuse.png
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vertex_program caster_vp_glsl glsl
|
||||
{
|
||||
source caster_vp.glsl
|
||||
|
||||
default_params
|
||||
{
|
||||
param_named_auto world_view_proj_mat worldviewproj_matrix
|
||||
param_named_auto texel_offsets texel_offsets
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fragment_program caster_fp_glsl glsl
|
||||
{
|
||||
source caster_fp.glsl
|
||||
|
||||
default_params
|
||||
{
|
||||
param_named tex int 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
material OakTree/shadow_caster_alpha
|
||||
{
|
||||
transparency_casts_shadows on
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
// See: viewtopic.php?f=3&t=44817
|
||||
fog_override true
|
||||
|
||||
cull_hardware none
|
||||
cull_software none
|
||||
|
||||
alpha_rejection always_pass
|
||||
|
||||
vertex_program_ref caster_vp_glsl
|
||||
{
|
||||
}
|
||||
|
||||
fragment_program_ref caster_fp_glsl
|
||||
{
|
||||
}
|
||||
|
||||
texture_unit tex
|
||||
{
|
||||
// Pass the texture with alpha channel to the caster
|
||||
texture branch_diffuse.png
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
oak_tree/materials/textures/bark_diffuse.png
Normal file
BIN
oak_tree/materials/textures/bark_diffuse.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
BIN
oak_tree/materials/textures/branch_diffuse.png
Normal file
BIN
oak_tree/materials/textures/branch_diffuse.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
204
oak_tree/meshes/oak_tree.dae
Normal file
204
oak_tree/meshes/oak_tree.dae
Normal file
File diff suppressed because one or more lines are too long
16
oak_tree/model.config
Normal file
16
oak_tree/model.config
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<model>
|
||||
<name>Oak tree</name>
|
||||
<version>1.0</version>
|
||||
<sdf version="1.6">model.sdf</sdf>
|
||||
|
||||
<author>
|
||||
<name>Louise Poubel</name>
|
||||
<email>louise@osrfoundation.org</email>
|
||||
</author>
|
||||
|
||||
<description>
|
||||
An oak tree.
|
||||
</description>
|
||||
</model>
|
||||
49
oak_tree/model.sdf
Normal file
49
oak_tree/model.sdf
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" ?>
|
||||
<sdf version="1.6">
|
||||
<model name="oak_tree">
|
||||
<static>true</static>
|
||||
<link name="link">
|
||||
<collision name="collision">
|
||||
<geometry>
|
||||
<mesh>
|
||||
<uri>model://oak_tree/meshes/oak_tree.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</collision>
|
||||
<visual name="branch">
|
||||
<geometry>
|
||||
<mesh>
|
||||
<uri>model://oak_tree/meshes/oak_tree.dae</uri>
|
||||
<submesh>
|
||||
<name>Branch</name>
|
||||
</submesh>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<script>
|
||||
<uri>model://oak_tree/materials/scripts/</uri>
|
||||
<uri>model://oak_tree/materials/textures/</uri>
|
||||
<name>OakTree/Branch</name>
|
||||
</script>
|
||||
</material>
|
||||
</visual>
|
||||
<visual name="bark">
|
||||
<geometry>
|
||||
<mesh>
|
||||
<uri>model://oak_tree/meshes/oak_tree.dae</uri>
|
||||
<submesh>
|
||||
<name>Bark</name>
|
||||
</submesh>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<script>
|
||||
<uri>model://oak_tree/materials/scripts/</uri>
|
||||
<uri>model://oak_tree/materials/textures/</uri>
|
||||
<name>OakTree/Bark</name>
|
||||
</script>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
</model>
|
||||
</sdf>
|
||||
Reference in New Issue
Block a user