Search the Community
Showing results for tags 'Vegetation'.
-
In the most recent beta if you create a vegetation layer and have water in your scene the water reflections will be distorted. I took before and after screenshots to show what "distorted" means. Before (Without Vegetation) - After (With Vegetation) -
- 2 replies
-
- Water
- Vegetation
-
(and 1 more)
Tagged with:
-
Is it possible to adjust the height or scale of vegetation with either code (Lua or C++) or within the editor? For instance, see the following screenshot with the marshgrass asset in front of a building with a door at player height. It's very tall, preventing the default FPSPlayer prefab from seeing over the top of it easily. Is the only way to do this to adjust the model? If so, how can we get varying heights / scale sizes for grass or trees?
-
- 5 replies
-
- reflections
- vegetation
-
(and 1 more)
Tagged with:
-
I've been playing with the vegetation system a bit and here are two problems I've found with the collision. 1) The collision checkbox does not seem to do anything. It seems it's stuck at true and if a model has a phy file, it will automatically enables collisions. I set collision for all my layers to false, and the trees and rocks still had collision. 2) Collision models don't scale with the actual model scale. I created a few rock models in blender. One model (rock01) has it's scale uniformed to 1.0,1.0,1.0, while the other two are a little bigger/smaller. If rock01 is used, it behaves as expected. When the others are used, the collision does not match the model. Here are my rock models to test with, Note the scale value on each model. If you place the models in the scene "normally" (Not vegetation), everything will work fine.
-
1. What are the polygon or vertices limit for a single instance? 2. Are there only two LOD for each instance? (billboard and regular model) 3. In this system can we add more LOD? 4. How are animations handled for the instanced vegetation? 5. If I have trees that are rigged, can I use different animations at the same time on identical instances?
-
Hello everybody, I've got some problem finding vegetation system in Leadwerk 3.2. I tried to find this tool on terrain options but I didn't find anything... It depends on my LE version (I've Indie Version) ? Thank you !
-
Hi everyone. I was wondering if someone could take a look at these modified versions of Shadmars Vegetation+Diffuse+Shadowmask and Shadow+Vegetation shaders to check for any errors. Also I was wondering if there is a way I can make the vegetation sway only when it is visible and/or within a certain distance from the camera. That could be really useful (especially if it increases my fps). Anyways here they are. They compile without any errors and seem to work fine. Feel free to use them in any of your own projects at your own risk until they get a stamp of approval. Vegetation+Diffuse+Shadowmask Shader-- Fragment- #version 400 #define BFN_ENABLED 1 //Uniforms uniform sampler2D texture0;//diffuse map uniform sampler2D texture1;//normal map uniform vec4 materialcolorspecular; uniform vec4 lighting_ambient; uniform samplerCube texture15; uniform vec2 camerarange; uniform vec2 buffersize; uniform float camerazoom; //Inputs in vec2 ex_texcoords0; in vec4 ex_color; in float ex_selectionstate; in vec3 ex_VertexCameraPosition; in vec3 ex_normal; in vec3 ex_tangent; in vec3 ex_binormal; //Outputs out vec4 fragData0; out vec4 fragData1; out vec4 fragData2; out vec4 fragData3; float DepthToZPosition(in float depth) { return camerarange.x / (camerarange.y - depth * (camerarange.y - camerarange.x)) * camerarange.y; } void main(void) { vec4 outcolor = ex_color; outcolor *= texture(texture0,ex_texcoords0); if (outcolor.a < .63) discard; vec4 color_specular = materialcolorspecular; vec3 screencoord = vec3(((gl_FragCoord.x/buffersize.x)-0.5) * 2.0 * (buffersize.x/buffersize.y),((-gl_FragCoord.y/buffersize.y)+0.5) * 2.0,DepthToZPosition( gl_FragCoord.z )); screencoord.x *= screencoord.z / camerazoom; screencoord.y *= -screencoord.z / camerazoom; vec3 nscreencoord = normalize(screencoord); vec3 normal = ex_normal; normal = texture(texture1,ex_texcoords0).xyz * 2.0 - 1.0; float ao = normal.z; normal = ex_tangent*normal.x + ex_binormal*normal.y + ex_normal*normal.z; normal=normalize(normal); vec4 lighting_diffuse = vec4(0); vec4 lighting_specular = vec4(0); float attenuation=1.0; vec3 lightdir; vec3 lightreflection; int i; float anglecos; float diffspotangle; float denom; fragData0 = outcolor; #if BFN_ENABLED==1 fragData1 = texture(texture15,normalize(vec3(normal.x,-normal.y,normal.z))); #else fragData1 = vec4(normalize(normal)*0.5+0.5,fragData0.a); #endif fragData1.a = color_specular.r * 0.299 + color_specular.g * 0.587 + color_specular.b * 0.114; int materialflags=1; if (ex_selectionstate>0.0) materialflags += 2; fragData2 = vec4(0.0,0.0,0.0,materialflags/255.0); } -Vertex #version 400 #define MAX_INSTANCES 256 //Uniforms uniform vec4 materialcolordiffuse; uniform mat4 projectioncameramatrix; uniform mat4 camerainversematrix; uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity; uniform float currenttime;//Attributes in vec3 vertex_position; in vec4 vertex_color; in vec2 vertex_texcoords0; in vec3 vertex_normal; in vec3 vertex_binormal; in vec3 vertex_tangent; //Outputs out vec4 ex_color; out vec2 ex_texcoords0; out float ex_selectionstate; out vec3 ex_VertexCameraPosition; out vec3 ex_normal; out vec3 ex_tangent; out vec3 ex_binormal;void main() { mat4 entitymatrix = entity.matrix[gl_InstanceID]; mat4 entitymatrix_=entitymatrix; entitymatrix_[0][3]=0.0; entitymatrix_[1][3]=0.0; entitymatrix_[2][3]=0.0; entitymatrix_[3][3]=1.0; //SWAY float seed = mod(currenttime / 100.0 * 0.25,360.0); seed += entitymatrix_[3].x*33.0 + entitymatrix_[3].y*67.8 + entitymatrix_[3].z*123.5; seed += vertex_position.x + vertex_position.y + vertex_position.z; vec4 movement = vec4( vec3( 0.02 * (sin(seed)+0.025*cos(seed*5.2+3.2)) ),0.0); vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position+movement.xyz,1.0); ex_VertexCameraPosition = vec3(camerainversematrix * modelvertexposition); gl_Position = projectioncameramatrix * modelvertexposition; mat3 nmat = mat3(camerainversematrix[0].xyz,camerainversematrix[1].xyz,camerainversematrix[2].xyz); nmat = nmat * mat3(entitymatrix[0].xyz,entitymatrix[1].xyz,entitymatrix[2].xyz); ex_normal = normalize(nmat * vertex_normal); ex_tangent = normalize(nmat * vertex_tangent); ex_binormal = normalize(nmat * vertex_binormal); ex_texcoords0 = vertex_texcoords0; ex_color = vec4(entitymatrix[0][3],entitymatrix[1][3],entitymatrix[2][3],entitymatrix[3][3]); //If an object is selected, 10 is subtracted from the alpha color. //This is a bit of a hack that packs a per-object boolean into the alpha value. ex_selectionstate = 0.0; if (ex_color.a<-5.0) { ex_color.a += 10.0; ex_selectionstate = 1.0; } ex_color *= vec4(1.0-vertex_color.r,1.0-vertex_color.g,1.0-vertex_color.b,vertex_color.a) * materialcolordiffuse; } Shadow+Vegetation Shader-- Fragment- #version 400 uniform sampler2D texture4;in vec2 ex_texcoords0; void main() { if (texture(texture4,ex_texcoords0).a < 0.8) discard; } Vertex- #version 400 #define MAX_INSTANCES 256 //Uniforms //uniform mat4 entitymatrix; uniform mat4 projectioncameramatrix; uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity; uniform float currenttime; //Attributes in vec3 vertex_position; in vec2 vertex_texcoords0; out vec2 ex_texcoords0; void main() { mat4 entitymatrix = entity.matrix[gl_InstanceID]; mat4 entitymatrix_=entitymatrix; entitymatrix_[0][3]=0.0; entitymatrix_[1][3]=0.0; entitymatrix_[2][3]=0.0; entitymatrix_[3][3]=1.0; //SWAY float seed = mod(currenttime / 100.0 * 0.25,360.0); seed += entitymatrix_[3].x*33.0 + entitymatrix_[3].y*67.8 + entitymatrix_[3].z*123.5; seed += vertex_position.x + vertex_position.y + vertex_position.z; vec4 movement = vec4( vec3( 0.01 * (sin(seed)+0.025*cos(seed*5.2+3.2)) ),0.0); ex_texcoords0 = vertex_texcoords0; vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position+movement.xyz,1.0); gl_Position = projectioncameramatrix * modelvertexposition; }
-
- Vegetation
- Shader
-
(and 1 more)
Tagged with: