Alright, some of you may already know, i m working on a shader base grass.
I ve got a huge problem right now and i need to know how do i only move designated vertex?
My example is easy, if i create a model with this
Geometry grassGeom = new Geometry("grass", new Quad(2, 2));
i apply a Material i made.
And in my update loop i update the material with this code
shaderGrass.setFloat("Time", tpf*3);
my current problem is i was using the world position of the vertex and not the local one, so this code does not work anymore if i place my grass over 0 or under 0
So your question is [quote=“n3cr0, post:1, topic:37341”]
how do i only move designated vertex?
[/quote]
What is your designated vertex. Since we are talking about grass and a quad, I am assuming, you’d like to move the top two vertices of the quad right?
In that, case you can simply check the inPosition.y coordinate.
Like i m already doing? I mean this is the actual problem, the y is world relative and not Local Relative so it doesn’t work (And i forgot to add the .y to the inPosition while copy pasting) My bad
It should since it seem to move correctly normally. I’m not really good in these thing so i copy people stuff And thus i don’t understand most of the equation. (I get the cos and the sin part with the inPosition > 0.1)
I m not sure how does the gpu know what i ask and how people understand these thing
Okai i got what s happening, since they all share the same material, the GLSL calculate the lowest one. I would need to split the material and update all of them 1 by one.
Yea i m Using batch node and then reapply the material to the batched node.
Hmm ok, so i add a new texture parameter to the frag? and then i tell the gpu to only move the part highlighted on the texture? Same as an Alpha map?
Edit: Like a Mask? and using a gradiant black to white, Whit receive 100% moving and black 0%?
glad I could have helped, make sure you do understand what your shader is doing thou.
gl with the rest of the shader and feel free to ask if you’ll run into difficulties
(Jmonkey 3.1-alpha)Ok, my grass was perfect… until i got my New AMD, the grass doesn’t exist anymore. I was on a Nvidia GTX 460 before and today i just got my New AMD rx 480 and the grass doesn’t seem to draw even on the test project. Anyone know what could’ve done this?
float alpha = DiffuseSum.a * texVal.a;
#ifdef ALPHAMAP
alpha = alpha * texture2D(m_AlphaMap, newTexCoord).r;
#endif
#ifdef DISCARD_ALPHA // IF I REMOVE THIS it seem to work, but with some visuel glitch.
if(alpha < m_AlphaDiscardThreshold){
discard;
}
#endif
}