Author Topic: Trashman's homework assignment  (Read 10003 times)

0 Members and 1 Guest are viewing this topic.

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
Interesting...sounds like you found a nice way around some issues.

That said, I hope I'm not asking for too much, but can one of you code-wizzards who knows the graphics part give me (written in text or a graph) a round presentation of the 3D pipeline?
The professor kinda made a point for me to have a pipeline graph, but trying to peace it together just looking at the code would take forever....and ever...and ever...for me. ;)
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
another question...I've been writing general stuff about how 3D engines work.

I know that geometry has to be transformed several times, from local to world coordinate, camera coodinate, perspective, that the viewing frustrum has to be applied, backfaces and object removed.... I know how rasterization works, so one thing bugs me.

Glowmaps work by interpolating the glowmap pixel value with the normal map pixel value.

What about trasnparency maps? Isn't rasterization done last? The removal of backfaces and obscured/hidden polygons is done before that.
How does the engine determine to keep a few polygon in the pipeline? (polygons that are normally not visible but since we added the transparency map they will now be partially visible)



EDIT: Just wanted to stress again how important the FSO pipelne is for me.  :blah:
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Trashman's homework assignment
"Glowmaps work by interpolating the glowmap pixel value with the normal map pixel value."
this is nonsence. if you want to know how glowmapping works I'll explain it, but you don't have this right.

as per your question, (alpha based) transparency works by interpolating the source color (the color of the pixel of the triangle that is about to be drawn) with the destination color (color of the pixel as it is on the screen before you started drawing your current triangle) using the (source) alpha value to weight the interpolation.
you might be wondering still about the visibility issue, well that is a big problem and the only solution that has been found to date is to sort the geometry from furthest to closest ensuring all transparent triangles get drawn without getting killed off by another poly's z value. usually all non-transparent geometry is drawn before the transparent geometry, so the non-transparent geometry does not need to get sorted also. sometimes simply drawing the non-transparent geometry before the transparent geometry is enough, for example if you know you will never (or rarely) have two transparent polys over each other, or if you do that they will somehow still get drawn in furthest to closest order. FSO does not use geometry sorting (currently) but this is the source of the requirement that interiors of transparency enclosed regions (ie cockpits) must be separate child objects to the transparent object (typically the hull) because in FSO child objects are drawn before the parent object, and as long as a child object is completely enclosed by the parent, the child geometry will be further away because of this, and further away needs to be drawn first for transparency.

incedently, the most effecent method for drawing non-transparent objects is closest first, this allows the zbuffer to cull pixels before they are drawn, you will still have the cost of transformation, lighting, and all the other vertex related expenses, but you will save the cost of writeing to a pixel more than once, this is called z culling. it's usually not worth the cost to sort geometry, but if you can get away with it without any/much cost, then you should. unfortunately with (alpha) transparency you have no choice but to go to the expense of sorting your geometry into the worst case scenario in terms of z culling.

there is one exception to the sorted geometry requirement, and that is the case ware you use what is known as 'additive alpha', in additive alpha you do not interpolate based on an alpha value, you simply add the source and destination together, thanks to the communitive property of addition the order in which they are drawn is irrelevant, this is why additive alpha is so popular, the only stipulation is you must still draw the non-transparent geometry first. but unfortunately you can not ever darken (like dark smoke would do) with additive alpha which is why alpha blending is used in spite of it's cost.

this leads to another topic which you might have heard of, BSP trees. a BSP tree allows you to sort geometry in linear time (as opposed to nlogn time). in a BSP tree the geometry of the object is recursively split along a plane (hopefully placed and oriented in such a way as to split the geometry into a half such that there is an approximately equal number of polygons on either side of it). once you have set up the BSP tree all you need to do to sort geometry (furthest to closest) is, at each node recursively visit the furthest node first then the closest, processing a polygon whenever you encounter it (for closest to furthest sorting you just visit the nodes in reverse order). BSP trees can also be used to perform collision detection in logarithmic(!) time, to do this you visit the node which is in front of the split plane first, if there is a collision you will find it in logarithmic time, if you set up your BSP tree so the planes all lie along the principal axises and you put bounding boxes around each node's geometry you will be able to discard roughly one half of the geometry at a time, meaning that logorithmic time is not just a best case but the average and worst case as well.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
You know, I though Z-buffer mught be used to somehow sort transparency :D Had a good hunch. Thanks Bob. ;)
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Trashman's homework assignment
well it,s not, it's more like you have to get around it that use it.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
speaking of which, I downloaded the Direct X software Development Kit and there are good sample 3D engine there that are well documented.

Methinks I might be switching to one of them. there's one with some drones flying around that you can shoot with bouncy balls - it's nice and leaves a lot of space to add stuff. :D

thanks for the help guys. If I have any general 3D programing question, I know where to ask :yes:
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
Gotta ask..In the next few days I got to definately pick the engine I'm gonna enhance..

