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 / The secret of glowing graphics?

Author
Message
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2010 22:10
Without simply answering "use shaders"...

What is the secret to making graphics neon-like and glowing? For example, in Audio Surf?



And can it be achieved with 2D graphics, using just images not objects? I know the answer is yes, I just can't find the examples on the forum.

Other examples are the Binary Zoo games, written in DBP.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Oct 2010 22:25
Transparent pre-rendered sprites perhaps?

For example, I guess the lens flares in that image could be made using pairs of rotating semi-transparent sprites.
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 19th Oct 2010 22:31
You can write your very own little function for that, with grabbing the screen per every frame and analizing it to find out where are the highlights / or special objects/areas you want to be glowy. And then place the newly created picture in front of the camera onto a ghosted, locked plain.

Gonna be just as 'fast'... slow as with the use of shaders.

In case of only spotlights' glows and glares, you shouldn't do this inefficient way, in that case use raycasting for example with Sparky's dll, and detect if there is anything between the camera and the spot where the light / or sphere like glowy object is. And then hide or show the locked on glow plain according to this. Of course you should optimize it with only casting rays for light sources that are on the screen right at the moment. This way only the ghosted plains' processing needs is the only thing that will harm the speed of your program.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Oct 2010 22:57
You should be able to control your 3d object settings using material commands. The goal is to have the object behave as if it has it's own light source and that is a function of the emissive control. The idea is to setup your textures so that any fade-off or highlights are built in. You eliminate any response to ambient light and possible diffuse. In theory you should be able to use specular as well for extra glare but I'm not sure how that would behave.

Here's a quick example with the most basic of textures so it's not fancy at all



Enjoy your day.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2010 23:04 Edited at: 19th Oct 2010 23:08
quick responses - thanks chaps.

I've created a little experiment with 2D sprites to see the effect of overlapping transparent images. Obviously I can't Ghost sprites. You can change the transparency of the squares with the up/down arrows.

The effect doesn't quite work, although admittedly it's a fairly basic test. If anyone can build on this then please go ahead!



Quote: "The goal is to have the object behave as if it has it's own light source"

Yes, that's a perfect explanation and your example is just what I'm looking for. If I can do this in 2D then I've cracked it, I'm working with Box2D so I can't use 3D plains in place of images unfortunately.

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Oct 2010 23:10
Ooops, I missed the 2d part in your Original Post. Do sprites have material controls? Aren't they actually 2d plane objects?

Enjoy your day.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2010 23:24
They are 2D plains yes, but they don't have the commands to alter them in the same way.

I should clarify...when I asked not to get a reply of "use shaders", I am happy to use them, I would just need more information on how to apply and what to apply.

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 19th Oct 2010 23:49 Edited at: 19th Oct 2010 23:51
Disable the background, then post a semi-transparent sprite over the top every frame. This will cause a nice blur type effect here the backdrop is shown.

To get a glow type effect, Do the same as above, but get the screen, then paste it back slightly larger than the screen instead of the black sprite.

My signature is NOT a moderator plaything! Stop changing it!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Oct 2010 23:58 Edited at: 20th Oct 2010 00:28
Quote: "I should clarify...when I asked not to get a reply of "use shaders", I am happy to use them, I would just need more information on how to apply and what to apply."


Now that's a different question altogether.

A post-process bloom shader might be what you want. A bloom shader can be set up so that bright parts of the scene "bleed" into neighbouring pixels which is apparent in your first image. The emissive properties that others have mentioned will help but the brightness won't extend beyond the objects' boundaries. Bloom will do that.

You can make it selective too, i.e. it doesn't have to be a full-screen bloom. The basic technique would be similar to the heat haze effect discussed here:

shaders with heat haze and bloom

Edit Added quotation to clarify.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Oct 2010 00:17
This is sounding good, I may need to throw a few of these things together to get the full effect but it could be an impressive result. Removing the backdrop will also help my cause to get some motion trails.

Now to create my little game and apply these effects, I'll keep you posted!

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Oct 2010 06:46
Depending on the game and complexity of the graphics, you could just use grayscaled PNG images with sprite diffuse.


"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke
General Jackson
User Banned
Posted: 20th Oct 2010 07:49
I would use a fullscreen bloom effect, or if you only want certain objects to glow then just assign a bllom effect to the objects you want to glow.
I would also use a motion blur shader, just make sure it doesnt blur too much. It will help it glow more

The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 20th Oct 2010 14:39
Hum, I'm not sure if this is the effect that you're looking for, but here's an example of a neon effect without a shader.

Cheers

Slayer rules!!! Yeaaah, man!
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Oct 2010 17:46 Edited at: 28th Oct 2010 17:46
This is only draft graphics, but it's looking good.



Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Oct 2010 18:20
You can accomplish a lot without shaders simply by using additive blending (what ghosted objects use). In DBPro you may need to use 3D ghosted plains to get proper additive blending. (You'd have to use the correct transparency mode, or disable object zdepth)

[b]
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Oct 2010 18:51
Thanks Diggsey. That would be nice, but I'm using your Box 2D so I can't use plains!

BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 29th Oct 2010 04:22 Edited at: 29th Oct 2010 04:24
@Diggsey - I would love an example of what you are talking about, ghosted plains with alphablending
I also have your Box2D but haven't had a chance to use it yet
Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 1st Nov 2010 03:04
Those trails look nice, but was that the glowing effect? if so i misunderstood then....

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Nov 2010 10:27
I suppose I have reached "bright", but not quite glowing

I plan to add a full screen bloom effect as an option, as the target machines may not handle shaders.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 1st Nov 2010 13:33
Quote: "I'm using your Box 2D so I can't use plains!"


I don't follow your reasoning there

You can use whatever you want with Box2D, even this:


I'll see if I can make an example of additive blending

[b]
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 1st Nov 2010 15:19 Edited at: 1st Nov 2010 15:23
OK, this example has a few of things which can help make glowing graphics:
- Additive blending (only very simple rectangles in this demo since it's media-less, but it shows how to do it)
- Simple way to do trails
- Intersect with normal objects

To intersect correctly with normal objects, they use transparency mode 2 (draw after normal objects) and 'disable object zwrite' (don't write their z values to the depth buffer when drawing them). This means that they can be obscured by normal objects, but not by each other.



[b]
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 1st Nov 2010 15:40
One little addendum...
If your using transparency mode 2, and disabled Zread or write - then you might have problems getting things layered appropriately. For instance, new objects might not appear in front of other Z-tweaked objects. I found that adding limbs to an object is a good way to layer it - because I think it will check the object for Zdepth within its self. So if you have a foreground plain for instance, and are having problems adding sprites on top, like for a score display - then add the plains as limbs and it should give you control back.

I'm using the trans mode 2 etc, and have had a nightmare, trying to get layers in the correct order etc - to me it seems that adding limbs will draw them in sequence regardless of their Z depth, so it is possible to enforce your own Z order using limbs.

Health, Ammo, and bacon and eggs!
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Nov 2010 19:23
Thanks Diggsey, I hadn't thought of dispensing with attaching images and actually using 3D objects!

Login to post a reply

Server time is: 2026-07-22 04:37:50
Your offset time is: 2026-07-22 04:37:50