Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 07:48:42 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Is there any good replacement for Unity's projector to implement blob shadow?
Pages: [1]
Print
Author Topic: Is there any good replacement for Unity's projector to implement blob shadow?  (Read 5296 times)
darkhog
Level 7
**


Dragon Agent


View Profile
« on: August 31, 2016, 07:08:30 AM »

As you may know, Unity's projectors have no concept of 3D so they go through walls until their "length" is reached. Which makes them pain to work with. Of course you can change their "limit" using data collected from a raycast and whatnot, but it's still a huge pain in the bottom when you try to just achieve simple blob shadows so the player knows where his character will land (think Mario64 and so on).

Anyone know a better and easier way?
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
oahda
Level 10
*****



View Profile
« Reply #1 on: August 31, 2016, 07:09:48 AM »

Various decal add-ons on the asset store. Maybe you can find a free one that suits your needs.
Logged

darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #2 on: August 31, 2016, 07:12:30 AM »

Wouldn't decal just stay on it? I don't want to "paint" on models with brushes, I just want move shadow around.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #3 on: August 31, 2016, 07:52:09 AM »

The best way would be is if someone would point me to an asset that would warp tightly specific model (say, multipoly shadow circle so shadows are crisp and nice) around all the other stuff (ignoring the circles themselves) by deforming vertices of it.

It's probably a bad example because they most likely use UE4's projectors or whatnot and certainly textures, but I'm thinking about how Rocket League's circle that's under the ball warps around world and the cars, only with warping actual shadow mesh so it's sharp from whatever distance.

Unfortunately my runtime mesh manipulation skills are none (not for the lack of trying to learn those, tho) so I can't do it myself.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
oahda
Level 10
*****



View Profile
« Reply #4 on: August 31, 2016, 09:49:39 AM »

I mean that the shadow would be a decal on the ground or whatever's below the character. Should work if all you want is a Super Mario 64 style circular shadow, which is how I understood your request. Maybe I didn't? :c Isn't Unity's projector basically just that, to project decals onto other things, only it's probably not as good as some other decal renderers are?
Logged

Polyspice
Level 0
*


My games at: polyspice.com


View Profile WWW
« Reply #5 on: September 10, 2016, 05:32:15 AM »

I am a little bit in doubt about the problem you are trying to solve?
If you are looking for a way to simply show where a flying character is going to land, your own suggestion with rays sounds like a really good idea? Why would you not just use that?
Logged

Check out my games at: http://polyspice.com
darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #6 on: September 11, 2016, 11:19:13 AM »

Because projector falloff. Either it will make shadows appear at the ceiling over player due of projectors having no sense of 3d or it will make it disappear when the projector is too close/too far away from the player. Also I'd prefer polygon-based shadow instead of texture/bitmap one as it would look crisp at any distance.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
bateleur
Level 10
*****



View Profile
« Reply #7 on: September 12, 2016, 01:48:15 AM »

If you want a crisp shadow you're probably best off just using a big bitmap. A 1024x1024 bitmap will look crisp everywhere.

A polygon-based solution will be horrible to get right because you'll need a lot of vertices to make the thing look smooth and each one will need to be separately projected onto the ground (assuming it's not flat). Worse still, even after you've done that the shadow will still be slightly off the ground or even slightly under the ground in places (because there might be a change in gradient of the ground between two vertices of the shadow poly). And that assumes you're only ever casting onto the ground and not other objects... which will look really weird whenever an object or character is standing in the shadow.

If for some reason you need super amazing shadows and don't mind a bit of technical effort, the really sneaky way to do this would be to write a shader for the ground that checks an array of shadow-casting objects and modifies the ground colour on a per-pixel basis according to whether the pixel is under a shadow. You could then do the same for any other object or character you wanted the effect to work on.

(Personally I'd just stick to projectors.)
Logged

Polyspice
Level 0
*


My games at: polyspice.com


View Profile WWW
« Reply #8 on: September 13, 2016, 03:13:22 AM »

Ahh... Smiley Now I think I got it Smiley The problem you have is that you have meshes below the one where you are walking (this could be multiple floors) since the projector will the cast shadows on each floor, this is a problem, if for example you are making a multiplayer shooter. Because then the other players will be able to see your shadow on the floor below the one you are on, is this kinda correct?

In that case, I would actually do like you initially suggested, make some ray casting and either place the projector based on that - or set the projector falloff.

I really believe that the projector is the correct solution for this problem - even if it takes a bit of tweaking! But maybe bateleur's suggestion about bitmap or shader is the right solution for you?
Logged

Check out my games at: http://polyspice.com
darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #9 on: September 13, 2016, 04:20:04 AM »

The problem is that it's really hard to control falloff of the projector since Unity's projectors are (compared to other engines that have them) very primitive. As for the shader solution, yeah this could work, unfortunately I don't have the time to learn about writing complicated shaders like that - can do few adjustments to them, even after playing around with legacy diffuse shader I was able to make toon shader that gives perception of "classic" cartoon, but nothing like that. Don't have money to hire someone to do it for me either so yeah.

Of course I could make circle mesh that would be placed based on raycasting and rotated based on raycast normal, but again, it wouldn't wrap around the stuff which would look bad. Maybe with the kind of game I'm making (link in my sig) this wouldn't be too big of an issue as Alpha Waves did just that, but I'd rather avoid it.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic