Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

189 Neutral

About PSS

  • Rank
  1. I recently had an interview test for a game programming position, followed by a face to face interview with a game dev company, here in Toronto. The interview test went well, and left me with a good sense of my abilities. I was then scheduled to come in for an interview later on that week. Long story short, I blew it at the interview. Questions that I knew the answer to ended up being 'err...umm...der.... sorry, um....'; it was painful. It's self-evident that my technical skills need to be reinforced by improved 'soft skills' and networking opportunities. I have no friends that are interested in video game programming, so I'd have to go at it alone but, does anyone have any suggestions for game programming/development networking in Toronto?
  2. I had originally loaded my texture with D3DPOOL_DEFAULT, though this hasn't been as fruitful an effort as I had hoped. So I took your advice, and I'm simply locking the texture to extract the texels I need. Thank you very much for the assistance MJP, it's appreciated.
  3. Problem: I need to retrieve a heightmap value, given a texel coordinate during runtime. I'm trying to avoid having another copy of the texture on the CPU, as it's already sitting in the GPU and it's rather large. So, what I've been trying to do is get a colour value from the pixel shader in D3DFMT_R32F format and then slap it into a 1x1 texture-surface in sysmemory. Result so far: the returned height is always 1.0 and PIX claims the surface is empty. Relevant code: Vert/Pix shader (pastebin.com) Initialization code (pastebin.com) Render to surface code (pastebin.com) Retrieval code (pastebin.com) If anyone can provide a hint as to where I might have gone wrong, or maybe have a better idea of how I can solve my problem, or gotchas' I might not be conscious of, I would sure appreciate the help! EDIT: This is Direct3D 9 in Windows 7, ATI HD4850 [Edited by - PSS on January 5, 2011 9:12:30 PM]
  4. PSS

    Game Art Assets Packaging

    I'm not sure how others do this, but I just created my own custom resource file. It encapsulates whatever file I want into a single file (with optional encryption and compression). I'm not sure if this is a viable option for you, but here's a type of tutorial that can give you an idea of what I'm talking about: gpwiki.org - Custom_Resource_Files
  5. Thank you very much for the quick response, and pointing me in the right direction! After closely reviewing all of the object constructors, I noticed that one of the wrapper's derived class was not initializing anything. Cleaning up that class fixed the issue. Thanks again!
  6. While in the default Debug Solution Configuration, my meshes render as arbitrary artifacts. This only occurs when my mesh wrapper is initialized with 'new'. ... CMeshWrapper* m_pEnt; CMeshWrapper m_Ent; ... OnCreate( ... ) { m_pEnt = new CMeshWrapper(); //Constructor sets internal mesh to NULL m_pEnt->SetMesh( "mesh.x" ); //Creates the mesh m_Ent.SetMesh( "mesh.x" ); //Creates the mesh } OnRender( ... ) { ... m_pEnt->Render( ... ); m_Ent.Render( ... ); ... } Note: I've tried every order possible between the two mesh wrappers, and the mesh is ALWAYS created the same way and seems valid when rendering (how can I check this for sure?). After looking for a while, I haven't been able to find a reason for this. What differences do heap allocations have in debug mode vs release mode? Or am I doing something wrong? [Edited by - PSS on April 23, 2009 11:51:59 AM]
  7. Well now, I'm even more confused. After messing around with a lot of this, I decided I would disable shadow mapping the terrain (so only objects would be stored in the depth map), this is the result: 3 problems: 1) the tree shadows should not be projected on the hill (the hill is closer to the light source than the trees) 2) white is black, black is white 3) The objects will be selfshadowed, before the shadows project properly (related to 1, I believe), regardless of the bias I don't understand what's happening here, is the depth map inverted? (I'm using D3DFMT_R32F). Any hints? Note: The code has not changed from the above, except for bias changes and not saving terrain depths. I'm using the shadow map DX sample, provided by the Directx August 2008 SDK as a guide
  8. Quote:Original post by glaeken Why are you multiplying the World and ViewProj matrices in column fashion (right to left)? Shouldn't it be mul(World, ViewProj)? That was a mistake, thank you for finding it. It has improved the conditions of problem #2, though after much tweaking of the bias and culling, problem #1 is still an issue. Other than the bias, culling and clipping planes, is there anything else I should be tweaking? This is what it looks like now (notice that the trees and buildings are looking much closer to the desired result): Thanks for the help so far
  9. PSS

    directx 9 fullscreen flicker

    Could be a driver issue, if it worked previous to your re-install of windows. What's your device clear line look like? ie: pdev->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DXCOLOR( 0.1f, 0.1f, 0.1f, 1.0f), 1.0f, 0 );
  10. Thank you for the reply, When I throw out PCF, the results are the same, only lower quality shadows for the trees and buildings. When I add more bias, the good shadows disappear before the bad self shading goes away. Meaning the trees no longer cast shadows, but the ground under the trees still do (though the ground should be lit). I changed the 'step' to the Microsoft sample's code: return (tex2D(vSamSMaps[fvLIndex], tvProjTex.xy).r + SHADOW_EPSILON < tvDepth) ? 0.0f : 1.0f and when playing with the bias, I ended up with the following: Note: This is without pcf, no culling. Notice that some of the shadows are correct, though some are inverted, and others are plain wrong. My light's near clip is 1.0, and far is 5000.0. I played around with this (lowering to 1000, 500, 100), but it didn't seem to have any effect.
  11. Has anyone had a similar problem? What was the solution? I'm really just looking for a hint, or a guess. I'm all out of ideas and my searches keep returning the same results. The projected texture parameter (float4 fvLVPPos) passed into the function is: vertex shader's 'in' position, multiplied by the world matrix * light's view matrix * light's projection matrix //Projected texture is position in worldViewProjection of the light float4x4 tvMatLightWVP = mul( vMatLightVP, gvMatWorld ); Output.ProjTex = mul( float4( Input.Position, 1.0f ), tvMatLightWVP );
  12. I have two problems, which may be related. Problem 1: When projecting a shadow map on the terrain, object shadows seem to be properly casted, though the terrain is self shadowing. Problem 2: Objects are ALWAYS in shadow, though the exact same calculations as the terrain are being applied. I've messed around ALOT with depth bias, and I'm convinced that bias is not where the issue lies. I've also tried culling and not culling the front faces, though the effects are even less accurate. I've also tried using 'CLAMP' instead of 'BORDER', though it doesn't fix the issue and it adds a 'stretching' problem. This is the code to project the shadow map: sampler2D vSamSMaps[1] = { sampler_state { Texture = <gvShadowTexture>; MinFilter = POINT; MagFilter = POINT; MipFilter = POINT; AddressU = BORDER; AddressV = BORDER; } }; /** @brief Calculate the single source shadows for the light source provided @param fvLVPPos, the position of the pixel in light's view projection * world matrix @param fvLIndex, the light's index*/ float CalcShadows( float4 fvLVPPos, int fvLIndex ) { //Project the texture coords and scale/offset to [0, 1]. float4 tvProjTex = fvLVPPos; tvProjTex.xy /= tvProjTex.w; tvProjTex.x = 0.5f * tvProjTex.x + 0.5f; tvProjTex.y = -0.5f * tvProjTex.y + 0.5f; // Compute pixel depth for shadowing. float tvDepth = tvProjTex.z / tvProjTex.w; // Transform to texel space ( NOTE: SMAP_SIZE HARDCODED TO 1024 FOR NOW ) float2 tvTexelpos = SMAP_SIZE * tvProjTex.xy; // Determine the lerp amounts. float2 tvLerps = frac( tvTexelpos ); // 2x2 percentage closest filter. float dx = 1.0f / SMAP_SIZE; float s0 = step(tvDepth, tex2D(vSamSMaps[fvLIndex], tvProjTex.xy).r + SHADOW_EPSILON); float s1 = step(tvDepth, tex2D(vSamSMaps[fvLIndex], tvProjTex.xy + float2(dx, 0.0f)).r + SHADOW_EPSILON); float s2 = step(tvDepth, tex2D(vSamSMaps[fvLIndex], tvProjTex.xy + float2(0.0f, dx)).r + SHADOW_EPSILON); float s3 = step(tvDepth, tex2D(vSamSMaps[fvLIndex], tvProjTex.xy + float2(dx, dx)).r + SHADOW_EPSILON); return lerp( lerp( s0, s1, tvLerps.x ), lerp( s2, s3, tvLerps.x ), tvLerps.y ); }
  13. step seems to have resolved the issue. I can't be sure, since everything is being returned as 0, though this is likely caused by other faulty portions of code. Thank you for the advice!
  14. Looking at the result of this operation in PIX, the value of s1 is either 0, or a number greater than 100. Is PIX not reliable for these values? float s1 = (tex2D(gvSamShadow, fvInput.ProjTex.xy + float2(dx, 0.0f)).r + SHADOW_EPSILON < tvDepth) ? 0.0f : 1.0f; Note: this is in the pixel shader, though I'm having similar issues in the vertex shader. ps & vs 3.0 Directx August 2008 SDK, DX 9.0c code. [Edited by - PSS on March 9, 2009 12:15:35 AM]
  15. Thanks JWalsh! Thank you for clarifying that for me, that did the trick!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!