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 / Problem with hdr code?

Author
Message
Mugen Wizardry
User Banned
Posted: 23rd Aug 2010 22:48
Hi all. Ok, I'm having a small problem with this hdr code. I modified it so it works for any object u call it on. the problem is its not hdr. its just a black cube.

i have attached the media and source.



thanks!

i appreciate it!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Aug 2010 14:39
You aren't running "HDR_update" anywhere in your loop...

Mugen Wizardry
User Banned
Posted: 24th Aug 2010 16:52
that didnt work.

i want to be able to give hdr to ANY object using hdr_setup

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Aug 2010 17:05
Quote: "that didnt work.

i want to be able to give hdr to ANY object using hdr_setup"

I'm not great on shaders but I thought HDR was more of a fullscreen effect a bit like bloom?

High Dynamic Range effects take into account the light in the scene as a whole and are normally 'faked' by editing the contrast of the scene using a shader.

What is your shader supposed to do to 'individual' objects?

Mugen Wizardry
User Banned
Posted: 24th Aug 2010 18:31
its supposed to make the object glow.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Aug 2010 18:40
I just took another look and it does look like it's a fullscreen shader.

I've used a similar 'HDR' shader before and it only edits the camera view and returns an image for you to either texture a ghosted plain with or use as a transparent sprite.

Mugen Wizardry
User Banned
Posted: 24th Aug 2010 19:26
so how do i fix this?

or is there another hdr code that i can use that works on selected objects and does not lag?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Aug 2010 19:33 Edited at: 24th Aug 2010 19:33
Quote: "so how do i fix this?

or is there another hdr code that i can use that works on selected objects and does not lag?"

If you need particular objects to glow while others do not then you could use textured plains with a 'glow' image on them. There are shaders that make the outer edges of objcts brighter but it doesn't 'blur' past the edge of the object...



Mugen Wizardry
User Banned
Posted: 24th Aug 2010 20:18
where would i get the glow texture, and how would i use it?

i need to be able to render my game to high def

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 24th Aug 2010 20:35
What effect are you trying to achieve? Are you trying to make everything glow like a Bloom Shader, or are you trying to make an object glow on the edges? Or do you want a Light Saber effect?

Is something like this what you want (found it with a google images search):
http://www.radioactive-software.com/gangwar/glow/BloomComparison.jpg

That effect is called Bloom.


Guns, cinematics, stealth, items and more!
Mugen Wizardry
User Banned
Posted: 24th Aug 2010 20:38
yes, thats the 1, @sixty!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 24th Aug 2010 21:22 Edited at: 24th Aug 2010 21:36
Okay, cool. With bloom, All of your objects can stay the same; you don't need to apply a bloom shader to any of them.

What a bloom shader does is it uses an extra camera to take a picture of your scene each loop. It then applies this texture to a plain that is locked onto your screen. The plain that is locked onto your screen would have the shader applied to it. The shader would then take the normal texture you applied to it and make a blurry glowy version. Then you just use GHOST OBJECT ON on the plain to make the glowy version of the scene be rendered on top of the normal version. And there's your bloom effect. Or, that's one way it can be done. I'd recommend doing a forum search for Bloom or checking out EVOLVED's bloom shader here:

http://www.evolved-software.com/shaders/postprocessing

