? efficient screen culling ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

efficient screen culling

While working on Halo3DS, I came into a LOT of speed issues(obviously), so I made this function: DEF CULL(X#,Y#,Z#)'other 5 variables are global so no need to require them 'X#,Y#, AND Z# is the position of an object 'X,Y,Z are cam coords 'RX,RY are camera rotation(RZ is not important) RETURN ABS(DEG(ATAN(Z#-Z,Y#-Y)))-CX<45&&ABS(DEG(ATAN(Z#-Z,Y#-Y)))-CY<20&&SQR(POW(X#-X,2)+POW(Y#-Y,2)+POW(Z#-Z,2))<100 'check if it is visible on X axis, check if visible in Y axis, check if near enough END I have another Idea for culling, but I need to actually write it.

Further optimization

This will help out: GCLIP 1,0,0,400,240 'Don't draw off - screen SPCLIP 0,0,400,240
Author
DFrost
Updated
Rating
0 votes
Categories
Keywords
2 Comment(s) CyberYoshi64 CyberYoshi64 Avatar Taboo I didn't change my avatar for 180 days Website Night Person I like the quiet night and sleep late. Express Yourself First Year My account is over 1 year old Website TYPO! GCLIP not Graphical lips... 😧 DFrost DFrost Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength THX! I feel like FREAKING GOD because I made an extremely efficient algorithm that can render 10000 objects at a semi - playable speed. (Not really render, but rather process and draw them if they pass the test. This is for Homo - Sapeins 3D and it's going to be the first open - world 3DS game on SB! EDIT: it processes/renders 1000 objects @ 40 Hz(40 FPS)!