Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

140 Neutral

About c3Dp

  • Rank
  1. c3Dp

    Maybe a BUG in PIX ?

    There are a lot of bugs in PIX for windows ... I remember seeing a problem similar to this everything in my depth buffer was black after calling SetRenderState(D3DRS_COLORWRITEENABLE, XXX) and setting that state obviously doesn't clear it
  2. - Use ifstream (input), not ofstream (output) because you cannot call getline on an output stream - Your StringToInt function wont work, use "atoi" instead ... "linecon" is a pointer, your function will return an address at best :P int StringToInt(string temp) { return atoi(temp.c_str()); }
  3. Like szecs said, you could just blend the edge texture with the backbuffer (with a multiply mode) Or if you need something more flexible, you could also render your scene into a texture, not directly into the backbuffer. Then create a new shader, sample the scene and edges texture, combine the scene color with the edges color and render the result into the backbuffer.
  4. You must specify 4 instead of 3 in glTexImage2D no? Or try GL_RGBA8 or something like that as the third parameter in glTexImage2D(GL_TEXTURE_2D, 0, 3, textureImage.width(), textureImage.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, textureImage.bits()); because it discards your alpha I think ...
  5. Well for small interiors, you can simply use the walls and ceiling as occluders / shadow casters ... if your walls and ceiling cast shadows in your outdoor shadow maps, you won't have the outdoor lighting inside :P For bigger interiors you could also do the same and toggle the sun light off when the outside world is not visible from the inside to save rendering time. There is a lot of shadow map techniques and the best solution depends on a lot of factors. The simplest solution for outdoor shadows is probably the cascaded shadow maps technique. You won't use directional light indoor and point light shadows are not trivial to do (the light emits in all direction). So you pretty much stuck with spot light shadows. In that case, a basic shadow map for each light that casts shadows does get the job done.
  6. c3Dp

    Recording Games

    It's probably how the multiplayer code works also because in a RTS you can't often replicate the properties of each unit on each client in realtime. They are probably just replicating the inputs, seeds, delta time etc. on each client. So once you got it working for the multiplayer, it's trivial to do replays.
  7. Huh, the 2nd surface (the DevView->CreateOffscreenPlainSurface(1680,1050,D3DFMT_A8R8G8B8,D3DPOOL_SYSTEMMEM,&o1texs, NULL),L"o1texs error") ) isn't freed and never used actually. o1tex->GetSurfaceLevel(0,&o1texs) overwrites o1texs value, so your pointer is lost.
  8. An easy way is to output a "material id" in one of your g-buffer channel. When you do the lighting pass, you can customize the lighting based on that material id. But you'll most likely have to do dynamic branching in your shader. But S.T.A.L.K.E.R. for example, used the ID to look into a 3D texture instead. The texture contains some surface properties in order to customize the lighting for each ID.
  9. What's wrong with having more than one shader? In my opinion, you shouldn't have a "deferred" shader that does everything, you should have a terrain shader with a deferred code path, a mesh shader with a deferred and forward (for blended object) code path, particles shader in forward only, etc. As Semei said, just create common fetching functions and reuse them You can also do something similar to this: in "DeferredPixelShader.hlsl" PS_OUTPUT ShadePixel(in VS_INPUT input) { PS_OUTPUT out; out.color0.xyz = GetDiffuseColor(input); out.color1.xyz = GetNormal(input); return out; } and implement the GetDiffuseColor(), GetNormal() function in the mesh shader float3 GetDiffuseColor(in VS_INPUT input) { return input.vertexColor * tex2d(diffuseTexture, input.uv); } #include "DeferredPixelShader.hlsl" and in the terrain shader: float3 GetDiffuseColor(in VS_INPUT input) { do texture splatting here ... } #include "DeferredPixelShader.hlsl"
  10. Quote: I also tried just casting the matWorld to (float3x3) for the multiplication with the normal but that doesn't pass my compiler normalize ( mul ( In.Normal.xyz, (float3x3)matWorldIT ) ); should work Also you're doing a bunch of operations with float4 ... like this: // get the normalized vector from this pixel to light float3 LightVector = normalize ( lightPos - In.Position ); lightPos and In.Position are both float4, not sure if the normalize returns what you expect or if it's your problem tho :) Try to use your original pixel shader (first post) but change the following: // normalize normal and bring it into world space In.Normal = normalize ( mul ( In.Normal, matWorld ) ); // bring position into world space In.Position = mul ( In.Position, matWorld ); ... // get the normalized vector from this pixel to light float3 LightVector = normalize ( lightPosition - In.Position ); for // normalize normal and bring it into world space In.Normal = normalize ( mul ( In.Normal.xyz, (float3x3)matWorld ) ); // bring position into world space In.Position = mul ( float4(In.Position.xyz,1), matWorld ); ... // get the normalized vector from this pixel to light float3 LightVector = normalize ( lightPosition.xyz - In.Position ); [Edited by - c3Dp on March 17, 2010 11:37:40 PM]
  11. c3Dp

    Survey: Will the program be useful?

    Quote:Do you create shaders on assembler? Not anymore, used to when the number of instruction was limited or the performance was more of a problem than today, mostly before shader model 3. Quote:Do you know the analog of program, which I described? (Supporting ASM Shaders)? Yes ... RenderMonkey by ATI or FX Composer by NVidia are the best known. Not sure if you can edit assembly shaders directly in FX Composer tho, but RenderMonkey supports it. I also saw a simple tool (or sample) similar to what you described in one of the version of the DirectX SDK a while ago. There is probably a bunch of them, but these two do the job nicely for me.
  12. c3Dp

    Only alpha textures work?

    Many cards don't support that format, you can check at initialization if the player hardware support it with CheckDeviceFormat() function and use it or always use 255 as alpha for your 24bits textures. But most games use compressed format such as DXT1/DXT3/DXT5 generally.
  13. It's weird that everything works fine when you use D3DPOOL_MANAGED because I think that you cannot specify D3DPOOL_MANAGED when using a dynamic vertex buffer. Does you vertex buffer has to be dynamic? From the doc: "dynamic resources are not a good match for D3DPOOL_MANAGED. In fact, index buffers and vertex buffers cannot be created using D3DPOOL_MANAGED together with D3DUSAGE_DYNAMIC." Anyway, you can try to get the string from the HRESULT with DXGetErrorString(Err)
  14. c3Dp

    Direct3d - Newb Probs

    You could dynamically change the vertex via a shader like Ron said, but I guess you don't have access to a vertex shader at the moment since you're using the fixed pipeline. If your vertices doesn't change often, you can rebuild the vertex buffer ... or use a dynamic vertex buffer instead of a static vertex buffer. To create a dynamic vertex buffer, you must use the D3DUSAGE_DYNAMIC usage flag (2nd parameter) when calling CreateVertexBuffer() instead of 0. Then you can move your Lock()/memcpy()/Unlock() function calls in render_frame() instead and specify a different array of vertex at each frame. The problem with dynamic buffers is that you have to manage them correctly (double/triple buffer them and Lock/Unlock them with the right flags) in order to avoid stalls on the CPU if the GPU is using the buffer at the moment you call the Lock.
  15. Are you rendering more than one sprite with the same texture? D3DXSprite batch sprites with the same texture/state into a single draw call. If instead you're doing a DrawPrimitive for each textured quad, it will be a lot slower. Are you using DrawPrimitiveUP or DrawPrimitive? indexed triangles? static or dynamic vertex buffer? Are you setting states multiple times? There is a lot of things that can have impacts on the performance. You should try to use PIX to check out how D3DX do it for you in your case.
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!