Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

3D Graphics in AutoIt


  • Please log in to reply
32 replies to this topic

#1 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 03 March 2006 - 12:16 PM

v0.2 : InputManger now works.
Short-Term todo list:
> the camera is fixed at (0,0,0). Even though the tree can move toward or away from this point along the z-axis, you want to be able to move the camera around freely.
> When the tree is very close to the camera, the polygon is drawn in strange ways. Also, when you zoom in too far (past the tree), the tree appears upside down! This is because polygons are not clipped to the view frusum.
> Finally, the tree is flat, which is kind of boring. Solid trees and other solid shapes will be more interesting.

ok... now back to the demo...
Test exe:
(Whenever an "ASSERT" box pops up, click Ignore.)
Libraries: http://www.autoitscript.com/fileman/users/nfwu/AutoIt3D.zip
(Source code for test is in /test/ of the ZIP, as usual)

Controls for demo:
ESC : Quit
Up Arrow : Zoom In
Down Arrow : Zoom Out

#)

NOTES:
1) The libraries are pretty complicated to use *for now*. I will create an easier to use version soon after I have completed the short-term goals listed above.

Please make suggestions!!!

Edited by Jon, 28 December 2012 - 10:30 PM.

  • onlineth likes this







#2 rambo3889

rambo3889

    It is I

  • Active Members
  • PipPipPipPipPipPip
  • 802 posts

Posted 03 March 2006 - 12:28 PM

NICE :o :geek: : D ;) :sorcerer: :huggles: :zorro:
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

#3 death pax

death pax

    Adventurer

  • Active Members
  • PipPip
  • 110 posts

Posted 03 March 2006 - 04:22 PM

Wow! never thought it would be possible :o

#4 greenmachine

greenmachine

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,252 posts

Posted 04 March 2006 - 06:16 AM

That's pretty cool. It reminds me a lot of my physics class.. the inversion effect of a lens when you get to a certain angle (in this case, when you zoom in enough). Nice work so far.

#5 Oxin8

Oxin8

    Prodigy

  • Active Members
  • PipPipPip
  • 183 posts

Posted 05 March 2006 - 05:50 PM

that's pretty sweet.

#6 Manadar

Manadar

         

  • MVPs
  • 10,870 posts

Posted 06 March 2006 - 03:07 PM

I think it's cool. But man, you really need to switch to J or C for these kind of things. I haven't looked at the code but what you're doing really is trying to make a 2D environment react like a 3D one, so it looks like 3D. Real 3D needs a different engine.

#7 The Kandie Man

The Kandie Man

    All Your Base Are Belong To Us

  • Active Members
  • PipPipPipPipPipPip
  • 950 posts

Posted 07 March 2006 - 12:02 AM

Can't you import Direct X libraries and use Direct X API functions to create 3d objects and such? I did it in visual basic, but i am pretty sure you could import the same libraries.

Maybe, no?
"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

#8 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 08 March 2006 - 03:45 AM

Can't you import Direct X libraries and use Direct X API functions to create 3d objects and such? I did it in visual basic, but i am pretty sure you could import the same libraries.

Maybe, no?



I can... i was planning tio use OpenGL, but it was a bit complicated...

Can you supply some srce code and the libraries?

#)

EDIT: I am busy until Saturday afternoon

Edited by nfwu, 08 March 2006 - 03:46 AM.


#9 cppman

cppman

    Anonymous

  • Active Members
  • PipPipPipPipPipPip
  • 1,626 posts

Posted 08 March 2006 - 04:24 AM

awesome... i agree with manadar. Its pretty cool though. Also, i agree with what the Kandie Man Said.

#10 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 08 March 2006 - 01:18 PM

I think it's cool. But man, you really need to switch to J or C for these kind of things. I haven't looked at the code but what you're doing really is trying to make a 2D environment react like a 3D one, so it looks like 3D. Real 3D needs a different engine.


Errmmm... I happen to do 3d programming in Java and C++ as well, and ALL "3d" graphics are projected onto the screen. Using points in "imaginary 3d" space and projecting them on the screen....

#)

#11 BigDaddyO

