Jump to content

  • Log In with Google      Sign In   
  • Create Account


GUI renderer implementation. Double instancing. 9 Quads.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Drop   Members   -  Reputation: 115

Like
0Likes
Like

Posted 28 May 2012 - 09:43 AM

[D3D11][C++][HLSL]
Hi! I`m new in DirectX 11. Need some help on implementation of GUI renderer.

I`m trying to make efficient GUI renderer that draws instanced canvases. Controls draws on canvases. Each canvas consists of 9 quads (rectangles). Each quad has to be arbitrary size, have arbitrary position, color and texture (if textured).

First attempt: carried away by idea of instancing.
-in vertex shader instance quad nine times, each different size, position color and texture (so canvas came out of it, for ex. window or button ).
-then instance that canvas several times, each different scale and position.

I saw implementation of double instancing of leaves on an instanced trees in "Instancing10" SDK demo and Braynzar`s tutorial (http://www.braynzars...D3D11Instancing). But there was no scaling applyed to leaves. And here`s the problem. Also I tryed to learn sources from MyGUI and CEGUI, but its to complex and hard to understand for me for now.

Questions:
1. Is this possible to translate and scale instanced quads in vertex shader before translating and scaling canvas? How?
2. Is this optimal implementation? Its just an UI over a game itself, so it must be as lightweight as possible (each type of control can be instanced tens or even hundreds of times)
3. Is there better implementation? ( Vertex buffers?)

Feel free to post. I wiil be appreciated for any ideas, books, links and even chunks of code (C++, HLSL or a pseudocode).
Thanks in advance!

Edited by Drop, 28 May 2012 - 09:53 AM.


Sponsor:

#2 NickUdell   Members   -  Reputation: 288

Like
1Likes
Like

Posted 29 May 2012 - 06:41 AM

I think you're over engineering it.

In what situation do you expect a single control to be needed over 100 times on screen at once? You must have a very large monitor.

Sure, you can instance your controls, but frankly just writing to a vertex buffer and -maybe- indexing that should be enough for you.
Sole Creator of Pigment - a procedural, block-base space trading sim.

PhD student working on medical imaging at the University of Southampton.

Enjoyer of games, films, books and cider.

#3 xDarkice   Members   -  Reputation: 112

Like
0Likes
Like

Posted 30 May 2012 - 02:55 PM

You could take a look at my D3D9 implementation in Vocaluxe at Github. Though its in C# and uses D3D9, it should not be that much off from D3D11. It got all functions you were asking for.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS