Jump to content
  • Advertisement

Blasp

Member
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

149 Neutral

About Blasp

  • Rank
    Member
  1.   They are varying sizes so texture arrays will probably not work. Its mostly planet textures, and some of those are huge. They dont fit into memory all at once so I have to load/unload them on demand, preferably without the game freezing for multiple seconds while doing so, or worse, crashing. That shader actually runs quite well if not for that artifact..
  2. My beautiful texture sampling shader was indeed the cause of the artifact, getting rid of it solves the shimmering. But now I have to redo the whole texturing code.. :(  
  3.   I am aware of texture arrays, but not familiar with them.  Do you think it could be the cause? I will try to sample the texture directly to see if it helps..
  4. OK, there has been some progress. What we are seeing is two different textures fighting over each other. The correct texture and the one in pixel shader slot/register lower by one. Still cant figure out where the bug is, tough. Here is my texture loading code:   and my texture sampling HLSL:  
  5. I have updated the code above to remove unused code. No change. It is not shadow acne because I have no shadow mapping in the engine, and the problem persists even when I simply output diffuse, bypassing almost all of the pixel shader. Diffuse only screenshot:  
  6. My 3D game looks fine on AMD gpus (radeon HD 5800, 6300m)  and on integrated gpus (intel), but looks grainy on nvidia gpus (tested on 635m, 930m). Changing the shader, blending, depth buffer settings, fullscreen, doesnt seem to help. Anyone knows why this happens?           Here is my D3D initialization code, it could be relevant:  
  7. I am working on a DX11 2D engine. What is the fastest way to draw lots of Quads? Currently I set an immutable vertex buffer with quad geometry during initialization, and then I draw the quads using instancing. However, there are multiple ways to do this: - trianglelist (6 vertices in immutable vertex buffer) or trianglestrip (4 vertices in immutable vertex buffer) - using indices or not using indices What to choose? It seems to me that trianglestrips and indices have more to do with memory / bandwidth optimization for large or dynamic models. So couldnt they actually hurt raw rendering performance of simple quad instances?
  8. The way my engine works is that first I bind all the textures needed to render a frame at once (PSSetShaderResources()), then I specify which texture slot to sample per-instance by variables in an instance buffer. It works great, the problem is that it is coded in such an ugly way, just look at this HLSL:   Texture2D Texture0 : register(ps, t0); Texture2D Texture1 : register(ps, t1); Texture2D Texture2 : register(ps, t2); Texture2D Texture3 : register(ps, t3); Texture2D Texture4 : register(ps, t4); Texture2D Texture5 : register(ps, t5); Texture2D Texture6 : register(ps, t6); Texture2D Texture7 : register(ps, t7);   float4 texture_sample(float id, float2 texcoord) { [call] switch (id) { case 0: { return Texture0.Sample(ObjSamplerState, texcoord); } break; case 1: { return Texture1.Sample(ObjSamplerState, texcoord); } break; case 2: { return Texture2.Sample(ObjSamplerState, texcoord); } break; case 3: { return Texture3.Sample(ObjSamplerState, texcoord); } break; case 4: { return Texture4.Sample(ObjSamplerState, texcoord); } break; case 5: { return Texture5.Sample(ObjSamplerState, texcoord); } break; case 6: { return Texture6.Sample(ObjSamplerState, texcoord); } break; case 7: { return Texture7.Sample(ObjSamplerState, texcoord); } break; default: { return Texture0.Sample(ObjSamplerState, texcoord); } break; } }   Is there any way to directly sample a texture in a slot, by number? Something like this: id.Sample(ObjSamplerState, texcoord); with id being the number of the texture slot as registered. Id rather not use texture arrays because all those textures can have different and even changing dimensions, so it would be more complicated.
  9.   This solved the problem! :)   Thank you all for help!
  10. Attached is a screenshot of five quads rendered separately. They were rendered in this order from the camera: 1st, 2nd, 5th, 4th, 3rd. As you can see, they blend correctly if sorted from furthest to nearest, but not in the opposite case.   However I shouldnt have to sort particles for a simple additive blending..
  11. Here is the blend mode I am using for particles: D3D11_BLEND_DESC blendDesc; ZeroMemory(&blendDesc, sizeof(blendDesc)); blendDesc.AlphaToCoverageEnable = true; D3D11_RENDER_TARGET_BLEND_DESC rtbd; ZeroMemory(&rtbd, sizeof(rtbd)); rtbd.BlendEnable = true; rtbd.SrcBlend = D3D11_BLEND_BLEND_FACTOR; rtbd.DestBlend = D3D11_BLEND_ONE; rtbd.BlendOp = D3D11_BLEND_OP_ADD; rtbd.SrcBlendAlpha = D3D11_BLEND_BLEND_FACTOR; rtbd.DestBlendAlpha = D3D11_BLEND_ONE; rtbd.BlendOpAlpha = D3D11_BLEND_OP_ADD; rtbd.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; blendDesc.RenderTarget[0] = rtbd; d3d11Device->CreateBlendState(&blendDesc, &Blend_Add); I forgot to tell that the particles are constructed on the CPU as one big model and rendered with a single draw call. Indeed, they blend correctly with everything but each other, It looks as if only the nearest particles are visible and obscures the others.
  12. I am making a particle system. My particles are rendered as quads with additive blending only, so no sorting necessary. However they have squarish artifacts around them (see the screenshot), which if I am not mistaken is a result of depth writing not getting disabled. How to disable it correctly?   Here is what I do: ID3D11DepthStencilState* pDepthdisabledStencilState; ID3D11DepthStencilState* pDepthenabledStencilState; // initialization D3D11_DEPTH_STENCIL_DESC depth_write_disabled_desc; depth_write_disabled_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; hr = d3d11Device->CreateDepthStencilState(&depth_write_disabled_desc, &pDepthdisabledStencilState); D3D11_DEPTH_STENCIL_DESC depth_write_enabled_desc; depth_write_enabled_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; hr = d3d11Device->CreateDepthStencilState(&depth_write_enabled_desc, &pDepthenabledStencilState); // rendering d3d11DevCon->OMSetBlendState(Blend_Add, blendFactor_full, 0xffffffff); d3d11DevCon->OMSetDepthStencilState(pDepthdisabledStencilState, NULL); for (Drawable* drawable_ptr : Drawable_ptr_Vector) { if (drawable_ptr->attributes.x == 8.0) // Quads, Particles { drawable_ptr->Draw(); } } d3d11DevCon->OMSetDepthStencilState(pDepthenabledStencilState, NULL); What am I doing wrong?
  • 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!