BigDaddyO

    Never trust a Monkey

  • Active Members
  • PipPipPipPipPipPip
  • 549 posts

Posted 08 March 2006 - 03:52 PM

I am very very very interested in your progress with this 3d Graphics stuff.

Once you get things how you want them I am going to try to make a 3D Construction program.

I am going to build a playset/Fort for my Son this spring but I haven't found any good construction software that will tell me how many 2x4's or 1x6's I need for a specified area (Wall/Floor). I was going to do this without any graphical representation, just output as text but if you get this working it will be AWSOME!!!.

Mike
Posted Image

#12 GrungeRocker

GrungeRocker

    *narF*

  • Active Members
  • PipPipPipPipPipPip
  • 422 posts

Posted 08 March 2006 - 05:26 PM

NICE!
In work:

#13 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 11 March 2006 - 06:17 AM

I just completed version 0.3 of this, which has all the short-term goals sorted out.

The only problem is that it takes 2 minutes to draw 1 frame!!!!

I'm going to switch the calculations, etc, etc into a C++ DLL and only let AutoIt handle the keyboard/mouse input and the GUI.
(Starting everything from scratch again...)

#)

#14 Thatsgreat2345

Thatsgreat2345

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,640 posts

Posted 12 March 2006 - 06:01 AM

make some UDF's :) possible

#15 blindwig

blindwig

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 772 posts

Posted 13 March 2006 - 09:00 PM

If you're looking for some 3d-to-2d translation functions and 3d rotation functions, check out my 3d stars screen saver post

#16 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 14 March 2006 - 06:10 AM

Thanks, but's that's not required... i've already done stuff like this in Java...

Now it is just a preformance issue..

I hope that converting this to a Plugin or DLL will increase the speed...
because it is Native code... no translation required, not like AutoIt.

#)

#17 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 04 May 2006 - 03:17 AM

It's ~2 months after my last post in this thread...

I have recently just profiled my application amd realized that it takes a long time in this function:
(1~2 minutes)
(v0.3 - not yet released)
Func ScreenManager_ClearScreen($p_color=0x000000)   For $i = 0 to $ScreenWidth     For $j = 0 to $ScreenHeight        $ScreenBuffer[$i][$j] = $p_color     Next   Next EndFunc


$ScreenWidth is usually ~600
$ScreenHeight is usuallly ~450

Is there any alternative to this that is much faster?

#)

#18 blindwig

blindwig

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 772 posts

Posted 04 May 2006 - 05:58 PM

It's ~2 months after my last post in this thread...

I have recently just profiled my application amd realized that it takes a long time in this function:
(1~2 minutes)
(v0.3 - not yet released)

Func ScreenManager_ClearScreen($p_color=0x000000)   For $i = 0 to $ScreenWidth     For $j = 0 to $ScreenHeight        $ScreenBuffer[$i][$j] = $p_color     Next   Next EndFunc


$ScreenWidth is usually ~600
$ScreenHeight is usuallly ~450

Is there any alternative to this that is much faster?

#)

You're trying to flood-fill a buffer using loops in an array in a high-level language? Yeah, that's going to be slow.
I'd say instead of using a 2-d array, just use 1 big binary string. And work with it using DLLs whenever possible.

#19 Busti

Busti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 337 posts

Posted 05 May 2006 - 12:49 PM

how about making it multithreading ?

this took me ~18 sec :

Dim $MaxH = @DesktopHeight Dim $MaxW = @DesktopWidth Dim $ScreenBuffer[$MaxH+1][$MaxW+1] Func ScreenManager_ClearScreen($p_color=0x000000)   For $H = 0 to $MaxH     For $W = 0 to $MaxW         $ScreenBuffer[$H][$W] = $p_color     Next     ToolTip ( "Heigh Scanning :" & $H & @CRLF & "Widht Scanning : " & $W & @CRLF & "Set with Color : " & $p_color )   Next EndFunc ScreenManager_ClearScreen()



please take a look at this, its not 100% working now, and the math is not 100% correct, but i shall work much faster!

