Trying to Introduce Realistic Shadows


#1

Hello All!
The tutorials I found, regarding shadows in GDevelop, were either showing how to put shadows on text, or showing how to just put a black dot (cartoon shadow) under the character. I want the shadow to actually animate with the character. I can export characters from iClone casting a shadow, even on a transparent background. Once in GDevelop, however, the shadow changes to a very light color. Is there any way I can change these animated shadows back to black?


#2

Is your shadow black with the opacity down, or is it grey with the opacity down? For this, you would want it to start out as 100% solid black, then bring down the opacity.

When you put the exported image with transparent background on top of images in other programs (for example, Photoshop), does it look as intended?

If you post the actual image you’re using in your sprite we could test it and see if it’s a problem with the image itself, or just something that’s happening in GDevelop.


#3

Is the shadow part of the image to be semi transparent in the saved image? Are you saving it as .png (and not .jpg)? And at 32 bit (not at 24, 'cos that will lose the alpha channel)? As @beanmatt wrote, could you post one of the images that you import into GDevelop?

Because from your image above in this post, the shadow appears to be a solid/fully opaque mid grey. It’s like the transparency of the shadow was removed/lost (again, assuming it was a semi transparent in the first place).


#4

Running This is the render (png) from iClone, with the shadow casting on a dummy floor. It is just occurring to me that the shadow, with opacity down like this, may just register as “light gray” in Gdevelop. That is, it doesn’t seem that GDevelop sees the shadow as “low opacity”, as the darker floor in the game doesn’t show through the shadow at all.


#5

This is a little crude, but see if the attached image works better to achieve what you want. The image you’re using has a grey shadow with transparency. The image I’ve attached has a black shadow with transparency. Maybe swap it in and see if it works better?
new%20shadow%20test


#6

your shadow is fullcolor, not transparent. and the shadow color is lighter then your background.

So you ether use a lighter background, or open your sprites in an image editor (like gimp) and make it black.
or you change your shadow settings in iclone
i found this with a quick google


#7

No, the image shadow is transparent. I’ve taken the image into paint.net, and used the colour picker to select the shadow:

image

I’ve darkened the shadow to transparent black, and still the same issue exists.

I think the blending algorithm used by GDevelop may not be correct for this scenario


#8

Hmm, that’s odd.
Pretty sure i used transparent images before without any trouble.

Maybe some alpha channel overlapping issues?


#9

Does this thread help at all?


#10

I put the background from the original post and the altered image from my previous post into GDevelop, put one on top of the other, and got this:
newtestagain
Which I assume is more what @MrWmJCarey is wanting. If you zoom in on their heads you can see the floor beneath coming through. I, too, have used transparent black PNGs before and never had any issues.


#11

Thanks for all the help! In the end, I just maxed the opacity of the shadow in iClone and reexported. Luckily, the black shadow actually works for this “space station” environment. Now I need to reexport all of her animations with a full opacity shadow. Excuse the marbled “blocks”! I am trying (unsuccessfully so far) to block off the areas she can’t walk on. The background images are 2d, so I can’t have her walking over walls or anything! So far, she is just walking right over the “impassable obstacles”. The character originally started with just “top down movement” behavior, but now I have added “pathfinder”, as well as put pathfinder obstacle/impassable object on the block, but again, it’s not working so far. Any hints? And when I finally get the collisions right, can i just “hide” the obstacles from view?


#12

I get the feeling you’re not using the pathfinding behaviour as intended. It’s for NPCs - you don’t control the object that has the pathfinding behaviour. It gets updated automatically. The pathfinding obstacles are only for the function that calculates the path and only avoids blocks when the ‘Move to position’ action is used. It doesn’t prevent a player character from going over them. You’ll need to use the collision events and move away from actions to control that.

And yes, if you hide an object, it just doesn’t get displayed. It’s still there and collide-able, but just isn’t rendered to the screen.

[edit]
BTW, if you want to continue this topic, I suggest you start another thread. Makes it easier to find for anyone else with queries about pathfinding.


#13

Hello again! I actually did also post the collision problem as a new topic. As long as I’m talking to you here though, just one more thing. I removed the pathfinder behavior from the character and the pathfinder obstacle behavior from the “obstacle”. No behavior on the obstacle? And I’m assuming my condition and action are also problematic?


#14

No behaviour needed on the obstacle. You’re not using the pathfinding functionality.

As for the collision event, don’t use “Stop object”, use “Separate two objects” on your character (aka Move object1 away from object2).


#15

Thanks! That was it.


What am I doing wrong with my (not) impassable objects?