|
-
Sep 28th, 2002, 08:57 AM
#1
Thread Starter
Lively Member
-
Sep 28th, 2002, 09:26 AM
#2
Frenzied Member
Other then locking the backbuffer, no, there is no way to do it.
Z.
-
Sep 28th, 2002, 09:51 AM
#3
Thread Starter
Lively Member
Z
Would u agree that this method is slow?
-
Sep 28th, 2002, 10:13 AM
#4
Frenzied Member
Pretty slow... but if you need to do it, do it. Experiment =).
Z.
-
Sep 28th, 2002, 10:13 AM
#5
Good Ol' Platypus
Using the array is fast, using GetLockedPixel is slower.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Sep 28th, 2002, 10:26 AM
#6
Thread Starter
Lively Member
Well I wanna do it to check wether the 'sun' is visible or not. If the pixel colour at the suns screen pos is not that of the sun then I know it is obscured otherwise it is visible. If so draw a lens flare if not dont.
Can any1 give me some VB code for this please (just the locking the backbuffer and getting the pixel colour part).
Cheers
Dan
-
Sep 28th, 2002, 10:30 AM
#7
Frenzied Member
Ack! BAD reason to lock the back buffer... To see if the sun is onscreen, just use the D3DXVec3Project() function, and project the sun's position onto the screen. Then just check to see if the returned point is within the screen's boundries.
Z.
-
Sep 28th, 2002, 10:33 AM
#8
Frenzied Member
As far as I can see, there are only 2 reasons that you would lock the back buffer. The first, is to apply some sort of post render image filter (like a blur). You could blur by using a texture as a render target, and then using that texture to cover a screen-sized quad, scaled up (the texture filter will blur for you).
The other is to take a screen shot.
Some people will use the abck buffer to do culling, but I think this is a bad method.
Z.
-
Sep 28th, 2002, 10:54 AM
#9
Good Ol' Platypus
The blur would look pretty bad though, Zaei!!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Sep 28th, 2002, 11:02 AM
#10
Frenzied Member
Depends on the card, and the blur filter applied =).
Z.
-
Sep 28th, 2002, 12:13 PM
#11
Thread Starter
Lively Member
D3dXVec3Project would tell u if it was on screen or not but it wouldnt tell u if it was obscured by other geometry or not right? You wouldnt want a lens flare showing if u couldnt see the sun even if it was on screen.
Probably is a bad approach though.
Dan
-
Sep 28th, 2002, 12:30 PM
#12
Frenzied Member
That is what ray casting is for =). Use D3DXVec3Project, and find the screen coordinates of the sun. If it is onscreen, use D3DXVec3Unproject to find the point on the near clip plane (z==0.0). Create a ray using the sun pos, and the point you just found, and see if that ray intersects any geometry. If it does not, draw your flare.
Z.
-
Sep 28th, 2002, 12:45 PM
#13
Thread Starter
Lively Member
lol @ z==0.0 u C++ man .
Can I be cheeky and ask for code for that please Z its just that Im desperate to have tomorrow off Ive been stuck to this thing all week and its back to college on Monday.
Cheers
Dan
-
Sep 29th, 2002, 12:23 AM
#14
Frenzied Member
Its an engine thing. You are starting to realize why game engine design is such a hot topic. You need a way to get at your geometry, so that you can create planes from it, and then check to see if the intersection point on that plane is inside of the geometry triangle. You can use the D3DXLineIntersectPlane() function to check plane intersection, and D3DXPlaneFromPoints() to create the plane. Do a google search for a function to find out if a point is within a plane. Other then that, it is simply a matter of looping through each triangle in your geometry, and see if it is intersected by the ray.
And yes, C++ smacks VB around =).
Z.
[edit]
At lease I didnt use == 0.0f =).
-
Sep 29th, 2002, 03:05 PM
#15
Thread Starter
Lively Member
lol yeah dont I know it, why on earth did I start learning DX in VB O well no time to change now .
Those function names will give me something to work on. Cheers
Dan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|