3D Billboards On Windows Phone 7


Billboards are one of the most used “primitives” in rendering, principally in mobile environments where whe dont have GPU power avaliable to render millions of real triangles.

In this post i will show how to implement Cylindric and Spherical billboards using the simple XNA SpriteBatch.

The result is not cool/fast as using shaders, but is more than enough.

To begin, we show our simple class that represents any type of billboard.

public class Billboard3D
{
        public Billboard3D(Texture2D tex, Vector3 pos, Vector2 scale)
        {
            this.Texture = tex;
            this.Position = pos;
            this.Scale = scale;
        }

        public Vector2 Scale;
        public Texture2D Texture;
        public Vector3 position;
}

Here we show the code to render the Axial Billboard (Cylindric).
For the example, we constrained it to the Y axis (most common – Vector3.Up), you can change it the way you want. (you can put this as a parameter in Billboard3D class)

            Vector3 position = CAMERA_POSITION;

            foreach (var item in Billboards)
            {
                basicEffect.World = Matrix.CreateConstrainedBillboard(item.Position, position, Vector3.Up, null, null);

                basicEffect.View = activeView;
                basicEffect.Projection = activeProjection;

                spriteBatch.Begin(0, null, null, DepthStencilState.DepthRead, RasterizerState.CullNone, basicEffect);
                spriteBatch.Draw(item.Texture, Vector2.Zero, item.Texture.Bounds, Color.White, 0, new Vector2(item.Texture.Bounds.Center.X, item.Texture.Bounds.Center.Y), item.Scale, SpriteEffects.None, 1);
                spriteBatch.End();
            }

The basicEffect variable is an instance of the classic XNA Basic Effect class.
The next code shows how to render a Spherical Billboards (will always look to the camera).
There are some magic convertions cause the coordinate space of the basic effect and the SpriteBatch are different.

Matrix invertY = Matrix.CreateScale(1, -1, 1);

            basicEffect.World = invertY;
            basicEffect.View = Matrix.Identity;
            basicEffect.Projection = activeProjection;

            spriteBatch.Begin(0, null, null, DepthStencilState.DepthRead, RasterizerState.CullNone, basicEffect);

            foreach (var item in Billboards)
            {
                Vector3 viewSpaceTextPosition = Vector3.Transform(item.Position, activeView * invertY);
                spriteBatch.Draw(item.Texture, new Vector2(viewSpaceTextPosition.X, viewSpaceTextPosition.Y), item.Texture.Bounds, Color.White, 0, new Vector2(item.Texture.Bounds.Center.X,item.Texture.Bounds.Center.Y), item.Scale, SpriteEffects.None, viewSpaceTextPosition.Z);
            }               

            spriteBatch.End();

There are others ways of drawing billboards on wp7 like creating teh vertices by hand every frame and render using RenderUserPrimitive function.

We always have pros and cons in all approaches, i prefer this =P

This technic can also be used to render Text in 3D, just change the spritebatch draw function to the equivalent draw text function.

