I’m using Panda3D for a few years now, and I’m trying to write a simple game to write a tutorial series.
The game is almost done, but I can’t figure out how to have drop shadows. I tried several solutions:
- the “default” solution, using set_shadow_caster() and render.set_shader_auto() : the shader generator works great with everything, except for drop shadows (I tried several resolutions, from 512 to 8192);
- the solution offered in the book “Panda3D Tutorial” by Fireclaw the Fox worked for a previous project (but sometimes stopped to work for no obvious reasons when I started to add geometry to the terrain), but I have not managed to make it work for this project;
- I tried other solutions, based on the sample program (converted to GLSL), but it seemed to be too specific and I could not manage to make it suitable for my setup;
- I tried also some other solutions implying GLSL, which I’m not really familiar with (I’ve only developped basic shaders): Shadows: direction, parameters, and inputs in GLSL but for some reason, it did not worked either.
I also looked at pure GLSL solutions, trying to port them for Panda3D but my understanding of rendering pipelines is not advanced enough to make it work.
My setup is simple: the terrain is composed of a rescaled cube, on which I apply a 32×32 solid color texture (this allows me to have a single cube model retextured and rescaled to compose my whole scene). In the center of the terrain I have a big “tower” (again, a very basic geometry), and along the terrain, many cubes representing obstacles (exact number is random, but should be around 2000-3000). The terrain is 1600m×1600m and the player is represented by a 1m×1m cube.
I use Panda3D 1.10 devel, with deploy-ng, installed with pip on Ubuntu 18.04 and last updated a few days ago.
So basically, what I need is a basic solution to have dynamic drop shadows on this terrain, acting in a realistic way (shadows should not be projected only on the ground, but also on other objects). A few particular cases I have: I use a particle system around the center tower, and the particles should not cast any shadows. Also, a portable solution would be great: I am working on an other project, in which I use a heightmap for the terrain (based on the shader-terrain sample), and what I dream of is a solution I could use there too.
The source code of this project is now a private gitlab repo (because I’m refactoring it, so I feel a bit ashamed of half the existing code ), but I can open it if needed
Thanks!