Jump to content

Direct3D


Authenticity
 Share

Recommended Posts

I'd like to list the following sources which I find to be very helpful:

  • MSDN - Direct3D 9 Graphics (Windows)
  • XNA
  • Introduction to 3D Game Programming With DirectX 9 by Frank D. Luna. The examples are based on his source code.
  • Introduction to 3D Game Programming with DirectX 9.0c—A Shader Approach by Frank D. Luna. The examples are based on his source code.
  • The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics by Randima Fernando and Mark J. Kilgard

This library provides a basic interface for programming Direct3D applications, whether they're on your GUI on not.

The examples show (and hopefully teach) how to use DirectX to implement: terrain, camera, particle systems, meshes, meshes geometries, and more.

Because your application is one step (or 2) from device communication (Graphics card), your application can preform drawing much more faster

than GDI or GDI+. What more is that Direct3D offers ways to compile what is called shader/effect files that can be evaluated and executed

on the GPU. If you learn how to write code that put the GPU and CPU in work and harmony together, you'll get the most of Direct3D.

The library is heavily based on AutoItObj UDF, so you will need to download the UDF to use this library.

Thanks to the developers <3

D3D9.7z

D3D9_Shader.7z

History:

Update 11.12.2010:
 - Added new implementation of D3D samples based on the aforementioned book's source code. The new implementation
   uses the current version of AutoItObject-v1.2.2.0 and utilizes some sort of OO principles. The major reason to
   follow the shader approach is because DirectX 10 and later versions have abandoned the fixed-function-pipeline
   in favor of the new programmable-pipeline.

Update 30.10.2010:
 - Added effects examples
 - Modified library and examples to reflect library changes. All functions that create intrinsic objects
   such as a matrix or a vector require a reference to a variable and return the new object's pointer.

 - Modified library and examples to be compatible with the new AutoItObject version 1.2.0.0. The new AutoItObject
   version is required to be able to use this library and to run examples.

 - Fixed Terrain.au3 to use $D3DFMT_INDEX32 when necessary and not always.

Update 09.11.2010:
 - Fixed leaking examples.

Future Revisions:

  • Implement real animations like: Skinned Meshes, Keyframes-based animations, etc.
Edited by Authenticity
Link to comment
Share on other sites