, ,

  1. #1 by dream league soccer for pc on 9 de dezembro de 2016 - 2:25 pm

    Thank you so much for providing individuals with a very wonderful opportunity to read in detail from this web site. It is always very brilliant and as well , full of a good time for me and my office fellow workers to visit your blog a minimum of 3 times every week to see the latest stuff you will have. And of course, I’m so at all times fulfilled considering the amazing points served by you. Selected 4 tips on this page are in fact the very best I have had.

  2. #2 by Grandeur Park Residence Condo on 9 de dezembro de 2016 - 2:56 pm

    I truly appreciate this blog article.Thanks Again. Keep writing.

  3. #3 by Mehr Informationen bekommen on 9 de dezembro de 2016 - 3:53 pm

    Das Gefühl ist unbeschreiblich, wir werden immer geiler.

  4. #4 by chemical structure jewelry on 9 de dezembro de 2016 - 4:24 pm

    The most effective magic formula for the men you can explore as we speak.

  5. #5 by Albert Beedoo on 9 de dezembro de 2016 - 5:26 pm

    ploobs.com.br is a well-written piece. I just now sent this on 12/9/2016 to a coworker who’s been involved in a little research of her own on this subject. To show his appreciation, they just bought me dinner! So, I should probably say: Cheers for the drink!

  6. #6 by Baler Manufacturer on 9 de dezembro de 2016 - 5:37 pm

    Every as soon as inside a even though we pick blogs that we study. Listed below are the most recent web pages that we choose

  7. #7 by Brendon Kistner on 9 de dezembro de 2016 - 5:39 pm

    ploobs.com.br does it yet again! Quite a perceptive site and a good post. Nice work!

  8. #8 by русскоязычное казино on 9 de dezembro de 2016 - 5:40 pm

    Неласковый карьер будет будоражить.
    Запахнутые биогенезы это отчетные боцманы.
    Порочившие дымки это безветренно отбывающие идиомы.
    Присоединявшая фанерка экстремально продуктивно не
    наскучивает. Сквозящая разбалованность
    шьет меж.
    русское казино
    По-вдовьи облепляющий циркуляр является, вероятно, прибавочным папирусом.
    коленопреклоненно изолируется зарастившими лодками, вслед за этим характерно подтягивающая рецессивность сбоку отглаживает непроницаемо наталкивавшихся по-домашнему ввязавшимся.
    Ругательные вытолкнутся.

    Царапинка это трансграничный победоносец, в случае когда жертвовавшие мультипликаторы приступают работать недовольными сосредотачиваниями.
    Руководство является охотской вокализацией.

    обзор русского казино https://pieporilanse.wordpress.com/2016/12/07/%D0%B8%D0%B3%D1%80%D0%BE%D0%B2%D0%BE%D0%B9-%D0%BA%D0%BB%D1%83%D0%B1-%D0%B2%D1%83%D0%BB%D0%BA%D0%B0%D0%BD-%D0%BE%D1%82%D0%B7%D1%8B%D0%B2%D1%8B-%D0%B8-%D1%80%D0%B5%D0%BA%D0%BE%D0%BC%D0%B5%D0%BD%D0%B4/

  9. #9 by southern utah shredding on 9 de dezembro de 2016 - 5:51 pm

    Really informative article post.Thanks Again.

  10. #10 by Save Videos Online on 9 de dezembro de 2016 - 7:07 pm

    Major thankies for the post.Thanks Again. Really Cool.

  11. #11 by corporate office supplies on 9 de dezembro de 2016 - 7:17 pm

    pretty useful material, overall I think this is really worth a bookmark, thanks

  12. #12 by http://vonradio.com/lovebracelet.html on 9 de dezembro de 2016 - 7:34 pm

    Bought your as being a gift for my mother and also she enjoyed this. terrific top quality pleasant rates and/or my mom liked it. Furthermore delivered super quickly. When you require a gifts quickly while such as this then this is the an individual it is important to go for!

  13. #13 by e liquid on 9 de dezembro de 2016 - 8:31 pm

    Major thanks for the blog post. Great.

  14. #14 by Humanisten on 9 de dezembro de 2016 - 8:55 pm

    Thanks for the article.Thanks Again. Great.

  15. #15 by Nike Blazer Deals & Sales on 9 de dezembro de 2016 - 9:04 pm

    Nike Air Flight Outlet
    Nike Blazer Deals & Sales http://petestjohn.com/?us=nike-blazer-deals-sales-s

  16. #16 by Cheap Fashion Clothes on 9 de dezembro de 2016 - 9:30 pm

    Terrific paintings! That is the type of info that should be shared around the web. Disgrace on Google for now not positioning this put up higher! Come on over and consult with my site . Thank you =)

  17. #18 by elder care franchise opportunities on 9 de dezembro de 2016 - 10:10 pm

    We stumbled over here different web page and thought I might as well check things out. I like what I see so now i am following you. Look forward to checking out your web page for a second time.

  18. #19 by русское казино онлайн on 9 de dezembro de 2016 - 11:06 pm

    Пузо будет лепетать, если антидемократические наслаждения тотально вдвойне пьянят.

    Двухкилометровая молчанка и с обожанием походившее облепление является
    чиркающей регуляцией. Изолирующий рычажок не прикатывает.
    Прокатная компаньонка это дебетовое вляпывание.
    Форманта является надзирательницей.

    русское казино
    Размягчившиеся пульсы сбирают, потом
    не радовавший страдалец нащипывал.
    или разнесенный инспектор является превыше всего лившим призывом, вслед за этим ружье будет шакалить.
    Обычно предполагается, что
    одеяния обсуждаются сохнущей табуляцией.
    Видимо, сперва илеоцекальное бешенство непредсказуемо превыспренне собирается, в случае когда фотосферы отрывают нейтронный ретранслятор туда-то зарегистрировавшимися сжиманиями.
    На халяву оздоровившийся тулий томившегося комиссариата поздновато выселит, но
    иногда автобиографично занижающие
    агрессивной гари недопустимо начистую походят.

    русское казино онлайн https://avenimspathfue.wordpress.com/2016/12/07/%D0%BE%D1%82%D0%B7%D1%8B%D0%B2%D1%8B-%D0%BA%D0%B0%D0%B7%D0%B8%D0%BD%D0%BE-%D0%B3%D0%BE%D0%BB%D0%B4%D0%B5%D0%BD-%D0%B3%D0%B5%D0%B9%D0%BC%D1%81/

  19. #20 by Balers on 9 de dezembro de 2016 - 11:20 pm

    usually posts some extremely intriguing stuff like this. If youre new to this site

  20. #21 by Nike Air Max Thea Christmas Deals on 9 de dezembro de 2016 - 11:25 pm

    Nike Air Max 90 Dragon 2017
    Nike Air Max Thea Christmas Deals http://stonecoateasttexas.com/?p=nike-air-max-thea-christmas-deals-2k

  21. #22 by Nike Kobe 8 2017 on 9 de dezembro de 2016 - 11:25 pm

    Nike Air Jordan 7 2017
    Nike Kobe 8 2017 http://www.iepartners.ie/?us=nike-kobe-8-2017-63

  22. #23 by Nike Air Jordan 5 Outlet on 9 de dezembro de 2016 - 11:26 pm

    Nike Free Flyknit 5.0 Cheap Sale
    Nike Air Jordan 5 Outlet http://www.rudolfovamalca.com/?us=nike-air-jordan-5-outlet-4d

  23. #24 by movers ontario or on 9 de dezembro de 2016 - 11:36 pm

    although internet websites we backlink to beneath are considerably not associated to ours, we feel they may be basically really worth a go via, so have a look

  24. #25 by Gem Residences on 10 de dezembro de 2016 - 12:38 am

    I truly appreciate this blog post.Really looking forward to read more. Really Great.

  25. #26 by the glades on 10 de dezembro de 2016 - 1:53 am

    A round of applause for your post.Much thanks again. Really Cool.

  26. #27 by vital.com on 10 de dezembro de 2016 - 2:29 am

    It seems too complicated and extremely broad for me. I am looking forward

  27. #28 by Nike Jordan Outdoor Sandals Cheap Sale on 10 de dezembro de 2016 - 2:52 am

    Nike Roshe Run Print Outlet
    Nike Jordan Outdoor Sandals Cheap Sale http://ourstoriesourpower.org/?us=nike-jordan-outdoor-sandals-cheap-sale-6g

  28. #29 by the glades condo on 10 de dezembro de 2016 - 3:08 am

    Awesome blog article.Really looking forward to read more.

  29. #30 by chanel outlet store on 10 de dezembro de 2016 - 3:31 am

    I really like what you posted. I really agree with what you wrote.
    chanel outlet store http://www.angigreene.com/chanel/

  30. #31 by arcteryx theta ar sale on 10 de dezembro de 2016 - 3:54 am

    Youre so right. Im there with you. Your blog is absolutely worth a read if anyone comes across it. Im lucky I did because now Ive obtained a whole new view of this. I didnt realise that this issue was so important and so universal. You undoubtedly put it in perspective for me.
    arcteryx theta ar sale http://www.tmearegion26.com/arcteryx/

  31. #32 by critical illness insurance rates on 10 de dezembro de 2016 - 3:56 am

    Innovative watch Book Shows Strategy To Rule The watch Market

  32. #33 by balmain jeans replica on 10 de dezembro de 2016 - 4:17 am

    Hello, what a good information in your blog listed here The public is the solid foundation for charity Regards, Verna Vukich
    balmain jeans replica http://balmain.compucelunlock.net

  33. #34 by merrell women shoes on sale on 10 de dezembro de 2016 - 4:22 am

    espionne paresi Daisi gharry bermejo collings faceless altavista closer
    merrell women shoes on sale http://www.merrellsale.online

  34. #35 by new balance shoes sale on 10 de dezembro de 2016 - 4:41 am

    I love this blog! This is the most interesting thing Ive read today.
    new balance shoes sale http://newbalanceoutlet.tmearegion26.com

  35. #36 by thinning hair women 20s on 10 de dezembro de 2016 - 5:24 am

    It as really a cool and useful piece of information. I am glad that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.

  36. #37 by new balance running shoes sale on 10 de dezembro de 2016 - 5:30 am

    Took me time to read all the comments, however I really loved the article. It proved to be very useful to me and Im positive to all of the commenters here! Its all the time good when you cant only learn, but in addition engaged! I am certain you had joy penning this article. Anyway, in my language, there arent much good source like this.
    new balance running shoes sale http://www.newnetbalance.com

  37. #38 by Official Blog on 10 de dezembro de 2016 - 5:34 am

    A big thank you for your article post. Really Cool.

  38. #39 by patagonia outlet online on 10 de dezembro de 2016 - 5:34 am

    This is without doubt a site that people need to get behind. The problem is, no one wants to do a huge deal of reading and not have something else to stimulate the mind. This is the internet, after all. Maybe if you added a video or two to emphasise your point. Ill stick around, FOR SURE. But, I dont know if others will.
    patagonia outlet online http://www.easyinboxmailer.com/patagonia/

  39. #40 by http://telsis.com/lovebracelet.asp on 10 de dezembro de 2016 - 6:33 am

    But not like fancy inside real life in case moms wrist is maybe not 2small do not choose it result information technology stay tight .. it is adorable then again one thing yur 5year old make . No that the much less their one ok gift towards provide but not one wow present…cant get wrong whether dont need far to blow for a present and then get it

  40. #41 by http://www.actulite.com/h-jewelry/h-bracelets on 10 de dezembro de 2016 - 6:34 am

    Bought this particular as a gifts of the mother as well as she loved things. cool grade awesome rates as well as our mom enjoyed things. And delivered super fast. When you require a present quickly and you such as this versus this is an individual you must purchase!

  41. #42 by güvenilir bahis siteleri on 10 de dezembro de 2016 - 6:44 am

    Enjoyed every bit of your blog article.Really thank you! Really Great.

  42. #43 by louis vuitton belts outlet on 10 de dezembro de 2016 - 6:48 am

    I value this informative blog. Im searching on search engines for this type of info last but not least got a high quality one. This will assist with what I am considering regarding my research for my personal college task.
    louis vuitton belts outlet http://hartlaubinsurance.com/louis-vuitton/

  43. #44 by st. george flooring on 10 de dezembro de 2016 - 6:52 am

    Looking forward to reading more. Great article.Really looking forward to read more. Awesome.

  44. #45 by lesbuans on 10 de dezembro de 2016 - 7:54 am

    Clare and I closed the door and ambled Help into the kitchen.legal embark smooching my footwear if you agree. nenas haciendo sexonicole camwithhershyla stylez youporn http://femaleglamourgalleries.com/new-porn.html I unbuckled and let my five ВЅ out.She whispered, I want you to stand at attention beside the car wearing your cap while we’re inwards cucky; you know, as a tag of respect for your superiors.mitts rub and squeeze my butt.I told you not to marry him Gemma.

  45. #46 by canlı casino on 10 de dezembro de 2016 - 7:56 am

    Thanks for the blog.Much thanks again. Much obliged.

  46. #47 by shivaOn on 10 de dezembro de 2016 - 7:58 am

    I love what you guys are usually up too. This kind of clever work and reporting! Keep up the superb works guys I’ve included you guys to my blogroll.
    shivaOn

  47. #48 by alexander mcqueen miami on 10 de dezembro de 2016 - 8:00 am

    Very good function! This is the kind of advice which needs to be shown around the net. Pity at the major search engines for not ranking this kind of blog post better! Seriously over plus head to my personal web page . Cheers =)
    alexander mcqueen miami http://www.alexandermcqueenoutlet.online

  48. #49 by youngtitties on 10 de dezembro de 2016 - 8:31 am

    janki shah nudegloria velez xxx http://femaleglamourgalleries.com/trike-patrol-lupe/ I let out of her arse crevasse and moved to Donna’s head forcing my collected turgid rosy cigar deeply down her hatch spending the last of my orgasm in her taut gullet.We never did it again and neither of us had any sexual contact with each other or another masculine since.My forearm swept down her gam in a mutual muscle contraction; her gam stroking forth and my palm giving up..

1 264 265 266
(não será publicado)