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 / Improving my voxel renderer

Author
Message
Inflictive
17
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 18th Jun 2012 08:36
I've been working on this voxel renderer for a while. It works, I guess, but it only gets about 10 fps on my labtop (and the world is very small). I've done all the speed improvements to it that I can, all that I haven't been able to get working is the bresenham formula, which should speed it up well.

Here is the code. It requires Matrix1 Utilities and Advanced 2d (maybe more?)

Uncomment "`bresenham=1" to enable the bresenham renderer I have come up with so far.

Controls are qweasd to move, arrows to look.

I need help getting the bresenham to work right. I also noticed that when you look up or down, everything gets skewed. And of course I need help speeding it up.



"This plan is so perfect... it's retarded."
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Jun 2012 15:10
I get about 14fps. My screen res looks wrong though, because I can't make out what I am looking at. Z just repeats.

Inflictive
17
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 18th Jun 2012 23:06
Oh yeah. Change the set screen resolution command at the top and the rest should fall into place. Set the res to about 1/8 of your actual screen size.

"This plan is so perfect... it's retarded."
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Jun 2012 23:53
I think you will have to put a Youtube video up to see what I am supposed to see. I just get a sort of sea made from an onion.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 28th Jun 2012 05:02
[quote]Here is the code. It requires Matrix1 Utilities and Advanced 2d (maybe more?)


PLEASE please link to the individual forum plug-ins... it will prevent new users from posting new topics asking WHERE DO I GET XYZ when they do not know how to use the search field below which is also often claimed to be broken [not by me]

I have not got A2D yet but would be nice to try this... Linky

[center]
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 28th Jun 2012 12:17
@Inflictive Studios - I'll have a proper nosey at this sometime today to see what it is doing. At the moment I'm getting about 7-10 FPS on my dodgy laptop.

For all your obvious optimisations that you have done seem to have worked so far. I can suggest just a couple more to see if they make any difference.

1. Use COS and SIN tables. Although these are very likely not needed these days with fast FPU's but it's worth benchmarking to find out.

2. Use an alternative sqrt() function. In a plugin that's WIP at the moment, and I will be adding a lot more to it there's a fast sqrt() alternative function. I'll dig the link out in a mo, but the code is many many times faster than the built in sqrt() -


3. You might also need to look into optimising the arrays, whether or not a memblock might be faster. A little research should cut down on testing it out though.

:: My alternative sqrt() function is embedded in the simplex noise plugin " value# = WL FSQRT(num#) " FREE_PLUGIN_DOWNLOAD

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2026-07-08 12:27:13
Your offset time is: 2026-07-08 12:27:13