Results 1 to 5 of 5
  1. #1

    Default InstancedStaticMeshComponent... how to use?

    Hi guys,

    another day, another thread with a question I really tried hard to find more information about this, but no success :/
    In a few previous threads I asked about spawning a DynamicSMActor_Spawnable during gameplay which worked out fine. But now I've come to another problem.. when I spawn about 200++ Blocks of the DynamicSMActor_Spawnable Class, the performance drops.
    Then I search uncodex for some cool parameters which would help me with instancing so I came to the InstancedStaticMeshComponent. As far as I have seen the rendering information ingame, the problem are the StaticMeshComponents of the DynamicSMActor_Spawnable, cause they are drawn seperatly. I read about this stuff, and the possibility to call the draw call only once for a staticmesh and then use its instances, which will improve the performance greatly.
    My DynamicSMActor_Spawnable class looks like this:

    Code:
    defaultproperties {
    Begin Object Class=StaticMeshComponent Name=TestSMComp
    		StaticMesh = StaticMesh'BlocksPackage.DefaultBlock46'
    		LightEnvironment = MyLightEnvironment
    		BlockRigidBody=true
    		CollideActors=true
    		BlockActors=true
    End Object
    	CollisionComponent = TestSMComp;
    	StaticMeshComponent = TestSMComp;
    	Components.Add(TestSMComp);
    	bMovable=false
    }
    Now I've tried to change the Object in the defaultproperties to Class=InstancedStaticMeshComponent... without success... the compiler doesn't throw any error, but no mesh is showing up.
    In the Unreal Editor I set the option "Used for instancing" of the DefaultBlock46 to true, but it doesn't help :/
    I think I have to tell the StaticMeshComponent, that it should be instanced.. but I really have no idea how...
    Probably anyone has made any experience with this and could help me Thanks a lot!

    Eisregen

  2. #2
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,515

    Default

    As far as I know, this is used for procedural buildings right now. I don't think you can create them normally. Be nice if you could though.

    What I recommend you do instead, is to add new static mesh components to an actor. Components have less overhead than actors.I usually have a static mesh collection actor which manages sixty four or so mesh components.
    Last edited by Solid Snake; 12-02-2010 at 04:38 PM.

  3. #3

    Default

    So if we talk in blocks again.. to make a flat plain with 10 x 10 blocks, you mean I should spawn a 640x640x64 DynamicSMActor_Spawnable and add a StaticMeshComponent (my block with 64x64x64) to it, and repeat this until I have added the 10 x 10 blocks as StaticMeshComponents to the DynamicSMActor_Spawnable? But how could I control the location of the StaticMeshComponents inside the SMActor? You ain't got any code snippets which worked for you I could take a look at?
    All this sounds damn interesting! I would love to hear more about it

  4. #4
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,515

    Default

    Primitive components can be offseted against the actors location, or just use absolute location. Look it up in the primitive component source code.

  5. #5

    Default

    Sounds nice, thanks a lot Solid Snake I will test it asap to check performance... hopefully it will bring the desired effect!


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.