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 / Bouncing Bezier Demo, anyone care to try? :-)

Author
Message
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 19th Feb 2005 00:51 Edited at: 19th Feb 2005 04:00
ok, I posted this code in the thread about sin waves (it got off topic I think)

Basically, I was wondering what kinda speed "3d lines" have if you use a triangle with 2 points on the same spot.



This is a little demo of Cubic Bezier curves.
My "benchmark":
Spec: AMD Barton 3200+, 1Gb DDR 400, 9800XT 256Mb RAM (Nothing overclocked)
Settings: 16 curves, 24 segments, 163FPS


Controls:
scroll the mouse up and down to change option on the menu
click left to increase
click right to decrease
move mouse left/right/up/down to move around the "cube" in a spherical way.

What do people think?

Cheers,
Nick

PS: I was thinking of putting this in WIP, but its not.. IT was a little demo, its not really "work"...

edit:
Screeny:


edit 2: btw: those lines are actually in 3D.. They're not 2D lines on the screen

My Website:

Attachments

Login to view attachments
TEH_CODERER
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 19th Feb 2005 04:19
Very nice. I have no idea how it works but very nice!

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.tk
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 19th Feb 2005 08:49
Hehe.. Cheers for the nice review

It uses Bezier curves to draw..well curves in 3D. This demo is meant to show thats its pretty efficient.

I'd like to improve it. I think it'd be MUCH better if I could make a mesh so there is 1 object with n poly's where n is the number of triangle-lines. Then if I can edit the mesh to just change the position of the verticies, then I wont need to faff about with 12 seperate objects (depending on the number of segments) to position, calculate size and point in the right direction..

My Website:
Teh Go0rfmeister
20
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 12th Mar 2005 00:31
i get 1000fps+ on default settings.

could we have some kind of practical code just showing a line from one point to another rather than fancily curving etc?

(*has a use for this but cant figure out how to code it himself*)

Walnoot
19
Years of Service
User Offline
Joined: 3rd Jul 2004
Location:
Posted: 12th Mar 2005 00:50
102 fps with 62 curves

Amd 64 3000+
1024 DDR Ram
ATI Sappire radion 9600xt
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th Mar 2005 00:55
Good work Nicholas!
Just a question I've been thinking about (along the same lines as your code)...

Is Make Object Sphere 1,1,1,1 the same poly count as Make Object Triangle 1,....?

Just wondering if one could replace the lines of code:

with

(for no other reason than curiosity)

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Mar 2005 00:56 Edited at: 12th Mar 2005 00:57
ok, the actual function that does the curve is:


All it does is make a weighted average on the "curve".

A# is the starting point, B# is the "control point" for A#, C# is the control point for D# and D# is the end point. T# is a value between 0.0 and 1.0 which refers to the position along the curve..

This any help? When I get home I'll try to post an example of this later.

I'm glad someone finally found it usefull Even if there was nearly a month between my last post

I never tried it with that many curves.. 62 curves and how many segments?

EDIT
A triangle is 1 poly. A sphere is many polies (depending on how many rows and columns you use). A quad is often 2 polies.. The reason I use a triangle and then wirefream it is to make it look like a line.

My Website:
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th Mar 2005 01:17 Edited at: 12th Mar 2005 01:18
Don't want to hijack your thread with a different topic Nic, so I'll drop it after this: Make Object Sphere 1,1,1,1 is 2 polies?

Thanks.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Mar 2005 05:50
Err.. To be honest I'm not sure. a sphere that is 1x1 in terms of rows and columns.. Hmm..

Just curious - what would be the advantage of doing that anyway?

My Website:
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Mar 2005 08:25 Edited at: 13th Mar 2005 01:08
Couldn't resist finding out ..... how sad am I?! A sphere of 1X1 is just a line, formed by joining the top of the sphere to the bottom, with six vertices positioned at top middle and bottom. A sphere of 2x2 is a plane made from two polygons (triangles) joining 30 vertices positioned at the top, front, back, middle and bottom of the sphere.



