# rouncED

Member

359

103 Neutral

• Rank
Member
1. ## So I've made this little MMORPG...

thats really cool, you should keep going with this!!! add some simple combat system and chat!
2. ## [SOLVED] 3D Ray Picking (Again)

This is how I have been doing it for a few years now. void inverse_project(MAT view, MAT proj, float x, float y, float width, float height, VEC &orig, VEC &dir) { D3DXVECTOR3 vPickRayDir; D3DXVECTOR3 vPickRayOrig; D3DXMATRIX matProj; matProj=proj; // Compute the vector of the pick ray in screen space // this is the magic bit. D3DXVECTOR3 v; v.x = ( ( ( 2.0f * x ) / width) - 1 ) / matProj._11; v.y = -( ( ( 2.0f * y ) / height) - 1 ) / matProj._22; v.z = 1.0f; // Get the inverse view matrix D3DXMATRIX matView, m; matView=view; D3DXMatrixInverse( &m, NULL, &matView ); // Transform the screen space pick ray into 3D space //then this is simply converting it to world space. vPickRayDir.x = v.x*m._11 + v.y*m._21 + v.z*m._31; vPickRayDir.y = v.x*m._12 + v.y*m._22 + v.z*m._32; vPickRayDir.z = v.x*m._13 + v.y*m._23 + v.z*m._33; vPickRayOrig.x = m._41; vPickRayOrig.y = m._42; vPickRayOrig.z = m._43; orig=vPickRayOrig; dir=vPickRayDir; }
3. ## dx11 and screen coordinates

Ah I know what it was! I was making my d3d window slightly bigger than the screen, so it was actually reporting back correct coordinates for how big the actual window was.

5. ## DX11 dx11 and screen coordinates

Im trying to draw sprites with direct x 11 right, but for some reason its hanging sprites over the edge of the screen even when their coordinate is exactly (1,-1) or (1,1) shouldnt these 2 coordinates be the corners of the screen exactly?!!? It hangs about a good centimetre over the edge of the screen... If I do the exact same thing in direct x 9 it works, so whats the difference?
6. ## Rotation around world (not model) axes

Your pretty confused, if you call an x rotation then a y rotation, its not gonna tilt the y rotation by the x rotation, they will both be in world space! What you NEED to do is actually TILT the rotation! Have you tried using general axis rotations? To do that, make an up right and front vector, then if you want to do an x rotation, rotate the model by the up, but also rotate the up right and front vectors at the same time. then if you want to do a y rotation now, use the "rotated right" as the next axis rotation, and i think this will give you something more to what you would desire. Im actually guessing your saying what you want wrong, you dont want to rotate around the world axi, cause thats what your getting now, what you want to do is rotate inside "object space axi" I think you better trust me that rotating an object on the x axis, then rotating it on the y axis WONT tilt the y axis rotation. (in fact im trying to tell you to actually tilt it, because I think its what you want.) And its actually because its NOT tilted that you are finding it in error. [Edited by - rouncED on October 25, 2010 9:35:33 PM]

8. ## Generating a Normal Map

I dont get it, how does it get the blurry light around the outside of the planet?!?!?
9. ## Generating a Normal Map

im on vista with direct x 11, direct x 11 is definitely more stable than it used to be, and it seems to back support well. My video card is a gtx480. To do atmospheric scattering, you colour the black in (the space) with blue depending on how far away it is from the planet surface... its sorta like particles in the air reflecting light that give it its colour. you could quickly do it with a translucent billboard, maybe. I could think of a really slow way to do it, by doing an image space pass, but it would be too slow, might look nice tho. try doing it with a translucent billboard, scale the billboard so it fits exactly around the planet, it gets bigger when its closer to the planet than further away, but the billboard sprite should look like a translucent blue ring, most opaque at the inside ring, totally see through at the outside ring.
10. ## Generating a Normal Map

It worked fine, it was cool! :) I couldnt tell you how to do atmospheric scattering, you need to make it so you can actually go "into" the atmosphere of the planets, so ive got no idea... its sorta like fog you can see through looking into it, but you cant glimpsing it off an angle - And when you go into it, it becomes the sky colour, who the hell knows.
11. ## Generating a Normal Map

I wanna have a go on your demo now, its awesome! It actually looks a lot like the doom3 titlescreen. Now youve got to normal map the ship, need any help? hehe
12. ## Generating a Normal Map

Ah you fixed it! Looks great man! Yeh sometimes I flipped a matrix mul around here and there to get it to work I remember too! Let me see if I can explain object space normals to you. Object space normals are when you literally point in all directions out of the sphere on the normal map instead of plain flat forwards so instead of it being a pale blue it would morph to red and green. Object space normal mapping needs no tangent space, but instead you literally rotate every single normal in the pixel shader when the planet spins instead of rotating the tangent space. The advantage of using tangent space is you could wrap any generic normal map you wanted on the planet and it would twist into a sphere, if you used object space normal mapping you couldnt use any normal map except the custom designed spherical one. [Edited by - rouncED on October 22, 2010 1:03:09 AM]
13. ## Generating a Normal Map

ok np... see u tomorrow?
14. ## Generating a Normal Map

Im not sure, try mucking around with the cross products when it makes the tangent vectors (up, right and normal) I think im about out of ideas now, im not sure what could be going wrong!
15. ## Generating a Normal Map

I consider myself an experienced hobbyest, maybe i could have had a job sometime and still might, but I only ever figured out stuff myself for fun... If you could only render a movie, then id have a better idea! public void CreateSphere(ref VertexPositionNormalUpRightTexture[] vpnt, ref int[] indices, int m_NumSlices, int m_NumStacks, float m_Radius) { int tDiv = m_NumSlices; int pDiv = m_NumStacks; float dt = ((float)Math.PI * 2) / tDiv; float dp = (float)Math.PI / pDiv; int vertex = 0; for (int pi = 0; pi <= pDiv; pi++) { float phi = pi * dp; for (int ti = 0; ti <= tDiv; ti++) { // we want to start the mesh on the x axis float theta = ti * dt; vpnt[vertex].Position = GetPosition(theta, phi, m_Radius); vpnt[vertex].Normal = GetNormal(theta, phi); vpnt[vertex].Texture = GetTextureCoordinate(theta, phi); vertex++; } } int index = 0; for (int pi = 0; pi < pDiv; pi++) { for (int ti = 0; ti < tDiv; ti++) { int x0 = ti; int x1 = (ti + 1); int y0 = pi * (tDiv + 1); int y1 = (pi + 1) * (tDiv + 1); indices[index] = x0 + y0; indices[index + 1] = x0 + y1; indices[index + 2] = x1 + y0; indices[index + 3] = x1 + y0; indices[index + 4] = x0 + y1; indices[index + 5] = x1 + y1; index += 6; } } for (int i = 0; i < vertex; i++) { Vector3.Normalize(ref vpnt.Position, out vpnt.Normal); vpnt.Up = new Vector3(0, 1, 0); if(acosf(Vector3.Dot(vpnt.Up,vpnt.Normal))<0.1f) { vpnt.Up = new Vector3(0, 0, 1); } if(acosf(Vector3.Dot(-vpnt.Up,vpnt.Normal))<0.1f) { vpnt.Up = new Vector3(0, 0, 1); } Vector3 cross = Vector3.Cross(vpnt.Normal, vpnt.Up); Vector3.Normalize(ref cross, out vpnt.Right); vpnt.Up = Vector3.Cross(vpnt.Normal, vpnt.Right); } }