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 Discussion / Need help with expanded Z buffer control

Author
Message
Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 21st Dec 2009 18:52
Hi, I'm having some issues with my game Dream. specifically the ghosting commands get kinda funky when light and dark ghosting overlap, which is unfortunately how I generate a lot of effects.

Usually I can find a way around this after some tooling around, but I've come to an impasse. I'm trying to dark ghost my text over a text bubble, both which are 3d objects. They are not locked to the screen, but rather in the world with their zdepth disabled. I cannot consistently get the dark ghosted text to be drawn over the white bubble. I'm using the ghosting to created a painted effect with the bubble.

Now, it I have to, I can rewrite how the bubbles work, and everything should be fine. But I'd rather just make the dark ghosted object appear in front of the light ghosted object.

The only thing I haven't tried I think is more advance control over the z buffer, allowing for more than the 2 disable object z depth does. If anyone knows the answer, or has solved a similar problem differently, please help!

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Dec 2009 23:02
If you are using DBC version 1.20, the ghosting becomes sensitive to the object material settings (set object ambient, set object emissive, set object specular, set object diffuse).

If you have a screenshot of the effect you are describing that is failing, it would be easier to suppose the problem. But in the meantime, the following example shows how a dark ghosted plane becomes more solid (less transparent) as it's ambient level decreases. This demonstrates that the transparency is not only affected by the colors of the texture used on the 3d object, but also by the 3d objects material lighting properties:


Now, for something like text bubbles, or boxes, you might want to control the emissive setting instead of the ambient. The emissive setting will allow the object to have it's own lighting intensity (glow if you will) and not be subject to the environmental lighting; so it may be a better choice to have the ghosted objects set at maximum emission (emissiveness? , emissivosity?)

Enjoy your day.
Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 21st Dec 2009 23:21 Edited at: 21st Dec 2009 23:23
well, the game actually contains no lighting whatsoever. it is 1.20, but I have the majority of the lighting at fully ambient 255. If I could turn off lighting on most of my object, that would probably be better though.

This is essentially what the problem is:

I fixed that error, but the solution is inconsistent with this new problem. The text bubble is one object, and the text is another object, in front of it. The bubble is ghosted white, and the text ghosted black. The text must be ghosted now, as the bubble behind it is textured a bit and you can see what is behind it slightly.

What I need to be able to do is specifically tell db which I want to be shown in front of which. Both already have their zdepth disabled, and must be so.

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Dec 2009 00:55 Edited at: 22nd Dec 2009 05:45
Quote: "What I need to be able to do is specifically tell db which I want to be shown in front of which. Both already have their zdepth disabled, and must be so."


[EDIT]
When you disable zdepth, there will be two levels of objects: those that have the zdepth disabled, and those that do not. The ones that have the zdepth disabled will function within their own plane with other objects that have their zdepth disabled as if they are regular objects. They will be in front of each other based on their physical relationship to each other and the camera. However, they will all appear infront of any zdepth enabled objects.

So if you had a plane and a sphere with their zdepth disabled, which ever one was closer to the camera would be in front of the other one. So you would have to manage their positions yourself. That means rotations too.

Be aware that disabling the z depth doesn't make the objects face the camera. If the objects are at an angle not facing the camera then you are liable to see areas that you did not intend. The smokey doorway in your picture seems to be a side view of a box with maybe a plane in front of it, but since they are not facing the camera, we can see through the side of the box so the portal doesn't look quite right. [/EDIT]

In regards to the material settings, I'm not addressing lighting in the scene per se, I'm addressing an object's reaction to any light in the scene. Ambient light is always present unless you color it to 0 . Emissive is the light the object generates on it's own - kinda like an LED - but the light isn't cast out to other objects.

Before abandoning the material settings idea, try this: Let's say the dark ghosted object is the one with the text. Make sure the background of the text for this object is pure white (rgb(255,255,255)). This will allow any other colors to show through the areas without text. Also, set the dark ghosted emissive setting to SET OBJECT EMISSIVE object,rgb(255,255,255). This will make sure that white is actually white and completely see through for the dark ghosted object. The regular ghosted object you can just leave as is. Of course disable the z depth on both. This combination should allow any colors to pass through both objects, and allow translucency for the regular ghosted object and any text that isn't completely black on the dark ghosted object.

So to determine which is the front object, and which is the back, based on the settings described above the dark ghosted object would be considered the front, and the regular ghosted object would be considered the back

Here's a quick example:



Enjoy your day.

Login to post a reply

Server time is: 2024-04-26 03:53:31
Your offset time is: 2024-04-26 03:53:31