That one is quite complicated though and works in a slightly different way than the one I explained (I don't think it uses ghosted plains, but rather the shader does that work for you). His bloom is a multi-step process...


EDIT: Actually, you probably need more than one camera for the glow and blur textures.


Guns, cinematics, stealth, items and more!
Mugen Wizardry
User Banned
Posted: 25th Aug 2010 05:40
Sixty, do u have something a little less difficult? I mean evolved's is SO much beautiful than what I had in my mind, but it's extremely difficult to add to my game.

Thanks!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Aug 2010 10:39
It's not that complicated. It's certainly no more complicated than what you were trying to do (nearly the same code in fact):


Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 25th Aug 2010 14:19
Oh, I never thought about overlaying multiple objects like that.


Guns, cinematics, stealth, items and more!
Mugen Wizardry
User Banned
Posted: 25th Aug 2010 20:49
is there any way to turn those into functions?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th Aug 2010 10:49
!Bling!


Mugen Wizardry
User Banned
Posted: 26th Aug 2010 14:34 Edited at: 26th Aug 2010 14:45
EDIT: It isn't working right.

Here's an image.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th Aug 2010 14:52
Try swapping these two values in the setup function:


Mugen Wizardry
User Banned
Posted: 26th Aug 2010 14:55
nope. its still doing a green screen

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 14:57
Some of the variables need to be global when you turn the code into functions. Try this:



Also, make sure the file path to the shader file is "FX/Bloom.fx" since the function looks for the shader there. And which shader are you using? You should probably use the same shader that the code is designed for. Maybe baxslash has the shader?

Actually, I think I may have it from a while back. See attached.

To use the shader in your game, write the functions like this:



Guns, cinematics, stealth, items and more!
Mugen Wizardry
User Banned
Posted: 26th Aug 2010 15:17
still not working.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th Aug 2010 15:25
Quote: "nope. its still doing a green screen"

How were we supposed to know that was the problem? It didn't look green to me...

You could help yourself by explaining the problem instead of assuming we all know what you are thinking about.

Try using two objects close to each other that are very different in colour/shade as this will show up the bloom effect better and you'll be able to tell if it's working easier.

Quote: "Maybe baxslash has the shader?"

I posted it earlier.

Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 15:27
If you are using SET DISPLAY MODE, are you using it before the bloom setup command? You could always post some code so we can see exactly what you're doing...


Guns, cinematics, stealth, items and more!
Mugen Wizardry
User Banned
Posted: 26th Aug 2010 16:00
alright. ive decided to use evolved's code. cuz its just amazing.

Now the thing is though, it's saying there is a duplicated name PostFilter_SetUp in Include\PostFilter.dba

Here's the code:



And here's PostFilter.dba:

Thanks!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 26th Aug 2010 16:04
Either remove the line "#include "Include/PostFilter.dba"" or remove the source file from the projects Solution Explorer. You have probably included the same source file twice. That second snippet isnt the full dba is it?
Mugen Wizardry
User Banned
Posted: 26th Aug 2010 16:06
Yea it is.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 16:06
Did you try James H's suggestion?


Guns, cinematics, stealth, items and more!
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 26th Aug 2010 16:08
Sorry - I had mistakenly opened his Advanced Lighting example. Did what I suggested work?
Mugen Wizardry
User Banned
Posted: 26th Aug 2010 17:06
yes. it works.

thanks!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th Aug 2010 17:20
That's great.

But since the forum isn't just for your benefit, how about telling us all what you did to get the code working as someone else might end up in the same situation one day?

Mugen Wizardry
User Banned
Posted: 26th Aug 2010 17:42
ok. 1 small problem. can someone help make it so that PostFilter.dba uses find free object() instead of an object number so there are no conflicts when someone else tries to use it?

PostFilter:



And how i got it to work: I followed James H's directions

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 17:48
It already does that with its own FIND_FREE functions. Take a look at the bottom of the code:




Guns, cinematics, stealth, items and more!
Mugen Wizardry
User Banned
Posted: 26th Aug 2010 18:49
ok.

why is my camera green screening? and why is my text motion blurring? those 2 things shouldn't happen. i attached an image.



thanks guys!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 26th Aug 2010 19:25
Your probably better uploading the whole project with media if its not too big. Just scanning through the code I can see that a)you call post filter function twice along with the same camera sync mask, also you are using fastsync as opposed to sync which will only update the current camera I think. There could be any other number of issues here so try removing the FIRST postfilter function call and the sync mask on the next line, then test wether it should be fastsync or sync to update the frame in evolveds demo(should be sync according to your second to last snippet post), if that dont work upload your project if you can.
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 21:01 Edited at: 26th Aug 2010 21:01
I've used fastsync before, so that's probably okay.

As for the motion blur, there is a variable in the shader file called MotionBlur. Try setting it to 1.0, there shouldn't be any motion blur then.

Also, you might want to play around with your object masking via the SET OBJECT MASK command. But I'm not sure if that would affect the shader or just increase performance.

Anyway, uploading your project (or maybe an EXE so we can see what the problem is) might be best. I don't have all of the plugins that you use (I see some vegetation stuff in there, is that a plugin or a bunch of functions?), so an EXE would be good. The green could be the background of the bloom camera showing, if it's enabled at all.

Lastly, can you see anything else besides that tree? Is the player model visible? Is there a skysphere?


Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2026-07-23 12:10:15
Your offset time is: 2026-07-23 12:10:15