Does JME have shaped drop shadows?

And this still returns true?

    protected boolean isRequiresDepthTexture() {
        return true;

…you otherwise haven’t changed anything else about the class?

Because if depthTex is null then that indicates some larger issue. Not sure what would cause that if the filter still says it needs a depth texture.

Yes, that is definitely the line. I re-copied it in, and it is line 208 that is the problem.

Let’s see…

Looks like depthTex is null. Not sure why though. :confused:

Me either. That’s FPP magic outside of my normal realm of understanding. Seems unrelated to my class assuming all of the other parts are the same.

So, what do you suggest I should do?

You had other filters working? Which ones?

FXAAFilter, FogFilter, WaterFilter, TranslucentBucketFilter.

Many of those would have used depth also. Did you add them back? Do they still work?

You could always debug into them to see what they are doing differently but I know that my filter worked fine the last times I used it.

You could also try downloading the sim-arboreal editor to see if the drop shadow works in there.

Yep, they’re working right now. It just seems to be the drop shadows that fail as soon as I add them to the post processor.

What should I do to attempt to solve the issue? I’m sure I could spend an hour or so trying to work out what’s up, but I’m not sure what the problem is or what I’m looking for to try and solve it.

Looks like I can make it “work” if I replace prevFilterBuffer with sceneBuffer… Except for the fact that the shadow appears on top of the plane, not below it

The shadow seems very small though, and it’s not very strong. Is there a way to make it stronger and bigger?

Alright, 3 issues left.

The first one is that the shadows seem to disappear unless they are very close to the ground, but I would like them to appear even if a plane is fairly high up.

The second one is that the shadows are not intense enough. Take a look at this picture:

The shadow is barely noticeable.

The third issue is that the shadows seem to be much too small. I tried increasing the radius float, but that seemed to do nothing.

Oh and @PSpeed, I am continuing to use sceneBuffer instead of prevFilterBuffer… Not sure what the consequences of that are, but it seems to work for me.

Edit: What a convenient setShadowIntensity() method! :smiley:

Alright, all issues are solved, except the shadow is too small.

I will, of course, be working on modifying pspeed’s code, to give the shadows a shape in the future. However, this will work well enough for now.

Glad you got it working. I had to sleep for a while so I was not online. (One of the painful parts of being mortal. :slight_smile: )

The drop shadows were designed for characters that would be at or near the ground, like walking+jumping mobs, floating items, etc…

How it works is that it basically draws a big ‘cube’ stretched to the size of the models bounding shape and then rotated in the x,z plane to match. So long skinny objects will get a properly oriented long skinny shadow.

Inside this ‘cube’, it renders a sort of egg-shaped shadow blob… and yes, objects will self-shadow a bit which is generally desirable. This egg is rendered at some distance below the real object so that the upper part of the egg lightly shades the bottom of the object and the button intersects the ground or any other objects sitting there. (It’s the cool part of this approach that the drop shadow even works on bumps, slopes, fences, whatever.)

Shaping it will be tricky but not impossible… in the shader it basically uses kind of a ‘distance from center’ to decide how intense the shadow will be. You could cookie-cutter this with a texture or something.

Anyway, to solve your “make it darker when I’m higher” issue. You need only stretch and/or reposition the egg.

It sets up these parameters here:

            float scale = g.getWorldScale().x;
            float xEx = bounds.getXExtent() * scale;
            float yEx = bounds.getYExtent() * scale;
            float zEx = bounds.getZExtent() * scale;
            float volumeHeight = Math.max(yEx, Math.min(xEx,zEx));

            float xOffset = bounds.getCenter().x * scale;
            float yOffset = bounds.getCenter().y * scale;
            float zOffset = bounds.getCenter().z * scale;

            yOffset -= yEx;
            yOffset -= volumeHeight * 0.5f;
            yOffset += 0.01f;

volumeHeight will be the height of the egg and yOffset will be how far below the object it is. Just changing the volume height may be enough since yOffset adjusts based on that. You will still want the egg to intersect the plane some or else when you get really close to the plane the shadow will disappear. Actually, increasing the height like this may make that happen anyway if you make it really long. You’d probably have to make the egg lopsided inside the shader eventually if you wanted to add a lot of height.