Example: I need to draw 3D sphere mesh and billboard image with some blue aura effect but i dunno how to achieve correct rendering order. Billboard should be in the foreground, mesh in the background (billboard pos = mesh pos). I'm experimenting with D.depthLock and D.depthUnlock and in one case achieved effect on PC is exactly what i need but on mobile isn't. I dunno if i'm using depthLock and depthUnlock correctly, it's just experiment. Is another way to achieve this? All advice welcome.
Unwanted effect - mobile
Expected effect - pc
For test i modified Rendering/01 tutorial:
Code:
ImagePtr billboard;
void Render() // Rendering Function
{
switch(Renderer())
{
case RM_BLEND:
{
D.depthLock(false);
billboard->draw3D(Color(), 1.35, 0, MatrixIdentity.pos);
D.depthLock(true);
}break;
case RM_PREPARE:
{
if(Frustum(mesh.box))mesh.draw(MatrixIdentity);
}break;
}
}
(This post was last modified: 09-20-2016 04:44 AM by Mardok.)
Just an idea, but your billboard texture is not a power of two. I don't know how much that would matter, but you can try enabling "power of 2" in the texture.
Yes you are right Tottel. The image should be 64x64. I made a mistake when exporting frame to png. It wasnt a problem for PC GPU and i was sure that evrything is ok with texture.
Hello Guys, i need some help, tips or explanation one more time.
Is there some depth sorting method for rendering billboards via Image::draw3D? Something like BlendObject::scheduleDrawBlend(Vec &pos) for mesh parts or something like D.textDepth but for Image::draw3D?
Im experimenting with 3D objects + 2D sprite animations and i have no idea how i can get better control what and when is rendered.
The following pictures shows the problem.
Is there any solution to render billboard (RM_BLEND) with position same as mesh in the background but covered by mesh in the foreground?
(09-19-2016 12:01 AM)Esenthel Wrote: well you're disabling depth buffer usage, so you need to remove your lines:
D.depthLock(false);
D.depthLock(true);
Hmm i try better visualise the problem.
Try imagine if we have game where we control 3D sphere mesh + sometimes we want render effects based on sprites rendered as billboards in RM_BLEND mode. So we expecting our billboard cover our BALL mesh but other 3D buildings shoud cover our billboard, how achieve this?
Without any depthBuffer lock operations rendering look like this, i know its correct but im asking about situation when sprite cover only our ball not other 3D objects.