Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

106 Neutral


  • Rank
  1. Hi everyone, I just wonder if it is possible to bind a MSAA-resource to a computeshader (for writing)? UAV's can't do multisampling (so Texture2D or RWTexture2D are not possible) and SRV's can't be written. Does this mean it's actually not possible? Thanks!
  2. Have you tried face-normals in your shading code? Then every face should have one colour. (doesn't look nice, but perhaps it helps you out) Also visualized face normals could be checked better (than the vertex normals). I would say it looks like your interpolation or shading is broken. (but that's only a guess, I don't know your code) Another idea: OBJ face-orientation is counterclockwise and (for example) DirectX standard is clockwise. Does this match in your case? (don't know what you are using, also DirectX can be "convinced" to use counterclockwise orientation)

    Bind multiple rendertargets

    Is there no explanation for this behaviour?

    Bind multiple rendertargets

    I got it work, but I've got some strange effects. Perhaps someone can explain that to me. Rendertarget Array is bound to pipeline and is working. I tried different Pixelshaders (SV_RenderTargetArrayIndex "rta_index" is set by Geometryshader) and the size of the Rendertarget Array can be set during runtime. 1) Is working with every size of RT Array: [source lang="cpp"] struct PS_Out{ float4 Color : SV_TARGET; }; PS_Out PShader(GS_Out input){ PS_Out output; output.Color = input.vColor; return output; } [/source] 2) Is also working with every size of RTA, ALSO WITH rta_index BIGGER THAN 3!!! [source lang="cpp"] struct PS_Out{ float4 Color0 : SV_TARGET0; float4 Color1 : SV_TARGET1; float4 Color2 : SV_TARGET2; float4 Color3 : SV_TARGET3; float4 Color4 : SV_TARGET4; float4 Color5 : SV_TARGET5; float4 Color6 : SV_TARGET6; float4 Color7 : SV_TARGET7; }; PS_Out PShader(GS_Out input){ PS_Out output; if(input.rta_index == 0){ output.Color0 = input.vColor; } else if(input.rta_index == 1){ output.Color1 = input.vColor; } else if(input.rta_index == 2){ output.Color2 = input.vColor; } else if(input.rta_index == 3){ output.Color3 = input.vColor; } //no else! return output; } [/source] 3) The one I think should work, but isn't! Only RTA 0 is filled correctly, rest: mesh is black, background is blue (clear color is blue!): [source lang="cpp"] struct PS_Out{ float4 Color0 : SV_TARGET0; float4 Color1 : SV_TARGET1; float4 Color2 : SV_TARGET2; float4 Color3 : SV_TARGET3; float4 Color4 : SV_TARGET4; float4 Color5 : SV_TARGET5; float4 Color6 : SV_TARGET6; float4 Color7 : SV_TARGET7; }; PS_Out PShader(GS_Out input){ PS_Out output; if(input.rta_index == 0){ output.Color0 = input.vColor; } else if(input.rta_index == 1){ output.Color1 = input.vColor; } else if(input.rta_index == 2){ output.Color2 = input.vColor; } else if(input.rta_index == 3){ output.Color3 = input.vColor; } else if(input.rta_index == 4){ output.Color4 = input.vColor; } else if(input.rta_index == 5){ output.Color5 = input.vColor; } else if(input.rta_index == 6){ output.Color6 = input.vColor; } else if(input.rta_index == 7){ output.Color7 = input.vColor; } //no else! (but there can only be 8 rendertargets be bound => 7 should be maximum) return output; } [/source] I do not understand why 2) should work and 3) isn't. And I also don't understand how 1) knows which SV_Target to fill. Can someone explain that to me? Thanks very much!
  5. Of course I would not mind Here it is...(wireframe looks the same)

    Bind multiple rendertargets

    Yes, I want to output multiple copies of the same geometry in the geometry shader. RTA sounds like what I already did. (one Render Target View, representing an array of buffers) I'll have a look at that demo, thank you very much for the hints and explanation.

    DirectX vs OpenGL ?

    I've got some questions: Is it possible in DirectX 11 to set up a program without setting the hole graphic pipeline (e.g. Vertex-, Hull-, Domain-, Pixelshader)? I didn't find a way to get a triangle on screen without it. (might be an objective point in the "first contact is easier" discussion) Furthermore: many posts here say that GLSL has a lot of "potential silent failures". How do the existing programs (prof. OpenGL programs as well as OpenGL-games) handle this? I never had problems in running such programs on my computer. Or is this fact just due to some drivers accepting more than the standard and others seem to have bugs if they stick to the standard. (whatever the standard is...) Thanks ;)

    DirectX vs OpenGL ?

    There are no "open source extensions". OpenGL has absolutely nothing to do with open source. [/quote] I thought of SDL, GLFW and so on. Is "many open source libs" better understandable?

    DirectX vs OpenGL ?

    Perhaps a pro/contra-comparison would help the thread-starter a bit more in his decision. And I'm also interested in a comparison What about completing a list: DirectX: + has multiple "modules" for everything you need (3D, sound, input...) + "Managed DirectX" (works with .NET) => many programming languages + can load meshes and textures + good tools (PIX, debug runtime, visual assist...) + some professional programs (Autodesk Inventor) + frequently used (mostly: games) => good support + msdn documentation - more difficult to understand - only works with Windows (~> wine on linux) OpenGL: + easy to get first results (but also difficult with complex ones) + runs on different platforms + frequently used with professional programs (CAD...), sometimes also in games + many open source libs (SDL, GLFW...) - suffers from bad drivers (mostly with Windows, low cost graphic cards) - GLSL: different errors (or no errors) on different machines - "extension chaos" - new standard takes long time Any amendments, completions or mistakes I made? (note: I omit the performance issue, cause there seem to be many conflicting analysis/benchmarks) [EDITS: * changed "open source" to "many open source libs" * changed "easier" in "easy to get first results" * removed closed source from DX * added "good tools" in DX * added "some prof progs" in DX * added GLSL problem ]
  10. DEADC0DE

    Bind multiple rendertargets

    Thanks for the detailed answer. Now I understand what smasherprog meant by "include more code". I'm trying to implement some kind of anti aliasing. To improve this I want to jitter coordinates of the mesh in my geometry-shader. So I'm rendering the same mesh with different (jittered) positions. Finally it's evaluated in a postprocess. Sounds like the MRT is the right way to do this (?), because I have the same stages (except the GS) and same rasterizer. I already implemented the shaders (GS sets SV_RenderTargetArrayIndex, Pixelshader reads it and writes SV_Target). When I got it right, I have to create more rendertargets ("RenderTargetView[8]" = possibility 2). Is there a function for "RenderTargetBuffer->get(i)"? (didn't find any in the msdn documentation) At the moment my code looks like this: [source lang="cpp"] ID3D11Texture2D* _pRenderTargetBuffer; ID3D11RenderTargetView* _pRenderTargetView; //should be RenderTargetView[8]? //... D3D11_TEXTURE2D_DESC td_target; ZeroMemory(&td_target, sizeof(D3D11_TEXTURE2D_DESC)); td_target.Width = _width; td_target.Height = _height; td_target.MipLevels = 1; //no mipmap td_target.ArraySize = _number_rendertargets; td_target.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; td_target.Usage = D3D11_USAGE_DEFAULT; td_target.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; td_target.CPUAccessFlags = 0; //no cpu access td_target.MiscFlags = 0; td_target.SampleDesc.Count = 1; td_target.SampleDesc.Quality = 0; pd3dDevice->CreateTexture2D(&td_target, NULL, &_pRenderTargetBuffer); D3D11_RENDER_TARGET_VIEW_DESC rd_rendertargetview; ZeroMemory(&rd_rendertargetview, sizeof(D3D11_RENDER_TARGET_VIEW_DESC)); rd_rendertargetview.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; rd_rendertargetview.Format = td_target.Format; rd_rendertargetview.Texture2DArray.ArraySize = _number_rendertargets; rd_rendertargetview.Texture2DArray.FirstArraySlice = 0; rd_rendertargetview.Texture2DArray.MipSlice = 0; //how do I get the right buffer out of the _pRenderTargetBuffer array if I have RenderTargetView[8] here? pd3dDevice->CreateRenderTargetView(_pRenderTargetBuffer, &rd_rendertargetview, &_pRenderTargetView); [/source] Do you also need the render code or the shader code? Thanks again :-)
  11. DEADC0DE

    Bind multiple rendertargets

    Hm, ok let's see... I want to bind an array of Textures to my graphic pipeline (multiple rendertargets). Therefore I created a Textrue2D with "ArraySize" 8. To bind it to the pipeline, one or more rendertargetview(s) are needed. My question: Is one rendertargetview enough (as it is with Texture2D where I just create one logical structure with only an additional parameter) or do I have to build up an array of rendertargetviews manually? [source lang="cpp"] ID3D11Texture2D* RenderTargetBuffer; //no RenderTargetBuffer[8]... ID3D11RenderTargetView* RenderTargetView; //...here too: just ONE structure //create Texture2D with parameter "ArraySize" 8 D3D11_RENDER_TARGET_VIEW_DESC rendertargetview_desc; rendertargetview_desc.Texture2DArray.ArraySize = 8; //fill rest of desc pd3dDevice->CreateRenderTargetView(RenderTargetBuffer, rendertargetview_desc, RenderTargetView); [/source] ----- OR ----- [source lang="cpp"] ID3D11Texture2D* RenderTargetBuffer; //no RenderTargetBuffer[8]... ID3D11RenderTargetView* RenderTargetView[8]; //...but here: create 8 manually! //create Texture2D with parameter "ArraySize" 8 //rendertargetview_desc: no parameter "ArraySize" set //fill rest of desc for(int i = 0; i < 8; ++i){ pd3dDevice->CreateRenderTargetView(RenderTargetBuffer->get(i), rendertargetview_desc, RenderTargetView); } [/source] I didn't find any "RenderTargetBuffer->get(i)" function at the documentation (so I think possibility 1 seems right). But I found that link from above, saying you have to build up the array manually (=> possibility 2 seems right, but no get-function) [source lang="cpp"] //source code from link (copy&paste) ID3D10RenderTargetView* pRTViews[8] = {NULL, NULL, NULL, ... } //array manually! CreateRenderTargetView(rtTex1, &pRTViews[0]) CreateRenderTargetView(rtTex2, &pRTViews[1]) [/source] I can't find any documentation to this and only get a black screen with possibility 1 when using rendertarget1-7 (but rendertarget0 is working!)... :-/ So, how do I implement multiple rendertargets with the Texture2D and ArraySize shown above? (or is it not possible and I have to do something completely different?) Thank you
  12. Hi, I'm trying to bind multiple rendertargets. RT0 is working without any problems but if I switch to RT1 or higher, I got a crash in "pd3dImmediateContext->OMSetRenderTargets(numberRenderTargets, &_pRenderTargetView, _pDepthStencilView);". I think it's my init-code (because 0 is working and if I swap RT0 and RT1 it's also working) I read this post http://www.gamedev.net/topic/518035-dx10-deferred-rendering-and-render-to-multiple-render-targets/ and would like to know what to do when having a Texture2DArray. Something like that: [source lang="cpp"] D3D11_TEXTURE2D_DESC td_target; td_target.ArraySize = number_rendertargets; //bla bla pd3dDevice->CreateTexture2D(&td_target, NULL, &_pRenderTargetBuffer); D3D11_RENDER_TARGET_VIEW_DESC rd_rendertargetview; //Zero... rd_rendertargetview.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; rd_rendertargetview.Texture2DArray.ArraySize = number_rendertargets; //etc. pd3dDevice->CreateRenderTargetView(_pRenderTargetBuffer, &rd_rendertargetview, &_pRenderTargetView); //with: ID3D11RenderTargetView* _pRenderTargetView; [/source] Does _pRenderTargetView have to be an "ID3D11RenderTargetView* _pRenderTargetView[number_rendertargets];"? (with more calls to CreateRenderTargetView) Thanks!
  13. In case someone has the same problem. Here's the solution: [source lang="cpp"] D3D11_VIEWPORT old; UINT viewport_nr = 1; pd3dImmediateContext->RSGetViewports(&viewport_nr, &old); D3D11_VIEWPORT vp; ZeroMemory(&vp, sizeof(D3D11_VIEWPORT)); vp.Height = static_cast<FLOAT>(Height); vp.Width = static_cast<FLOAT>(Width); vp.TopLeftX = 0; vp.TopLeftY = 0; vp.MinDepth = 0; //attention: DO set this value (standard is 0) vp.MaxDepth = 1; //attention: DO set this value (standard is 1) pd3dImmediateContext->RSSetViewports(1, &vp); //render (set up shaders..., DrawIndexed, reset shaders...) //reset viewport (in my case because of supersampling => so that hud stays the same) pd3dImmediateContext->RSSetViewports(viewport_nr, &old); [/source]
  14. Wohoo! I got it! It's the viewport! If I comment the viewport out, everything is shown right (in both pipelines!). At least it seems to be right. (except that the mesh is too small and in the upper-left corner, because of "old" viewport) Thanks very much Jason Z ;)
  15. [EDIT: sorry, that was a wrong idea... deleted]
  • 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!