darrenmarklines

Members
  • Content count

    37
  • Joined

  • Last visited

Community Reputation

200 Neutral

About darrenmarklines

  • Rank
    Member
  1. weired situation between Direct3D9 and OCX.

    Your problems are floating point precision releated, try passing the flag 'D3DCREATE_FPU_PRESERVE' to the CreateDevice call.
  2. Specular calculation in Spotlight Shader

    I would have thought that the specular component was affected by the rotation of the light, but I tried an experiment in 3D Studio Max to sweep (via a rotate) a spotlight across a plane and the result was that the specular highlight stayed in the same place. If Autodesk can do it, so can I! The main result of this is that I don't have to do anything different for my spotlight, except attenuate the specular component by the spotlight calculation. The secondary result of this is that I feel like an amateur for posting 'really weird' code, anyway thank you MJP for the pointer to my incorrect specular calculation, I have now 'de-weirded' it.
  3. Hi, I'm working on a spotlight shader and am stumped on the specular component calculation, most specular calculations assume an angle of reflectance from the lights position against the normal of the object in question (the light being assumed to be omini in this instance). Here is a standard omni representation... [source lang="cpp"] float3 directionToLight= normalize(lightPosition - In.WorldPosition) float3 norm = normalize( reflect( -directionToLight, normalize(In.WorldNormal) ) ); // Calculate the half angle: the half the angle between our light direction and camera view float3 halfAngle = normalize( In.CameraView - directionToLight); //Get Specular component specular = pow( saturate( dot( norm, halfAngle ) ), specularPower ) * specularLightColor * specularIntensity; [/source] The Spotlight is a different beast as it has direction as well as position, and this calculation is not physically correct as the light source could be rotated away from from the object and the calculation would yield a result for a positive specular value. Does anyone have any good examples of the correct specular calculation? Thanks in advance.
  4. Create a Fake Perspective ?

    PerspectiveOffCenterLH is what you want, you need to change the camera dynamically per object with an offset that is appropriate for the effect you want.
  5. Quicktime Animation format supports 32bit RGBA, its called Millions of Colors+ in the QuickTime interface. It is supported for decode and encode in the LibAVCodec library. [quote name='fanaticlatic' timestamp='1311151209' post='4837849'] [quote name='Shael' timestamp='1311115967' post='4837681'] You sure about FFmpeg/Libav? I'm looking at the supported pixel formats and it supports RGBA. [/quote] [quote name='fanaticlatic' timestamp='1311150387' post='4837846'] Do you have a link? I spent the better part of yesterday looking through FFmpeg and didn't notice anything that may support the RGBA format. 1 colour alpha won't do (green-screening) I need a full channel. Thanks for the replies. Mark. [/quote] I called "ffmpeg -pix_fmt list" and it does indeed support argb, rgba, abgr, bgra formats for input and output. So the question then becomes does anyone know which codec ffmpeg uses to decode the video file when one of these formats is used as the input video pixel format? I would also note that the four rgba versions are not hardware accelerated. Hardware acceleration would be very nice to have but not a deal breaker. Thanks again. Mark. [/quote]
  6. Could this be used for a bevel based extrusion, for instance growing/shrinking as it extrudes based on edge normals?
  7. Free Wrappable Planetary Textures?

    http://www.oera.net/How2/TextureMaps.htm
  8. D3DXLoadSurfaceFromResource

    Here's some code from my Engine load a texture from a resourceID, hope it helps I seem to remember that i first tried D3DXLoadSurfaceFromResource, but could not get it to work, so i then moved on to D3DXCreateTextureFromFileInMemory, as this piece of code shows. void CreateTextureFromResource(LPCTSTR ResourceID) { D3DSURFACE_DESC desc; HRESULT ret; HRSRC hrsrc = NULL ; DWORD dwsize = 0; HGLOBAL hglobal = NULL; LPCVOID pvdata = NULL; hrsrc = FindResource( myEngine->hInstance, ResourceID , "RT_RCDATA"); if (hrsrc) { // Get the size dwsize = SizeofResource( myEngine->hInstance, hrsrc ); // Load it hglobal = LoadResource( myEngine->hInstance, hrsrc ); // Lock it and get a pointer to the data pvdata = LockResource( hglobal ); SafeRelease(g_pTexture); SafeRelease(mySurFace); // Create the texture D3DXCreateTextureFromFileInMemory( m_pD3DDevice, pvdata, dwsize, &g_pTexture ); // Unlock it UnlockResource( hglobal ); // Free the memory FreeResource( hglobal ); if ( g_pTexture ) { g_pTexture->GetSurfaceLevel(0,&mySurFace); if (mySurFace!=NULL) { mySurFace->GetDesc(&desc); // Store Away real width and height m_RealWidth = desc.Width; m_RealHeight = desc.Height; } } } } edited to use source tag
  9. Preview Multisampled Depth Stencil Surface in DX9

    So if I perfrom a 2 pass rendering sequence, once against a non multisampled texture created with D3DUSAGE_DEPTHSTENCIL, then against my multisampled depthstencil. then in the second pass i could render the depth buffer from the 1st pass?
  10. Anyone know of a way to effectivly use a multisampled depth buffer as a texture in DX9?
  11. i've used ID3DXFont with right to left text and the only problem I had was on a UK XP machine when the regional optional in the control panel did not have the 'support for right to left langauges' option ticked!
  12. Something like the Quadro FX 5500 SDI or 4500 SDI will do the job. It has DirectX 9 support for the fill (RGB) only. If you need to generate a key signal then you have to use OpenGL on these cards. Another way to handle it is to use an off the shelf DirectX card, then capture the render buffer and push it to a broadcast SDI card. This solution requires a lot of work and a high level of knowledge about broadcasting.
  13. [solved] Instancing and HLSL, C++

    that really helped, thanks. The CreateVertexDeclaration was failing because of lots of D3DDECLUSAGE_COLOR parameters, you need to pass D3DDECLUSAGE_COLOR, 0 for the first, D3DDECLUSAGE_COLOR, 1 for the 2nd etc. the same thing applies to the .fx file, COLOR0 for the 1st, COLOR1 the 2nd etc. I now have 1000 instances of my mesh at hardly any perfomance cost. Now to try and get those colour paramters implemented. Anyone know how to deal with specular colour in a shader?
  14. Hi, I'm adding streaming instancing support to my graphics engine and I have a couple of problems. I'm basing my code on the DirectX Hardware instancing demo from the SDK. The first problem is my vertex buffer, my buffer has vertex position, normals, colour, specular and texture coorinates. struct MYVERTEX { float x, y, z; float nx,ny,nz; DWORD Col; DWORD Spec; float tu, tv; } ; the example from the sdk has Position, normal and texture coordinates. I'm trying to create the vertex declaration for my vertex buffer.. D3DVERTEXELEMENT9 g_VertexElemHardware[] = { { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },// Size 12 { 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },// Size 12 { 0, 24, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },// Size 4 { 0, 28, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1 },// Size 4 { 0, 32, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },// Size 12 { 1, 0, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },// Size 4 { 1, 4, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1 },// Size 4 D3DDECL_END() }; hr = m_pD3DDevice->CreateVertexDeclaration( g_VertexElemHardware, &g_pVertexDeclHardware ); if (hr == S_OK) Instancing = true; else Instancing = false; my first problem is that CreateVertexDeclaration fails and I don't know why, the second problem is with the .fx file. void VS_HWInstancing( float4 vPos : POSITION, float3 vNormal : NORMAL, float4 difCol : COLOR0, float4 SpecCol : COLOR0, float2 vTex0 : TEXCOORD0, float4 vColor : COLOR0, float4 vBoxInstance : COLOR1, out float4 oPos : POSITION, out float4 oColor : COLOR0, out float2 oTex0 : TEXCOORD0 ) this also fails to compile? what am I doing wrong? [Edited by - darrenmarklines on October 11, 2007 7:03:13 AM]
  15. Two objects in .X file - no z buffer?

    have you tried rendering in reverse order?