This shows a 2X2 sphere. Use returnkey and spacekey to move up/down through the vertices, and the arrow keys to move around the object.


Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Mar 2005 22:43
So a triangle is a single poly with 3 verts?

My Website:
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Mar 2005 01:07
Correct.


Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 13th Mar 2005 02:17
Cool.. I wonder if it'd be any kind of improvement to use a memblock to make a simple object that could be cloned that only contains 2 verts. Surely it'd be a 33% increase Hehe..

My Website:
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Mar 2005 09:24 Edited at: 13th Mar 2005 09:31
Probably, although I wonder if it would be even faster to just hide the objects and join them together using the line command and get object screen. Then no polygons would need to be drawn. (Assuming that's not what you're doing anyway - haven't really studied your code yet.)


Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 13th Mar 2005 09:29
The line point is unbelievably slow in DBPro. Do a little test - make a program that draws a line from 0,0 to 100,0 as fast as it can and check your FPS. Then do the same thing but make a box (2D box) from 0,0 to 100,1 and it'll be massively faster. I dont know why..

It would be quicker if I could somehow make this into a limbed object..

My Website:
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Mar 2005 09:42
Seems very odd. The line command should require far less calculations to colour a few pixels on the screen, than a 3d object, which needs to be converted into a 2d projection first before it can be rendered to the screen. I think the DBP 2d engine needs a complete overhaul!


Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 13th Mar 2005 10:03 Edited at: 13th Mar 2005 10:04
Now let me introduce - with help from Jessticular - a screensaver version of the above code INCLUDING a preview window in Display Properties!

Click here to download the source zipped up (including a project file).

This contains no media.

I am hoping to make this into a decent screensaver. There are going to be options, etc (ie how many curves, etc). Also going to add in a clock feature I think..

My Website:

Attachments

Login to view attachments
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 15th Mar 2005 06:35
Quote: "Just curious - what would be the advantage of doing that anyway?"

I was just curious too. Was wondering if one could get similar results (polies & verticies) using Make Object Triangle with Make Object Sphere. Make Object Sphere 1,1,1,1 is easier to type. As Ric has shown: Nope.

Thanks Nicholas and Ric!

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 22nd Apr 2005 19:54
I'm in the process of creating a dll to draw 3d lines using the directx method DrawPrimative. This should be fast as it is the same way that DBPro draws it's own primatives.

The only problem I have at the moment is that the lines are not affected by lighting and although you can spoecify and alpha value it currently has no effect.

If you like I could post the latest version of the dll for you to try. It also has functions to create a 3d text mesh and to display antialiased text.

Cheers,

CLoggy
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 22nd Apr 2005 22:32
I think that would be quite usefull - maybe make a comparison demo..

The 3D Text Mesh would be Über usefull.. Not sure what you meant by antialiased text.. (I know what it is, but not sure why it would be usefull..)

My Website:
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 22nd Apr 2005 22:44
When you display text using the text or print command, you get jaggies. the bigger the text the more pronounced they become.

I have a version of the dll that includes 3d text is in the dll forum http://forum.thegamecreators.com/?m=forum_view&t=52693&b=18. Make sure you take the second dll as that should work with 5.8. the previous one asks for d3dx9_24.dll as it was compiled with Feb 2004 SDK.

I have just got the 3d line working fully with alpha transparency as well and will post a new version with all the functions demoed later this evening once i've tidied things up a bit.

et me know what you think or if you have any problems.

Cheers,

Cloggy
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 23rd Apr 2005 05:30
My dll is here http://forum.thegamecreators.com/?m=forum_view&t=52852&b=18

Let me know what you think.

Antialiased text is quite slow but I'm investigating. It could be used to create sprites at the beginning of your program though.

The 3d text mesh is offset. It positions the first character with the correct font spacing, I am looking to change that but I just wanted to get the basics working first to prove it could be done.

Cheers,

Cloggy

Login to post a reply

Server time is: 2024-04-19 08:55:27
Your offset time is: 2024-04-19 08:55:27