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 / real time glass effect with hight FPS

Author
Message
Silverman
13
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 10th May 2012 16:17 Edited at: 30th Oct 2012 18:46
Hi all,

I have to find ways to make this effect with a very high fps, in real time.

I have searched in the forum, and I have found that other people have tried, but only Latch has done, and he had a problem when compiling.
I have had the same problem as him, when I was compiling the fps killed. I have searched the solution for 4 days, oh my head!
And I have found! the solution was so simple, why I don 'have not thought of before?
Now I can forget the white flashes, jitter, low fps ... This solution works with all projects.
The solution is simply (with the famous blitfilpmode = 1): copy the file "setup.ini" of DarkBasic in the same directory as your project and compile. That is all!

@+


Edit: cleaned up the code and adding comments. Fixed an error that reduced the fps a little.

Edit2: improvement here(set of functions now, easy to use):
http://forum.thegamecreators.com/?m=forum_view&t=201164&b=10

DirectX 9.0c (February 2010)/ DBClassic v1.20

Attachments

Login to view attachments
Libervurto
14
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th May 2012 19:11
This is nice. I'd like to turn it into a group of functions for controlling multiple cameras (split-screen and 3D texture support) but I'm not with it today.

WARNING: The above comment may contain sarcasm.
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th May 2012 05:47
@silverman:
Quote: "but only Latch has done"

I haven't thought about this for a while! Nice job, Silverman! Very Clean. The last thing I remember working on with this was using sprites to mask areas of the screen to capture for reflection.

This example is a variation of what you posted. I tried to squeeze some speed out of the idea by not using bitmaps and using a sprite to hide the area on screen. Also, I added a timer to only call the reflection code every 30 milliseconds. While this will help other processes in the game to have more time to run, because of the refresh (sync) in the reflect code, it may look choppy.

Lower this time and it'll smooth it out, but also notice the fall in FPS.

I also use a goto _flip to control the main loop. This allows me to reduce the number of times I call SYNC. If too many syncs are called in a row, it changes the reported FPS.




Enjoy your day.
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 14th May 2012 01:12
@ Latch

I was just wondering... Why don't you have a "valued member" badge yet? You fully deserve one in my opinion. I mean, you've been around since the beginning of time (my time at least), and you've shown extensive knowledge on all areas. If that's not material for an honor's badge, then I don't know what is.

TheComet

Fluffy Rabbit
User Banned
Posted: 14th May 2012 01:20
@TheComet-

I think that would go to his head. Besides, he still hasn't released the Coldet wrapper yet.
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th May 2012 20:04
@TheComet
Quote: "...I mean, you've been around since the beginning of time (my time at least), and you've shown extensive knowledge on all areas. If that's not material for an honor's badge, then I don't know what is."

Thanks! A know a little bit here and there, but there are a lot of very knowledgeable people on the boards! You're definitely one of them - some pretty cool effects with your smash brothers, for example.

@Fluffy
Quote: "...he still hasn't released the Coldet wrapper yet"

Keep your eyeballs peeled...

Enjoy your day.
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 15th May 2012 12:14
I just compiled the code and ran it. Very nice, especially for DBC. One suggestion I have would be to ignore the main "sync" command when you update the reflection. This way you could have the game run more smoothly.

Quote: "Thanks! A know a little bit here and there, but there are a lot of very knowledgeable people on the boards! You're definitely one of them - some pretty cool effects with your smash brothers, for example."


Aw thanks :3

Sorry to go off topic here, I must know something though. Have you considered using DBP Latch? You'd make a fine addition to our collective if you were assimilated (been watching Star Trek).

TheComet

Silverman
13
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 15th May 2012 13:50
hi

@TheComet
Quote: "One suggestion I have would be to ignore the main "sync" command when you update the reflection."

It is impossible to do, because the position of the camera will not be updated.

@+

DirectX 9.0c (February 2010)/ DBClassic v1.13
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th May 2012 21:22
Quote: "Sorry to go off topic here, I must know something though. Have you considered using DBP Latch?"

I dunno... We've got Silverman who just breathed some life back into mirror reflections, and he just released a demo showing alpha blending, I've just released a library to work with ColDet collision detection...

There's still lots to do in DBC!

Enjoy your day.

Login to post a reply

Server time is: 2020-08-05 09:11:00
Your offset time is: 2020-08-05 09:11:00