Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About HyDr0x

  • Rank
  1. HyDr0x

    problem with perlin noise hlsl shader

    I think it could be your texture sampler, you should use bilinear interpolation on your texture, so instead or POINT use LINEAR.
  2. HyDr0x

    XNA 4.0 Scattering operation

    @UltimaX Thank you for the links, I'll read them :-). @MJP Why is it so slow? Because of generating the vertices on the CPU and streaming them to the GPU? Our professor said thats quick. Okay, I've only programmed it as a standalone program in openGL so I can't measure the performance in a whole game environment.
  3. HyDr0x

    XNA 4.0 Scattering operation

    No I'm not talking about something like that. Well, scattering .... uhm, I doen't have any other term to describe this technique I've learned that as a little trick at college. But let me try to explain it. If you want to make a histogram completely on your GPU, you need to read the color of the picture per pixel. Then you must increase your histogram at a specific position, but you can't actually write a value in a shader at a random position. So, what you do is the following: Create for every pixel on the screen a vertex, then read the texture color at the specific position from the picture and move the vertex at the position where the value should be increased. In the pixelshader you just write the specific value. All you have to do is blending all those values together and tada, you have your histogram data. As far as I know that's called scattering. So instead of wirting at a radnom position you can move your vertices at that random positoin. The problem with LineList is that it interpolates between the values, but I can't makes something like flat in openGL. I think Shawn forgot that when he removed this feature, before XNA fully supports DX10 or 11 ... .
  4. HyDr0x

    XNA 4.0 Scattering operation

    @laztrezort yes, that's what I'm talking about, the problem is, that PointList, doesn't exist anymore in XNA 4.0. @MJP Hm, I think you misunderstood me, small quads doen't solve my problem, because I just want to send one vertex per pixel to my GPU. I doen't really draw the vertices, I just take them to transfer some massively data to my GPU or doing some scattering operation.Like writing data in the pixelshader at position x,y.
  5. Hi, I want to send some data to my GPU, but it's too large for the constant registers in shader model 3.0. So I've tried to send it with a scattering method I've learned. First I would create for every pixel on my rendertarget a vertex filled with my data. Then I'd call my shader and process the data, but the problem is that XNA doesn't support something like GL_POINTS in OpenGL. I've got only the PrimitveTypes LinesList, LineStrip, TriangleList and TriangleStrip. Is there any possible solution for my problem? I'm actually trying LineList but it fails at the moment. Oh and by the way, isn't it possible to make some data between Vertex- and Pixelshader non-interpolated? Like in openGL I would do somthing like flat vec3 data, but I don't see something like this in HLSL. (PS/VS 3.0 )
  6. HyDr0x

    Dynamic Instancing

    Ah, okay, that makes sense. I wasn't sure about this. So thank you for bringing me some clarity. Now I'll have to test which is faster, CPU multithreading or GPU palette Skinning :-)
  7. HyDr0x

    Dynamic Instancing

    I'm using XNA with DirectX9, and I think thats the problem because all what I heard is that DirectX9 isn't as good as DirectX10 in sampling textures in the vertex shader. So I think that for example pallete skinning ( I refer to the Skinned Instancing white paper from nvidia) isn't working very good on it.
  8. Hi folks, well, I'd like to know whether dynamic instancing is worth the higher effort or not. I refer to the GPU Gems 2 article about that, if I understand it, they are saying that I must skin the geometry by the CPU before streaming the vertices to the GPU. Is that right? If so, isn't it more complex to do all those transformations? I mean I have something about 300 to 1000 vertices per skinned mesh and im drawing like 1000 or more of them. this results in aproximately 1000 draw calls. If i would pack them all into one single vertexbuffer, would this cause in higher framerates? I've done a small test and drawed 2000 of those small meshes and got 38 FPS with ~900.000 Polygons and my CPU was to 100% busy (task manager). When I looked away (I've done culling) I had 60 FPS and my CPU was only to ~50% busy. So I think it dynamic instancing could reduce this. I also rendered a more complex mesh ~3900 poylgons ~448 times. So I had ~8M polygons with 50 FPS. Those numbers are telling me that i should batch my geometry much more. But on the other hand I've made a simple test transforming some matrices for all those models and the framerate dropped down to 20. Should I use multithreading? Or is my idea of dynamic instancing totaly wrong? Oh and sorry for my english >.<
  9. Hi, im actually working to read out the vertexdata from different models in XNA. Everything seems to work fine except the blendindices are completely wrong. They should be between 0 and 59 as the maximum supportet bones in my models. But actually they are 232 190 and so on. The strange thing is, that when i read only the blendindices it works ... . The vertexdeclaration im using is 100% the same which the vertices in the model are. The offsets, the vertexelementformat and so on, everything is the same. My VertexDeclaration: struct VertexNormalSkinned : IVertexType { public VertexNormalSkinned(Vector3 pos, Vector3 normal, Vector2 texture, Byte4 blendIndices, Vector4 blendWeights, Vector3 tangent, Vector3 binormal) { Position = pos; BlendIndices = blendIndices; BlendWeights = blendWeights; Normal = normal; Binormal = binormal; Tangent = tangent; TexCoords = texture; } public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration ( new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0), new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), new VertexElement(32, VertexElementFormat.Byte4, VertexElementUsage.BlendIndices, 0), new VertexElement(36, VertexElementFormat.Vector4, VertexElementUsage.BlendWeight, 0), new VertexElement(52, VertexElementFormat.Vector3, VertexElementUsage.Tangent, 0), new VertexElement(64, VertexElementFormat.Vector3, VertexElementUsage.Binormal, 0) ); public Vector3 Position; public Byte4 BlendIndices; public Vector4 BlendWeights; public Vector3 Normal; public Vector3 Binormal; public Vector3 Tangent; public Vector2 TexCoords; VertexDeclaration IVertexType.VertexDeclaration { get { return VertexDeclaration; } } }; The Code where im using it: foreach (ModelMesh mesh in mainMesh.Meshes) foreach (ModelMeshPart part in mesh.MeshParts) { Vector4 blendIndices; VertexNormalSkinned[] vertexBuffer = new VertexNormalSkinned[part.VertexBuffer.VertexCount]; part.VertexBuffer.GetData<VertexNormalSkinned>(0, vertexBuffer, 0, part.NumVertices, part.VertexBuffer.VertexDeclaration.VertexStride);// wrong indices Byte4[] V = new Byte4[part.VertexBuffer.VertexCount]; part.VertexBuffer.GetData<Byte4>(32, V, 0, part.NumVertices, part.VertexBuffer.VertexDeclaration.VertexStride); //right indices for (int i = 0; i != vertexBuffer.Length; i++) { Matrix SkinningMatrix = Matrix.Identity; blendIndices = vertexBuffer.BlendIndices.ToVector4(); SkinningMatrix += mSkin[(Byte)blendIndices.X] * vertexBuffer.BlendWeights.X; SkinningMatrix += mSkin[(Byte)blendIndices.Y] * vertexBuffer.BlendWeights.Y; SkinningMatrix += mSkin[(Byte)blendIndices.Z] * vertexBuffer.BlendWeights.Z; SkinningMatrix += mSkin[(Byte)blendIndices.W] * vertexBuffer.BlendWeights.W; } } Edit: Is there any possibility to create or take the existent vertexdeclaration from the model for the new vertexbuffer dynamically? Because its not very handy to look up the declaration in the debugger and rebuild it somewhere in a struct ... Edit: Okay i found the mistake, I dont know why XNA does this, but it was my order in which I declared the variables in the struct. Seems like XNA is copying the values direct into them instead of using the constructor ... but they have to be in the same order like the Declaration. For my example: public Vector3 Position; public Vector3 Normal; public Vector2 TexCoords; public Byte4 BlendIndices; public Vector4 BlendWeights; public Vector3 Binormal; public Vector3 Tangent;
  • 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!