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 / Adaptive bloom shader by Bond1!!

Author
Message
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Nov 2010 23:46
A lot of people could benefit from this shader by @Bond1, thought I'd post this link here to make it easier to find for DBP users.

Simply awesome...

http://forum.thegamecreators.com/?m=forum_view&t=177210&b=24

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 3rd Nov 2010 00:54
Wow.

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: 3rd Nov 2010 01:59
Bloomalicious!!

Slayer rules!!! Yeaaah, man!
Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 3rd Nov 2010 03:20
Plugged right in to replace the DarkShader bloom in my game. Much better, not so washed out as the DS bloom and the colours are more vibrant.

Regards
Duke
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 3rd Nov 2010 04:43
How is this implemented in DBPro?

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 12th Nov 2010 12:27 Edited at: 12th Nov 2010 12:28
Hey great contribution here, thanks baxslash for letting us know!

Quote: "How is this implemented in DBPro?"

Just take the standard DarkShader bloom project and replace the original load effect 'Bloom.dbs' to the new one 'post-bloom.fx'.

Then in the code just feed the new shader variables and forget about the old ones, these are the new ones:



Tune the variables PreBloomBoost, BloomThreshold and PostBloomBoost to the values you want.

Also you can use any other full-screen shader technique around to apply this, not only the DarkShader way. There is a couple of examples in the 3rd page of the original post (link above).

Replacing for this new shader is almost straight! Cool
Now crediting Bond1

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Nov 2010 12:46
Thanks for that Morcilla, I had forgotten to answer the previous post! This would look great in your space application. Imagine watching a sun crest the surface of a planet with this bloom effect, nice.

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 12th Nov 2010 15:38
Hey no problem, I had pending to test this one

Quote: "This would look great in your space application. Imagine watching a sun crest the surface of a planet with this bloom effect, nice."

Well I just have incorporated it and I haven't watched this yet!
It looks very promising, so I guess I'll be posting some screens in the WIP thread soon

Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Nov 2010 00:01
Very useful, I learned a lot from it . Thanks baxslash for posting and thanks to Bond1 for making it!


Guns, cinematics, stealth, items and more!
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 13th Nov 2010 00:16
This looks like this has HDR too. Is it possible to keep the HDR but lose the bloom?
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 13th Nov 2010 16:55 Edited at: 13th Nov 2010 16:56
Quote: "Is it possible to keep the HDR but lose the bloom?"

I don't understand the question, perhaps because that is exactly what this shader does, apart from being an adaptative HDR. Better if watched in video, because it changes dynamically, quite spectacular.

Here is a picture:



It can be noticed that the HDR is focused in the engine intakes, Tokio, and the Sun.

DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 13th Nov 2010 18:11
Looks really nice, but as I know nothing of shaders really have no clue how to implement it. I tried the standard bloom example as suggested above which works if a bit gaudy. I then tried to put this shader into it and, either it is too subtle for me to notice, or not working. Even worse in my own project everything just goes black. No text, just black nothingness, quite the opposite of what I was hoping lol. I am a little in the dark though with the code as the stuff I don't really understand seems either sparsely documented (vectors are a mystery to me, have no real clue about them) or nothing at all "load camera effect" etc where I am unsure of the exact values.
This is a space game too although just a few days in the making so far and probably about 5 years behind the one above lol.

The above is an example of what I am working on. Using the standard DB shader this time but I have tried both. Seeing as the only one that defo worked for me was the original I have stuck with that until I can get it working. Excuse the slightly chaotic code obviously a lot is missing I have basically put in the stuff only relevant to the shader. I have a few more objects around than the ones I show and hide but do not want any effect on those so assume that is ok.
At the min all I get is a black screen Any thoughts? Remember I am a shader novice so try not to baffle me

http://s6.bitefight.org/c.php?uid=103081
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 13th Nov 2010 18:29
I can't see any errors in that code at 1st glance
Perhaps you forgot to create camera 1.



Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Nov 2010 19:53
Could this be a problem?



How far is the camera from objects in the scene - and what is the camera's range?
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 13th Nov 2010 20:27


Why don't I have these commands?

TheComet

DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 13th Nov 2010 20:50 Edited at: 13th Nov 2010 21:00
I create camera 1 at the start just not included it in the snippet. The camera range is huge as the distance between objects is pretty vast to be semi close to the real thing.
set camera range 1,10,1000000000

