Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hi! I really really like the asset as of now and it was really easy to setup. I have two issues at the moment, however:


1. Maybe I'm misunderstanding how to use sprite shadows, but it seems they always have the same depth. If I have two trees with one behind the other, is there any way to have the sprite shadow cast to also "hit" the tree behind? Maybe I'm missing something here, but I can't figure out how to have different depths for sprite shadows. If this is not intended, is there some workaround?

Also, is there support for the shadow being distorted by the object behind? So for example, if part of the front tree's shadow hits the tree behind, the shadow would not be cast in the same wayas on the flat ground but look a little distorted (on the tree behind)


2. Is there a way to have a fall off for sprite shadows? Kind of like a mixture between the shadow for the character in the top down/castle demo and a sprite shadow.


Thanks in advance for any help!

Hello!

- What determines the depth of sprite shadows is the depth of the ShadowGroup, since sprite shadows are drawn inside a surface, to apply a blur later (if desired).

Remember that all these shadows and lights are 2D simulations with depth, and do not work like in 3D, where the shadow reaches everything dynamically, so it can be a bit tricky to adjust the depth, unfortunately this is a problem in 2D games in general.

- This is only possible for Vertex Shadows currently.

You're welcome ^^

Thanks for your quick reply! :)

Ahhh, I see. Performance wise, is it an issue to create a group per sprite shadow/object to have individual depth values per shadow? 

Can we access the buffer/surface the sprite shadows are drawn on and render them individually?



Also, ist it possible to find out whether and where an object is collides with a (sprite) shadow? This would be interesting because - if there is access to the sprite shadow buffer(s) - the shadow could be distorted by other objects behind the one that casts the shadow to mimic a more three dimensional shadow.


Vertex shaders look really cool, but they act more like occluders, right? Or are the mesh shadows able to cast shadows similar to sprite shadows where there is a certain shape to them?

Creating a group for each shadow would be extremely cumbersome, since it would mean 1 full-screen surface for each shadow.

I was looking at the code and it looks like I can add depth support via the depth buffer. This would make it possible to have just 1 group with multiple shadows at different depths. I'll look into that later.

You can detect collisions with shadows and lights using .GetLightsCollisionAt()

Yes, all shadows have the functionality of blocking light, except sprite shadows, which also allow drawing in ambient occlusion pass.

(2 edits) (+1)

Depth support via the depth buffer would be amazing, thanks for looking into that!

I see, so only when using vertex shadows, you could have objects blocking light? My only issue with vertex shadows is that they seem to be less fitting for games with a 3/4 perspective whereas sprite shadows look more natural to me in those settings. But I'll look into what you can do with vertex shadows a little more.


Edit: This video by FriendlyCosmonaut shows the type of shadow I'm trying to integrate. Thag's only possible with Sprite Shadows, right?

It is possible to create this type of shadow with vertex shadows as too, but you would have to draw the shape per vertex. Otherwise, yes, Sprite Shadows will use the shape of the sprite. In the next Crystal update, there will be a function that creates vertices based on the sprite's outline.

(+1)

That sounds awesome, looking forward to it!

Hi! Do you have an update on when the next version with this feature might be released approximately? Thanks!