this is what i meant with multithreading :)
Plain Text         
Dim $MaxH = @DesktopHeight Dim $MaxW = @DesktopWidth Dim $ScreenBuffer[$MaxH + 1][$MaxW + 1] Dim $1DesktopXMax = $MaxH / 2 Dim $1DesktopYMax = $MaxW / 2 ;=====================; MULTITHREAD 1 Dim $1MultiH = 1;-> $1DesktopXMax Dim $1MultiW = 1;-> $1DesktopYMax ;=====================; MULTITHREAD 2 Dim $2MultiH = $1DesktopXMax;-> $MaxH Dim $2MultiW = $1DesktopYMax;-> $1DesktopYMax ;=====================; MULTITHREAD 3 Dim $3MultiH = 1;-> $1DesktopXMax Dim $3MultiW = $1DesktopYMax;-> $1DesktopYMax ;=====================; MULTITHREAD 4 Dim $4MultiH = $1DesktopXMax;-> $MaxH Dim $4MultiW = $1DesktopYMax;-> $MaxW ;=====================; END Func ScreenManager_ClearScreen($p_color = 123456789)     $timer = TimerInit()     For $1MultiH=1 To $1DesktopXMax     ; MULTITHREAD 2         If $2MultiH <= $MaxH Then             $2MultiH += 1         EndIf     ; MULTITHREAD 3         If $3MultiH <= $1DesktopXMax Then             $3MultiH += 1         EndIf     ; MULTITHREAD 4         If $4MultiH <= $MaxH Then             $4MultiH += 1         EndIf         For $1MultiW=1 To $1DesktopYMax - 1         ; MULTITHREAD 2             If $2MultiW <= $1DesktopYMax Then                 $2MultiW += 1             EndIf         ; MULTITHREAD 3             If $3MultiW <= $1DesktopYMax Then                 $3MultiW += 1             EndIf         ; MULTITHREAD 4             If $4MultiW <= $MaxW Then                 $4MultiW += 1             EndIf             $ScreenBuffer[$1MultiH][$1MultiH] = $p_color             $ScreenBuffer[$2MultiH][$2MultiW] = $p_color             $ScreenBuffer[$3MultiH][$3MultiW] = $p_color             $ScreenBuffer[$4MultiH][$4MultiW] = $p_color             ToolTip("#" & @CRLF & _                 "Rest der Hälfte 1 X : " & $1MultiH & "/" & $1DesktopXMax & @CRLF & _                 "Rest der Hälfte 1 Y : " & $1MultiW & "/" & $1DesktopYMax & @CRLF & @CRLF & _                 "Rest der Hälfte 2 X : " & $2MultiH & "/" & $MaxH & @CRLF & _                 "Rest der Hälfte 2 Y : " & $2MultiW & "/" & $1DesktopYMax & @CRLF & @CRLF & _                 "Rest der Hälfte 3 X : " & $3MultiH & "/" & $1DesktopXMax & @CRLF & _                 "Rest der Hälfte 3 Y : " & $3MultiW & "/" & $1DesktopYMax & @CRLF & @CRLF & _                 "Rest der Hälfte 4 X : " & $4MultiH & "/" & $MaxH & @CRLF & _                 "Rest der Hälfte 4 Y : " & $4MultiW & "/" & $MaxW & @CRLF)             Next         Next ;check     #cs         For $H = $1MultiH To $MaxH         For $W = $1MultiW To $MaxW -1         $ScreenBuffer[$H][$W] = $p_color         Next         ToolTip ( "Heigh Scanning :" & $H & @CRLF & _         "Widht Scanning : " & $W & @CRLF & _         "Set with Color : " & $p_color & @CRLF & _         "ScreenBuffer : " & $ScreenBuffer[$H][$W] & @CRLF & _         "Rest der Hälfte X : " & $1MultiH & @CRLF & _         "Rest der Hälfte Y : " & $1MultiW )         Next     #ce     MsgBox(0, "", "TimeNeedet : " & TimerDiff($timer)) EndFunc  ;==>ScreenManager_ClearScreen ;test() ScreenManager_ClearScreen()

Edited by Busti, 05 May 2006 - 02:29 PM.

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

#20 Busti

Busti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 337 posts

Posted 07 May 2006 - 08:12 PM

push....nfwu could you answer if this is something like you searched?
My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users