Jump to content
  • Advertisement

dys129

Member
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

116 Neutral

About dys129

  • Rank
    Member
  1. I told you it's a bit crappy and I thought you need some basic implementation of shadow mapping :) This is best sample of PSSM in whole internet: PSSM example Hope this helps!
  2. here you go: Shadows. It's a little bit old code and full of errors in the last shadow mapping techniques but I never had time to finish it. The basic ones are working fine. If you have any further questions feel free to ask.
  3. If you really want I can send you my simple app for testing different shadow mapping techniques so you could use it for reference.
  4. dys129

    [HLSL] Never EVER unroll?

    When I wrote my raymarcher (a lot of loops and if-statements) on gpu I found that compiling it using SDK August 2009 it took about 2 min but using SDK March 2008 instead took 5 s. So as you see you are not alone :)
  5. dys129

    DX10 and .x files

    Somewhere in internet (just google it) is wrapper for dx10 to load .x file. But instead of sticking to .x file you could develop your own format, it's not that hard :)
  6. There are 2 possible explanations of error imho. 1. Model is just broken. Did you check it elsewhere? 2. Which texture format you are using for depth buffer? Error maybe due to z-fighting and it can be solved by changing this format into for example D24S8.
  7. According to siggraph 2055 ATI presentation on HLSL: "The result of a gradient calculation on a computed value (i.e not an input such as a texture coordinate) inside dynamic flow control is ambigous when adjacent pixels may go down separate paths. Hence, nothing that requires a derivative of a computed value may exist inside of dynamic flow control. This includes most texture fetches, ddx() and ddy() - texldl and texldd work since you have to compute the LOD or derivatives outside of the dynamic flow control." I hope this answers your question. I advise you to read this: developer.amd.com/media/gpu_assets/ShadingCourse_HLSL.pdf
  8. dys129

    HLSL: initialize variables?

    There is no special reason. I assume that it is because of experiance in C programming. All variables of all types are guranteed to be initialized to 0.0f by the compiler and by Microsoft :)
  9. dys129

    dsound or sndPlaySound

    If you just want to play some sound files ( mp3, wav, etc) use library like fmod, bass. If you want to write your own software synthesizer both ways are correct, but as adt7 said DirectSound is deprecated :) PS. ask this question in Sound forum they should know better :)
  10. Yep B_old is right there is no magic in it. If you want to have two shaders at one time you can use two approaches : 1. Ubershader ( I suppose it's called that way) - Write shader compiler using compile macros. Then you can use syntax similar to this: VertexShader shader = UberShader->GetVertexShader( DIFFUSE | SPOTLIGHT | TOONSHADING); UberShader is simmply one shader with a lot of macros (hlsl #ifdef .. #endif). UberShader will contain informations about compiled shaders and macros ( in hash_map for example). If UberShader contains already that shader compilation it simply returns it but if it doesn't it will set appropriate macros and recompile shader and put it into library. Just google it for sample code :) 2. You can use blending to merge result of two passes but it is not as general solution as first approach.
  11. dys129

    "Dynamic" effect files

    I really like that you like my system :) Asnwering your question: 1. As I said in MaterialManager I have wrapers for setting dx variables. And what I meant is that in material class contains values for this variables and in Update function it updates all its variables. But material instance contains only data relevant to one mesh instance ( Diffuse, Normal, specular map etc.). Global variables like lights values are set once and in the beginning of the frame. But if some material want to change some global variable ( I can't imagine why :) it has to do it on its own and then restore original value. Ad 2. I'm using constant buffers for variables shared between materials like : cbuffer { Texture diffuse, normal, specular; } and all other variables ( for different materials) are stored like typical variables :) ie: //Reflectance material Texture refl; float refl_strength; And when Material::Update is called it uploads ALL variables specific to this material via MaterialManager wrapers. Just as Nik02 said. In my engine I've got only few materials because I'm using deferred shading :)
  12. dys129

    "Dynamic" effect files

    This is my idea of handling materials, shaders and meshes: In my simple engine I've separated shaders (materials) from meshes. Because I assume I want to have one material per many meshes. So I have one class MaterialManager which is responsible for holding effect files and wraps all functions to set shader variables. Also it uploads once per frame global variables in constant buffer (time, view and projection matrices etc.). Then I have material class which contains hlsl effect technique name and all variables. And when I call method Material::Update() all variables which belong to this material are uploaded. Then finally my mesh class has pointer to material and before rendering Material::Update is called. Maybe it is not the best but it is fairly simple and I hope you can develop smth from this for yourself :) I know I'm not answering your question directly but handling shaders and materials are not so simple and you must consider it well for a greater good :)
  13. "{0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}" <-- your declaration should look this ( because position has 3 floats = 3 x sizeof(float) = 12 )
  14. dys129

    get shaders

    for example nvidia sdk samples : http://developer.download.nvidia.com/SDK/10.5/direct3d/samples.htm There are rather advanced shaders and if you are looking for something easy dx10 doesn't differ much from dx9 so could use some of these: http://developer.download.nvidia.com/shaderlibrary/webpages/hlsl_shaders.html
  15. dys129

    Deferred shadow map.

    code for sampling shadowmap should this look like: float4 PSpot2D = mul(mul(Position.Sample(SamplText,Tex),LightView),ProjMatrix); float2 VTexC = float2(PSpot2D.x/PSpot2D.w * 0.5f + 0.5f,-PSpot2D.y/PSpot2D.w * 0.5f + 0.5f); float Shadow = Shadow1.Sample(SamplText,VTexC).x; // You were not sampling with proper texcoord.
  • 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!