i`m astonished, this is really one fine piece of work

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Cool, atleast the part I can get working :)

How do you "install" this ? some of it runs fine, some of it gives me a windows error that the program has stopped working.

(I copied autoitobject.au3 and .dll to my includes folder)

Nvermind, seems to be working second run, for some reason.

And let me add an "Awesome" to the above "Cool". ;)

Edited by Werty

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

Very impressive:)

Link to comment
Share on other sites

I'm really impressed with the power of Direct3D! ;)

Thanks you for your efforts on this awesome work and thank you for sharing it! This will bring AutoIt definitely to the next GFX level!

As I said in GDIp.au3 I will repeat it here, too: maybe now dreams come true.

I think, the time has come now to say: I will stop with GDI+ stuff (27 examples should be enough) :)

Also 5* from me!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Thank you, this is very impressive. Now I know the development of AutoItObject-UDF was worth it.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Indeed ProgAndy, without AutoItObject-UDF maybe Direct3D couldn't be be realized! Also a big THANKS to the AutoItObject-UDF dev. team!

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I'm attempting to use some of my own heightmaps for the terrain example (11) but it doesnt turn out too good, they are distorted.

It should be possible to use a simple 8bit bmp you drawn yourself, and the example accepts the heightmaps I've made, but when imported they are either too flat or too stretched, or maybe a combination of both.

Any hints on how to use own heightmaps ?

(on a side note for interested, using 512x512 and larger maps takes a LONG time to render ;) )

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

Func _TerrainCreate($pDevice, $sHeightMapFile, $iVertsPerRow, $iVertsPerCol, $iCellSpacing, $nHeightScale = 1) ; ...

You should play with the cell spacing and height scale values. High cell spacing on a 64x64

heightsmap generate a lower resolution terrain but can be generated faster. Then you can

apply a scale factor of 3 or 5 to increase the (now stretched) terrain bumpiness. That terrain

is just an example, if you're aiming toward faster approaches you'll need to split the mesh

into smaller meshes and handle each individually. Usually, for such tasks, people store a few

sized .x files of the flat terrain mesh and generate and apply the heightsmap on the fly.

Search for Perlin noise if you're interested.

P.S. The _TerrainCreate function spends most of it's time on generating the terrain texture.

Try to load a 512x512 heightsmap file without auto generating the texture. I guess it'll take

half the time it takes with texture generation.

Link to comment
Share on other sites

Excuse my newbiness, but I dunno what I'm doing wrong.

I change the line you've shown to...

Func _TerrainCreate($pDevice, $sHeightMapFile, $iVertsPerRow, $iVertsPerCol, $iCellSpacing, $nHeightScale = 3)

...and...

Func _TerrainCreate($pDevice, $sHeightMapFile, $iVertsPerRow, $iVertsPerCol, $iCellSpacing = 10, $nHeightScale = 1)

...but nothing seems to happen, (also tried many other values), it still looks the same, and that's using the original example with the supplied map128.raw map.

I change it in Terrain.Au3, save, and then launch TerrainApp.Au3.

What am I doing wrong ?

;)

Edited by Werty

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

You are asking general (basic) questions that are not related to Direct3D. Learn the language first, at least that much to understand that what you ask.

edit: Not to forget, thank you Authenticity.

These examples showed me how to properly handle str type with new version of the wrapper.

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Thanks trancexx. Can't wait for the new AutoItObject UDF to come out.

I thought of encapsulating all the vectors and matrices intrinsic operators (fake) in classes.

So.. does the next version of AutoItObject support object methods naturally? i.e without

callbacks?

Edit: You can do as Firefox did and open a topic about it in the general forum.

Changing the function prototype doesn't change how you call it. Make sure you call it

with the correct values.

P.S. Can you also somehow help to eliminate the "ptr", Number(DllStructGetPtr(..)) thing?

;)

Edited by Authenticity
Link to comment
Share on other sites

Thanks trancexx. Can't wait for the new AutoItObject UDF to come out.

I thought of encapsulating all the vectors and matrices intrinsic operators (fake) in classes.

So.. does the next version of AutoItObject support object methods naturally? i.e without

callbacks?

Edit: You can do as Firefox did and open a topic about it in the general forum.

Changing the function prototype doesn't change how you call it. Make sure you call it

with the correct values.

P.S. Can you also somehow help to eliminate the "ptr", Number(DllStructGetPtr(..)) thing?

;)

New wrapper uses DispCallFunc to call methods. No callbacks that execute script code needed. You will see that CPU is significantly down, and some new datatypes of course.

Numberizing pointers is something that AutoIt dev team is responsible for. Nothing to be done about that without them.

edit: I just reread your question. If you were thinking about encapsulation within _AutoItObject_Create()'s object then no. Callback is needed here since that's the only way to force interpreter to interpret method defined as AutoIt function (the whole purpose of AutoIt-object).

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Right... got it.

Now I have a 3D preview for my real world heightmap maker that I've just finished, perfect timing. :)

Here's a sample of Angel Island in san francisco bay, cellspacing=1, heightscale 0.6

Heightmap and texture.

Thanks alot again ;)

angel_island.zip

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

Seems quite realistic. Something is wrong with the heightsmap though. Using a Perlin noise,

I manage to get smooth transitions and no overlapped triangles. Also, it's quite a bumpy

terrain. Try using cell spacing of 15 and a scale factor of 3. It's about taste, so don't

judge me. ;]

Your next task is to implement a per-pixel lighting shader. It'll increase the realism

of the terrain dramatically.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...