I’m trying to make alpha clipped opaque billboards to cast and receive shadows. As you can see, I already got some results. I’ve made custom material def, shaders, and preShadow shader, so it gets particles alpha, and shadows slowly disappears, just like billboard does. That’s pretty cool, but i have following troubles and questions:
How to make billboard face shadow camera, when shadows are rendering? Now from some points of view smoke shadow turns into bunch of lines.
How does billboards facing the camera? Does it made with java code or vertex shader?
For some reason shadow painted absolutely black on my material.
When I’m forcing it to use PostShadowPSSM.frag instead of PostShadowPSSM15.frag it paints shadow as it should, with ShadowIntensity = 0.7, but with that it ignores alpha transparency.
they are facing the camera from what I can see in the screenshot. And particles do that automatically (so do billboards). Maybe I am missing what effect you want.
you will only get solid shadows, jme does not support soft shadows
I’m not sure what you mean here, do you have an example of what you want to achieve?
When shadows are enabled, the whole scene is rendered twice from two different cameras: orthographic shadow camera (z-buffer only) and normal game camera. Here is another pic of how it looks, when “sunlight” comes from the side. Particle shadows becomes thin lines. So I want them to face shadow camera, when shadow maps are rendered, and turn back to normal game camera, before rendering frame buffer. That way shadow shape will not be affected by game camera position.
Yeah, I know, I even turned off alpha blending on particles. I’m talking about shadow Intensity. Compare shadow darkness, on landscape and particles. (I must be missed something in my shaders)
I’m talking about using alpha channel as depth for each particle. So when they intersecting other geometry, they bumping out (like soft particles, but without blending). Well, never mind. I guess, it’s impossible to make in one render pass.
Well if you could try to use the pointmode for particles, they are automatically faced to any camera. Or you could use a vertex shader to turn your elements.
Changing the facing on the scene graph between different camera/viewport renderings is probably illegal behaviour, since you would break the geometry update stuff.
Is this the default ppsm shadow stuff, or do you use a own custom version btw?
You could fake it by doubling up the billboards. Look at the difference between sun and camera position and if it’s more than X then create a billboard for each.
Other than that I guess you’d have to identify where in the render loop the two renderings are done and insert code to change the billboard in between the two.
you’d have to make them face the camera yourself. The particles act as billboards and are oriented to face the camera during the update loop. You render the shadow maps just after…so you’d have to iterate over the particleEmitter in the shadow cast queue and rotate the particles to face the shadow cam. Then after the shadow map render, rotate them back to face the view camera…
That’s far from optimized but that would work.
Another approach would be to make them face the cam in the shader. It should be possible with some math tricks to get a rotation matrix and to multiply the inPosition by this matrix instead of the WorldViewProjectionMatrix. It would be faster and would have no effect on the scene graph.
2)Soft shadows are not what you seem to believe they are.Soft shadows offers the ability to smooth the shadows edges with some filtering/blurring. We do support them with several algorithm (PCF4/8, Dither, Nearest, Bilinear). Your problem seems to be that the intensity is not properly applied on particles, and that looks like a problem on my end.
3)Shadow maps are depth maps. No sure I understand what you mean neither.
The built-in jME3 particle system already orients particles toward the camera (I assume you’re using your own). You can look at ParticleTriMesh class to see how that happens.