Render passing through objects

Hi,



some of my object may pass through each other without collision behaviour.



But when it happends I would like to render them like superposed objects without modifying position (like 2D) rather than current ‘fusioning’ effect.



Is there an option somewhere?

Do you mean the way the z buffer works when two objects are on top of each other?



What behaviour did you want instead? One always on top of the other?

Actually the objects are always at same z level (z = 0), that’s why they’re noticeably entering in each other when they meet.

I would like to set a kind of rendering priority so one is rendering as it is above the other (or, like you said, on top of the other).

Move one closer…

If you’re on the Gui node (or gui bucket) simply putting the right z order will work, as @zarch mentions. But, if you’re in “3D”, this might not work as it depends on how big your scene is too. If you have a huge sphere, for example, simply adding 1 or 2 to z probably won’t work because of the sizes.

Can you be more specific about what you are trying to achieve?



Otherwise you will get lots of random guesses as we try to figure it out. There are a few ways to solve the problem but they each come with significant downsides in the general case. Fitting the right down sides to your circumstances will be necessary.

All right, sorry if I wasn’t specific enough with my first posts.

This is exactly my case: I’m developing a 3d shoot’em up with a 2d gameplay (ikaruga, under defeat, gradius, …).

All the spatials are on same z level for colision detection purpose. But when enemies meet each other they are passing through each others and this is sometimes noticeable and not very pretty.

I’m looking for a way to render them such as superposed BUT still on same z level.

The only way I can think of is shifting them on the z axis when they pass each other.



Have you played little big planet? It’s 2D with 3D graphics (the first one atleast) but there are 3 z layers which you can move along.



I’m curious in your game if 2 enemies are superposed and you shoot once which enemy will take the damage? If both take the damage then it wont make sense for them to appear on different layers when they’re not.

Hi dolfin, I wanted to avoid such solution actually, this is why I wonder if there’s a rendering option which handle this issue.



To respond to your curiosity, a bullet disapears on first colision, then only one enemy is shooted.

Well apparantly there is software that can turn 3D into 2D… then you could use it as a sprite but i’m not sure if thats a good way to go.

Do you want it to act like two sprites when they overlap? That’s possible to do but that’s the part I couldn’t understand. What do you WANT it to look like when they overlap? Can you describe it better or show a sample picture… or is my first question right?

Well you need to make the enemies avoid each other in visual space. You can do that in any axis - either by adjusting their movement to go away from each other or by leaving the physics collision stuff where it is but when you detect two enemies in the same space move the image (but not the collision shape) up or down enough to avoid the merging appearance. So long as you don’t move them too far you should be able to give the effect you want without it looking odd.

i believe what you want to do is turn off depthwrite on the material



EDIT: meant depthtest

@cj45 said:
i believe what you want to do is turn off depthwrite on the material

EDIT: meant depthtest


That's where I was headed too... if the "sprite" look is what he wants.

You also then have to make sure that you carefully manage rendering order of the rest of the scene since the sprites will be drawn on top of everything.