I need something simple (given that I'm not a good programmer anymore), something that doesn't have too many graphical features already.


At first I was thinking of the robot sample engine from the Direct X SDK, but I can't even find the rendering code in that thing (and I never worked with D3D or Direct X .. damn those friggin commands)
the Cube Assault engine looks promising, so I'm thinking of focusing on that one.

Anyone knows some other source code engines he might recommend?
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
K, guys I need your help..

I got tons of great tutorials for both DirectX8 and directX9, I got the Direcxt X SDK and downloaded DX8 libraries additionally.

I'm using Visual Studio 2005 and the code itself is not the problem - I got compile errors since VS can't find the d3d9.h or d3d8.h !!

For the tutorial:
Quote
2.   Make sure that your project settings are correct.
a.   Project > Settings...
b.   On the Link tab, make sure that "d3d8.lib" is in the list of Object/Library Modules. If it isn’t simply type it in.

Where the Hell does one set this things up in VS 2005?
There is no project->setting, and in the project properties I can't find anything..not in any other tab or menu I looked. I'm frustrated as hell - I got the friggin code right, but I can't compile it cause of thuis s***!
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Trashman's homework assignment
I can't say for 2005 but in VC6 there is an input->Additional Input Paths option. Add the path to your SDK there.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
Can't find that either

*slams head against desk*

I'm going to go bald in a few days at this rate.....
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
AAAAAAAAAAAAAAAAAAARGHH!!!!

Do Direct X code will compile!!!!
How the f*** do you include those libraries in this piece of s***!!!! Who the hell designed VS2005???

C'mon guys..one of had to work with 2005..help me out here..I'm dying.
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 
Re: Trashman's homework assignment
You need to set up the options in Tools->Options...->Projects and Solutions->VC++ Directories (see attached)
For DirectX, these are my settings:
Executables: C:\Program Files (x86)\Microsoft DirectX SDK (August 2007)\Utilities\Bin\x86
Include Files: C:\Program Files (x86)\Microsoft DirectX SDK (August 2007)\Include
Library Files: C:\Program Files (x86)\Microsoft DirectX SDK (August 2007)\Lib\x86

Make sure you've got the Platform SDK, otherwise you'll run into trouble as well (the platform SDK can register itself with VS2005, but don't run the tool more than once!)

These are global settings and will apply to all your projects

Best of luck


[attachment deleted by ninja]
STRONGTEA. Why can't the x86 be sane?

  

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
I got Microsoft DirectX SDK (August 2007).. I also downloaded some Dx8 libraries and I put hem inside the SDK instalation folder (in /Lib/x86)

I've also set up the paths as you said. So far it still doesn't work. I'll keep trying.
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 
Re: Trashman's homework assignment
Are you able to post any of the compile errors from the output window?
It'd give us an idea of exactly whats going wrong
STRONGTEA. Why can't the x86 be sane?

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
Ahh...DX9 tutorials are working. It's compliling them now..

but DX8 still don't work.

It's saying it can't find d3dx8.h ... (half the resource files have a #include  <d3dx8.h>  line on top.. I Downloaded the dx8 library from the microsoft site...and put the lib files in the LIb folder of the SDK and the .dll in windows/system32 .. can't understand why it won't work... )
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 
Re: Trashman's homework assignment
Can you point us in the direction of what you're trying to compile - it would really help.
I've just checked in my "C:\Program Files (x86)\Microsoft DirectX SDK (August 2007)\Include" (this is a 64bit windows install, it'll be c:\Program Files\Microsoft DirectX SDK (August 2007)\Include if you're not using Windows 64) and d3d8.h is there. If you've installed the DirectX SDK, it should be there. If you try and include d3d8.h and d3d9.h in the same project, you might run into trouble with a few macro redefinitions!
STRONGTEA. Why can't the x86 be sane?

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
One of Andy Pike tutorials...they were made for DirectX 8 .. they are a bit older, but the explanations in them are excellent.

I'll keep trying, but if push comes to shove, I can always transform the code to DX9.. I think only a few functions changed.
« Last Edit: February 04, 2008, 06:48:23 am by TrashMan »
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
K..here are the Andy Pike tutorials I have been trying out.

Andy Pike Dx8 tutorial


If any one of you guys cane help me get VS2005 to compile them I would be very grateful. they are better than any Dx9 tuts I came across so far .
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 
Re: Trashman's homework assignment
Just tried compiling DX Project 1 from the RAR you posted - didn't compile the first time, but adding '#include <windows.h>' before the d3d8.h include and adding user32.lib to the linker libraries (Project->Properties...->Linker->Input and add user32.lib at the end of the Additional Dependencies line), it compiled and ran the second time I tried. Please post the output from the debug window - it might not be d3d8.h that's causing the problem. BTW, a good DirectX tutorial can be found at www.directxtutorial.com

Please make sure you've got the Windows Platform SDK
If you've installed the DirectX SDK, it's probably the way you've set up visual studio. Can you post a few screenshots/notes on the VC++ directories you've set up, where you installed the DirectX SDK to, copy/paste the output of the build window, etc... so that we know what's going wrong
STRONGTEA. Why can't the x86 be sane?

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Trashman's homework assignment
I installed VC2005 to E:\Visual Studio 8 and the SDK to another HDD, D:\D_X SDK

I adjusted the paths like you said in your post before and DX9 works now.
Quote
Executables: D:\D_X\Utilities\Bin\x86
Include Files: D:\D_X)\Include
Library Files: D:\D_X\Lib\x86


I also added the #include <windows.h>, but the user32.lib isn't in  the list under additional dependencies. :sigh: Where is it located?

the error I get is: FATAL ERROR: Cannot open include file <d3dx8.h>. No such file or directory exists.
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!