Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / d3d_line function z buffer problem

Author
Message
JoeOh
17
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 5th May 2010 03:41
I am using the d3d_line function to create a grid of reference lines for a physics program I am working on. I also have a "brush" object that I have turned wire-frame mode on and turned the brush's z-depth off so it will be visible behind solid objects.

The problem comes about when the brush object is in the camera view. When that happens the d3d_lines lose their z-depthness. When the wire-frame brush object leaves the camera view the d3d_lines z-depthness returns to normal.

Any clues?

Home is where my souped-up computer is...
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th May 2010 01:32
What do you mean by a "brush" object?

Quote: "I have turned wire-frame mode on and turned the brush's z-depth off so it will be visible behind solid objects."

I thought turning z-depth off made it visible 'in-front' of solid objects not behind them?

I'd guess that you are expecting the lines to be drawn after the brush object which might not be the case...?

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 7th May 2010 01:46
Screenshots?

Do you mean the 3d lines? d3d_line is just a line on the screen. The problem probably is that the command drawing the lines for a wireframe object is called after d3d_line (DBPro internally). If that is the case, I'm not sure there's much you can do... pasting an image might work?

Still, I'm not 100% sure what the problem is.


baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th May 2010 10:45
Quote: "Still, I'm not 100% sure what the problem is."

Me either, but I was assuming he meant "d3d_line3d" as this can be drawn with or without z-depth and be placed using world co-ordinates rather than screen.

JoeOh
17
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 7th May 2010 19:40
yea, I did a typo. I am referring to the d3d_line3d function.

I have the d3d_line3d function as having their z-buffer always on. But when my brush objects (which has z-buffer turned off for only that object) the d3d_line3d grid loses it's z-buffer when the brush is in the camera view. Once the brush leaves the camera view the 3d-lines regain their z-buffer placement.

Home is where my souped-up computer is...
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 8th May 2010 01:25
Yikes. In that case... That does not sound like an easy fix. I would say... First try to figure out whether it's the brush object having z depth off or if it's the brush object being in wireframe. If it's wireframe that's causing the problem, then I'd create a partially transparent texture. If it's the z-depth off... then I guess I would create my own draw_wireframe function. Doesn't sound like something 100% diagnosable or fixable within the confines of DBPro.


Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th May 2010 01:35
The problem is that the d3d plugin is not re-enabling the z-buffer after dbpro disabled it for your brush object.

You could try creating another object with a higher object number which has the z-buffer enabled and make sure it is on-screen at all times.

JoeOh
17
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 8th May 2010 21:59
Neuro, Yea, I just tested the brush by temporarily taking out its "disable object zdepth" function and sure enough the 3d lines work as expected. I need to have the zdepth on the brush turned off so it wont hide inside of spawned solid objects.

So yea, "Yikes" is right. I'll just let it slide for now until I can find something better or the bug is fixed whenever that may be.

Home is where my souped-up computer is...
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 9th May 2010 05:30 Edited at: 9th May 2010 05:32
if what diggsey suggested didn't work, then you could write your own draw_wireframe function. Putting a dot at each vertex wouldn't be too hard, but I'm not sure about lines connecting em. never worked much with vertexdata stuff.

it'd be something like this:

I think that should work as-is, but i'm not quite sure. Never really used the project vector3 command before.


Login to post a reply

Server time is: 2026-07-26 02:37:07
Your offset time is: 2026-07-26 02:37:07