Mardok
Member
|
[SOLVED] Billboard draw3D rendering order
Hi guys i need some advice,
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.)
|
|
09-17-2016 02:09 AM |
|
Esenthel
Administrator
|
RE: Billboard draw3D rendering order
Can you attach a zipped esenthelproject of this app?
I will test what's wrong.
Also: why are you setting an invalid color parameter?
"Color()"
Try using WHITE, maybe that's the problem
|
|
09-17-2016 02:28 AM |
|
Tottel
Member
|
RE: Billboard draw3D rendering order
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.
|
|
09-17-2016 08:37 AM |
|
Mardok
Member
|
RE: Billboard draw3D rendering order
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.
TY guys for your time. Have a nice day
|
|
09-17-2016 12:50 PM |
|
Mardok
Member
|
RE: [FIXED] Billboard draw3D rendering order
UPDATE
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-18-2016 07:51 PM |
|
Esenthel
Administrator
|
RE: [OPEN] Billboard draw3D rendering order
well you're disabling depth buffer usage, so you need to remove your lines:
D.depthLock(false);
D.depthLock(true);
|
|
09-19-2016 12:01 AM |
|
Mardok
Member
|
RE: [OPEN] Billboard draw3D rendering order
|
|
09-19-2016 01:39 AM |
|
Esenthel
Administrator
|
RE: [OPEN] Billboard draw3D rendering order
You can draw sprite moved towards the camera by distance equal to "radius" of the mesh sphere.
|
|
09-20-2016 12:14 AM |
|
Mardok
Member
|
RE: [OPEN] Billboard draw3D rendering order
Yes i'm using this method to achieve expected result. I made this thread cuz i thought there is some different method. Ty for clarification.
|
|
09-20-2016 04:43 AM |
|