- Home /
Billboard in front of 3D object
Hello everyone, I am currently facing a rendering problem. In our game, the character is a sprite rendered on a plane, living in a 3D world. The plane is a billboard always facing the camera, camera which is over his head. So, the plane is almost horizontal to show a character standing vertically. It provokes visual problems when the billboard goes through a wall.
To prevent this, I made a shader changing the offset, giving our character a little more space.(Shader is Cutout diffuse with "Offset 0,-150" added)
for the walls, the solution works, but when the character is next to anything, it hurts my brain.
Since the player is behind the cube, the shadow is rendered on him, but because of the shader, the head of the player is rendered above the cube.
I don't really know how to ask the question (probably part of the reason I can't find the answer) Does anybody knows how I could have my character feel like he's vertical ?
Answer by Tarlius · Oct 24, 2013 at 09:34 AM
This was asked a while ago but I couldn't find the post either >.> There are a few approaches to this problem, each with their own catches.
The easiest way will be to set layers so that the sprite will alway be drawn on top of the background. The catch is it will only work for simple cases.
Another approach is be to skew the sprite so that its always upright. Catch is that your sprite may look odd and shadows might look weird
The most realistic way to do it would be to have a separate texture to represent depth and a shader that calculates whether each pixel should be drawn. This is the approach that The Sims used for the furniture/etc. The catch is it will be a pain to implement.
Thanks, I already thought of each solution, and of course, the one that I would like to be able to implement is the last one, I'm already trying to work on it.
Answer by JonahStrix · Feb 17, 2015 at 07:27 AM
The best solution I could come up with was to use cylindrical billboarding for depth calculations and spherical for the quad's actual position. This allows you to use spherical billboarding while ensuring the quad's depth remains constant.
If needed I have more details here.
Answer by brokilodeluxe · Mar 18, 2018 at 06:42 PM
Did you ever come up with a fix for this?
I've been playing with shaders for the past week and just cannot figure it out.
Your answer
Follow this Question
Related Questions
Billboard in front of 3D object 2 Answers
How do I display a web page on a cube 2 Answers
Billboard grass rotate weird 1 Answer
Lookat on local axis 2 Answers
How do I Fade Terrain Tree's to Blend with Billboard? 1 Answer