rendering patches of grass using “noise dissolve” technique
if i do this :
grassMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
grassMat.getAdditionalRenderState().setDepthTest(true);
grassMat.getAdditionalRenderState().setDepthWrite(false);
grassMat.getAdditionalRenderState().setAlphaTest(false);
then the colors add up and SATURATE to yellow
i tried may combination on the renderstate but i always get saturation localy or globaly
so i trim the color in the shader , but i should not have to do that
also i want to make sure the alpha z sorting is disabled but i dont know how to do that ?
If I read the article right you want to discard fragments below a certain alpha.
“instead of alpha blending to simulate translucency. We accomplish this by modulating the alpha channel of our grass texture with a noise texture. Then we use alpha test to eliminate pixels from rendering.”
I 'm just guessing here but shouldn’t you modulate the alpha with the noise first, and then either discard the fragment or write it with col.a = 1.0f
The good thing with this is since you don’t have any translucent pixels you don’t have to sort them to blend them correctly but can rely on depth write and the z-buffer.
<cite>@pspeed said:</cite>
You can't disable alpha z sorting. I'm not even sure what that means. If you turn of depth write as you have then there is no sorting.
Your problem looks like a texture problem, to me… like there is no solid pixels at all.
well you probably know that alpha textured objects need to be z sorted before rendering
discarding depth write and or test does not give the the desired effect
<cite>@jmaasing said:</cite>
If I read the article right you want to discard fragments below a certain alpha.
“instead of alpha blending to simulate translucency. We accomplish this by modulating the alpha channel of our grass texture with a noise texture. Then we use alpha test to eliminate pixels from rendering.”
I 'm just guessing here but shouldn’t you modulate the alpha with the noise first, and then either discard the fragment or write it with col.a = 1.0f
The good thing with this is since you don’t have any translucent pixels you don’t have to sort them to blend them correctly but can rely on depth write and the z-buffer.
ill check my shader but alpha discards leads to ugly edges, so i have to manage this byt multiplication rather than with conditional branching
Multipass means it draws the scene once for every light. How many lights do you have? Maybe you have more than one light and so you are getting the effect of additive blending because you aren’t doing the lighting calculations properly.
Z sorting has nothing to do with this. That only controls the order that the objects are drawn. The objects will still be drawn.
Standard bucket is sorted front to back (to reduce overdraw)
Transparent buck is sorted back to front (to reduce transparency issues)
However it cannot sort objects that overlap. For example a lot of grass is done using a particle-like system with lots of quads inside one mesh. There is no way for jme to sort that prior to rendering - you would need to do the sorting yourself inside the particle-like system which would be a lot of calculations.
<cite>@pspeed said:</cite>
Multipass means it draws the scene once for every light. How many lights do you have? Maybe you have more than one light and so you are getting the effect of additive blending because you aren't doing the lighting calculations properly.
Z sorting has nothing to do with this. That only controls the order that the objects are drawn. The objects will still be drawn.
yes, but i wanted to know about that concerning the mentioned article
<cite>@zarch said:</cite>
All objects (in every bucket) are z sorted.
Standard bucket is sorted front to back (to reduce overdraw)
Transparent buck is sorted back to front (to reduce transparency issues)
However it cannot sort objects that overlap. For example a lot of grass is done using a particle-like system with lots of quads inside one mesh. There is no way for jme to sort that prior to rendering - you would need to do the sorting yourself inside the particle-like system which would be a lot of calculations.
i know but in that case, the mentioned method allows to skip the sorting pass
so mybe i need to create a render bucket that does not sort anything for the grass
but how do i do that ?
@curtisnewton said:
i know but in that case, the mentioned method allows to skip the sorting pass
so mybe i need to create a render bucket that does not sort anything for the grass
but how do i do that ?
You can’t create custom buckets. You can set a custom comparator but I don’t know what the point would be. Sorting is not expensive enough to worry about and has nothing to do with your problem, really.
Also, anything you batch isn’t sorted within the batch. Sorting only happens per object. Your grass should be a handful of batches, really.
<cite>@pspeed said:</cite>
You can't create custom buckets. You can set a custom comparator but I don't know what the point would be. Sorting is not expensive enough to worry about and has nothing to do with your problem, really.
Also, anything you batch isn’t sorted within the batch. Sorting only happens per object. Your grass should be a handful of batches, really.