I am working on the shadowing of a forest scene that I generate in JME, and I want to see how it’s possible to include a shadowtexture in the terrain material (just the terrain, NOT on the whole scene) based on the shadows from the whole scene (trees etc …) since it seems such a waste to calculate that static shadowing in real time
From reading the various threads regarding shadows generation in JME, such as these
Sure I could generate in blender or other tool a shadow texture for the whole terrain, but that would not include the shadows of all static elements from the terrain (such as the trees) that I am generating in JME. I have searched the forum to see if there would be any way to export the jme scene to blender but couldn’t find much
The shadow render pass in JME works nicely but there is no straightforward way to retrieve and export the shadow projected on the terrain by the whole scene (the system is thought to create shadow from the observer point of view)
So calculate (render) it once on the first frame. Or render it each time some ‘control sum’ is changed. I’m doing it this way in my game, Skullstone - For every light source I have 6 objects which contains shadowmap, camera and some control sum. Every frame and for every shadowmap I calculate an actual control sum using states (translations, animation time and so on) of every geometry in frustum. Then I compare it with the previous control sum. If they are equals I skip the rendering.
Assume the scene never changes, so the first frame would be the first frame of the game and that’s it. But then, probably I’m missing something but to me the render depends on the camera, no? How do you make that post rendering work for any camera position on the scene?
Yes, but presumably your camera position does… and presumably your scene is large enough that you want detailed shadows up close and not-detailed shadows far away. Versus not-detailed shadows up close and far away.
That was my doubt as well and from @FrozenShade answer, I assumed it should be feasible modifying the renderer (haven’t looked at it yet)
Regarding the size of scene and different quality of shadows, sounds quite reasonable, but how do you do this? Through creating 2 shadow renderers and playing on which part of the scene shows the render of which?
,…you use the stock shadow rendering which already does this.
In an open forest environment, you either have ugly static shadows, 4 gig of RAM pretty static shadows, or use the dynamic renderer and have pretty shadows up close.
One last thing, using that “all over the map shadow” I see a significant drop in fps, can you confirm this is expected and if I may be missing an obvious optimization?
Going from something like 220 fps to 20 on a config with a GeForce GTX 480/PCIe/SSE2