Jump to content

Question about creating vegetation


Tomas
 Share

Recommended Posts

Hi. I've created a tree in blender similar to pine tree that comes with LE. But the tree in LE has moving branches and my branches dont move. Material settings and shaders are identical to the pine in LE. Used PNG as textures. Also branches dont cast shadow on each other even if the ''cast shadow'' box is set in material. The shadow casted is only on the ground. Any ideas what im doing wrong?

post-9380-0-31545800-1493666023_thumb.jpg

Link to comment
Share on other sites

The only time I see leaves swaying is when the tree is set with the vegetation tool. If I set the same tree by just placing the model, I get no leaves swaying. The 'Models/leaves.shader' doesn't have a wind animation calculation in the vertex code, but the 'Models/Vegetation/leaves.shader' does. So that at least explains that, even though I think that needs to be rectified inside the 'Models/leaves.shader'.

 

As for the other issues with shadows, without seeing the model in question we can only guess. Perhaps you need to recalculate your normals? Faces are flipped? Maybe you don't have the material settings the exactly the same? I know I mess up trees' shader setting all the time because for some reason the default LE shaders are all named the same but are only differentiated by what folder they are in... ie. there are 3 'leaves.shaders' but the one in the vegetation folder can't be used for shader 0 but only for the vegetation shader 4.

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I've sorted out shadows. The shadows checkbox in terrain/vegetation was not checked. But the leave movement is still not working. I wander could that be a geometry problem. I used rectangles divided in a half by width and height, so in one plane there is 4 faces.

Link to comment
Share on other sites

Didn't leaves used to sway depending on the color of the vertex? Not sure if that's still the case but that's what I'd try first (in addition to checking the stuff macklebee suggested above).

 

Well, looking over the wind calculation they still move based on vertex color and maybe that is his issue. But Tomas has not said whether or not his problem with lack of movement occurs when he is manually placing the tree or when using the vegetation tool. If he is manually placing the tree, then the leaves will not move based on the inherent 'Models/leaves.shader'. If they are not moving when the tree is set using the vegetation tool, then it very well could be the vertex color that is preventing the swaying.

 

//Wind animation

float seed = mod(currenttime * 0.0015 ,360.0);

seed += ex_entitymatrix[3].x*33.0 + ex_entitymatrix[3].y*67.8 + ex_entitymatrix[3].z*123.5;

seed += modelvertexposition.x + modelvertexposition.y + modelvertexposition.z;

vec4 movement = vec4( vec3( (vertex_color.r) * vertex_normal * 0.02 * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);

modelvertexposition += movement;

 

modelvertexposition = entitymatrix_ * modelvertexposition;

 

But again without seeing the model, its all just a guess.

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

The modeling application you use or its export options will affect the vertex colors. If you are not using the vertex colors for anything else, then just open the model in the LE Model Editor and use the Tools>Strip Vertex Colors option and it will make all vertex colors white (1,1,1).

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

burgelkat - thats the difference. Nice catch.

 

In the two leaves shaders that use the wind calculation (vegetation & vegetation shadow), the code is slightly different between the two.

 

Shaders/Vegetation/leaves.shader:

vec4 movement = vec4( vec3( (vertex_color.r) * vertex_normal * 0.02 * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);

 

Shaders/Vegetation/Shadow/leaves.shader:

vec4 movement = vec4( vec3( (1.0-vertex_color.r) * vertex_normal * 0.02 * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);

 

The Shaders/Models/groundplants.shader code also looks like the vegetation shadow code. I am not sure why it appears to work on some trees and not the others (an issue with vertex normals/color?). But if you change the code to '1.0-vertex_color.r' then it appears to work fine on his pine tree.

  • Upvote 2

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...