- Home /
Billboard in front of 3D object
I'm starting to develop a poc with the main features of a turn-based RPG similar to Breath of Fire 4, a mixture of 3D environment with characters and items such as billboards.
I'm using an orthographic camera with an angle of 30 degrees on the X axis, I did my sprite to act as a billboard with the pivot in the center, the problem occurs when the sprite is nearing a 3D object such as a wall.
I searched the forum and found a similar thread: link text
I had tried the solution leaving the rotation matrix of the billboard "upright", worked well, but of course, depending on the height and angle of the camera toward the billboard it gets kinda flattened, I also changed the pivot to the bottom of the sprite but this problem appears with objects in front of the sprite too. I was thinking that the solution would be to create a fragment shader that relies on the depth texture of some previous pass, I tried to think in how to do it with shaders but I could not figure it out. Could you help me with some article or anything that puts me in the right direction? Thank you.
I am still trying to find a good solution, anything would be really appreciated.
Answer by karljj1 · Nov 27, 2013 at 06:05 PM
You could render your characters with a second camera with depth only clear and draw it over the scene however the character would always be on top.
Alternatively keep your characters pointing up with no angle and simply make your sprite textures squashed so that they look like they are at an angle.
Hi, I thought to do it but that is not the functionality that I am looking for I still need that obstacles in front of the character hide him. Any ideia? Thanks
Can you not just have your character point up like the wall and play with the texture so you get the same perspective?
I left the billboard with a updright basis and I scale the Y axis of the billboard to 1.1547, it is (1 / cos30), which makes billboards look like original size from the camera with the angle of 30 degrees, but I don't know if it is the best solution.
That sounds like a good idea to me, I don't see any issues unless maybe you need the character to go under things such as a bridge?
If so I should take care about the height of the bridge to not touch the top of the sprite but I don't consider it a big problem.
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.
This link is dead.
Do you have some sort of summary of the defunct page?
Your answer
Follow this Question
Related Questions
Billboard in front of 3D object 3 Answers
Can I make a billboard plane on terrain tree prefab? 3 Answers
Billboard script 1 Answer
Billboard script restrictions 1 Answer
Efficient mesh instantiation 2 Answers