Changing the camera position may be a problem, not sure. I managed to move around in the original bloom demo ok using basic arrowkeys, so it can be changed in that at least.. I was using camera 0 originally so not sure if that is causing issues.

http://s6.bitefight.org/c.php?uid=103081
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th Nov 2010 21:30
Quote: "Why don't I have these commands?"

You need Dark Shader.

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 13th Nov 2010 22:50
Quote: "You need Dark Shader."


Not possible, I have them, but I've never had dark shader.

Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Nov 2010 23:52
Quote: "Quote: "You need Dark Shader."

Not possible, I have them, but I've never had dark shader. "


I think they were recently included in one of the updates ...


Guns, cinematics, stealth, items and more!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Nov 2010 23:53
Yes, they were.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 14th Nov 2010 00:27
[silly question] Where can I download the update for 7.5? [/silly question]

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Nov 2010 01:36
Either here

Official TGC DBPro Upgrade Page

or here

IanM's More Useful DBPro Upgrades Thread

I usually use the second because it's more convenient and has all the information about previous upgrades in one place plus other essential stuff.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 14th Nov 2010 02:04 Edited at: 14th Nov 2010 02:05
Quote: "I don't understand the question"


Here's a link describing the difference between HDR and bloom. The two are conflated a lot, frustratingly.

http://www.gamedev.net/community/forums/topic.asp?topic_id=529733

HDR is about being able to display a high dynamic range. In "HDR" photos, this usually means that scene light intensity is mapped to picture brightness such that detail in low brightness areas and high brightness areas of a picture are both percievable. You could do this by having the picture brightness as the log of the actual brightness, say. Anyway HDR acts on individual pixels.

Bloom is about pixels affecting neighbouring pixels. It's a vaseliney blurring effect.

Anyway it is confusing.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Nov 2010 11:19
I agree with Dr Tank - the two effects are quite different and often confused. I don't really know why they get confused so often.

In fact I'm confused about the source of the confusion.
Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 14th Nov 2010 20:02 Edited at: 14th Nov 2010 22:24
hmm... why doesn't this work for me? This is the code I'm using:


It just shows a black screen, any ideas?

"You can have the best graphics in the world, but if you dont use it right you'll just have a high definition turd."
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Nov 2010 23:04
Where exactly do you sync camera 0?

You've rendered the scene to image 100 using camera 1 (hopefully) but haven't sent anything to the screen itself.

Have a look at this thread. There's a working snippet in there.

bloom shader problem
Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 14th Nov 2010 23:31 Edited at: 14th Nov 2010 23:38
You're right, I wasn't syncing camera 1 by accident, but it still just gives me a black screen even after changing it to be almost exactly like the final project you posted on that thread:



Edit: I've tracked it down to the set display mode command at the start, with that gone it now runs but I can't actually see the bloom at all and occasionally the view seems to switch between camera 1 and camera 0 :S

"You can have the best graphics in the world, but if you dont use it right you'll just have a high definition turd."
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Nov 2010 01:03
I'll try to remember to look at your code in detail tomorrow - unless someone else has spotted the problem.

Can you confirm which "bloom.fx" and "quad.fx" shaders you're using?
Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 15th Nov 2010 08:44
Cheers, I'm just using the post-bloom.fx Downloaded from Bond1s thread at the top and the quad.fx from my dbp effects folder.

"You can have the best graphics in the world, but if you dont use it right you'll just have a high definition turd."
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Nov 2010 22:19 Edited at: 15th Nov 2010 22:20
I've no idea what you've done wrong but the following code works fine for me.

I've made a few changes:

- to remove things I couldn't test, e.g. the object "MA1.x" and the KD stuff
- moved the camera's start position so you could be sure it was outside the main object ()
- made the changes I referred to on the other thread.

Here's a screenshot:



The code still needs tweaking - you need to make sure the quad is in front of the camera - otherwise it gets culled in certain camera positions. But I guess you can fix that.

Here's the code:

Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 16th Nov 2010 00:28
Great, thanks a lot GG, that works perfectly now! (the KD lines are part of an anisotropic filtering DLL which makes textures less blurry )

cheers, Rhys.

Login to post a reply

Server time is: 2026-07-21 21:13:14
Your offset time is: 2026-07-21 21:13:14