XNA Creators Club Online
Page 1 of 1 (13 items)
Sort Posts: Previous Next

Creating Billboards On Heightmap

Last post 9/1/2008 2:56 AM by Lord Ikon. 12 replies.
  • 8/18/2008 1:48 PM

    Creating Billboards On Heightmap

    Hi everyone,

    I am referring to the Billboard Sample. It was done using a landscape model. But for my project I am using a heightmap which is quite different from the sample. How should I do a simple billboarding on a heightmap instead ? 

    Thank you.

     

  • 8/18/2008 2:17 PM In reply to

    Re: Creating Billboards On Heightmap

    You can use
    Matrix.CreateBillboard
    for the world matrix of your objects on the terrain, this way they will always be aligned to face the camera.
  • 8/19/2008 3:09 AM In reply to

    Re: Creating Billboards On Heightmap

    Hi Melvil,

    Thanks for replying. I checkout this function : Matrix.CreateBillboard (Vector3, Vector3, Vector3, Nullable<Vector3>, Matrix)

    1) How do I implement this method so that I can create more than one billboards at a time in random positions ? Just like the purpose of the Billboard Sample.

    2) Are the billboards drawn using spritebatch.draw ?

    Thank you.


  • 8/19/2008 3:06 PM In reply to

    Re: Creating Billboards On Heightmap

    It would be pretty easy to combine the VegetationProcessor from the Billboard Sample and the TerrainProcessor from the Generated Geometry Sample to do this.

    The TerrainProcessor takes in a TextureContent, and uses MeshBuilder to create a MeshContent. It then uses ContentProcessorContext.Convert to ask the content pipeline to use the base ModelProcessor to convert the finished MeshContent to a ModelContent. If you pass "VegetationProcessor" in to the Convert function instead of "ModelProcessor", you will apply the vegetation billboards to the terrain model.

     

    Eli Tayrien - XNA Framework Developer
  • 8/20/2008 3:29 AM In reply to

    Re: Creating Billboards On Heightmap

    Hi Eli Tayrien

    Thanks for replying.

    1) Do you have a working example of the combined you mentioned above ?

    2) I scan through the BillboardSample, I don't see the .tga files being included in the solution window. Isn't it the same as normal process ? How do they import the picture files for use in the code then ?

    Thank you.
  • 8/21/2008 7:14 PM In reply to

    Re: Creating Billboards On Heightmap

    1) Sorry, I don't. I know my explanation was a bit confusing, but once you understand what I'm suggesting, the code is actually very simple. Only a few lines. Feel free to ask any questions and I'll help out if I can.

    2) Are you asking about the grass, tree, and cat textures? Content Processors can ask the Content Pipeline to build additional files without those files having to be in the solution window. This is how the textures that are applied to a model are built, without the textures themselves having to be in solution explorer. The VegetationProcessor extends from the ModelProcessor, so it gets the same behavior.

    Eli Tayrien - XNA Framework Developer
  • 8/22/2008 4:05 AM In reply to

    Re: Creating Billboards On Heightmap

    As I was trying out the BillboardSample, i tried to comment away one of the code which is :
                    //GeometryContent cats = CreateVegetationGeometry("cat.tga",
                                                                    //5, 5, 0, identity);
    and replace with another line code:
                    GeometryContent cats = CreateVegetationGeometry("fgrass.tga",
                                                    5, 5, 0, identity);

    then I compiled. There was an error stating:
    Error    1    Missing asset "C:\BillboardSample\Billboard\Content\fgrass.tga".    C:\BillboardSample\Billboard\Content\landscape.x    BillboardWindows

    Thus, I was wondering how could I import in the additional contents ?

  • 8/25/2008 10:08 AM In reply to

    Re: Creating Billboards On Heightmap

    anyone willing to give a helping hand ?
  • 8/27/2008 7:16 PM In reply to

    Re: Creating Billboards On Heightmap

    There's nothing tricky you have to do here: just make sure that fgrass.tga is in the directory that it's looking in. Is fgrass.tga in "C:\BillboardSample\Billboard\Content\" ?
    Eli Tayrien - XNA Framework Developer
  • 8/28/2008 12:41 AM In reply to

    Re: Creating Billboards On Heightmap

    totti10:
    anyone willing to give a helping hand ?

    http://www.nfostergames.com/terrainSample.htm

    There you go. Quad-tree terrain system with billboard grass.

    The sample is fairly buggy with many ATi cards. It is an old sample, about a year old I believe, and I never had time to update it. It is likely written for XNA 1.0r, so you may have to do a little work to convert it to 2.0 (bloom postprocessing and index/vertex buffer calls). If anything at least the code may help you.

    XNA QuickStart Engine (3D Game Engine for XNA) | My site
    "I'll be whatever I want to do!", Philip J. Fry
  • 8/28/2008 5:03 AM In reply to

    Re: Creating Billboards On Heightmap

    Hi Lord Ikon

    Are you Nic ?

  • 8/28/2008 5:13 AM In reply to

    Re: Creating Billboards On Heightmap

    Hi Eli Tayrien

    It was my mistake. I typed the wrong file extension. Typed .tga instead of .png.
    Thanks for the help !
  • 9/1/2008 2:56 AM In reply to

    Re: Creating Billboards On Heightmap

    totti10:
    Hi Lord Ikon

    Are you Nic ?

    Yes, the link was from my own website, or I'd have given credit to someone else when I posted it. :)

    XNA QuickStart Engine (3D Game Engine for XNA) | My site
    "I'll be whatever I want to do!", Philip J. Fry
Page 1 of 1 (13 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG