Jump to content

Instancing?


Game Producer
 Share

Recommended Posts

I tried mesh=LoadMesh and then 40x copyEntity(mesh), but the FPS numbers are the same if I just use 40x mesh=LoadMesh

 

My gfx card has instancing supported. Does it work with animated/material-painted meshes?

Leadwerks Engine 2.5

Initializing Renderer...

OpenGL Version: 4.1.0

GLSL Version: 4.10 NVIDIA via Cg compiler

Render device: GeForce GTS 450/PCI/SSE2

Vendor: NVIDIA Corporation

DrawBuffers2 supported: 1

32 texture units supported.

GPU instancing supported: 1

Max batch size: 64

Shader model 4.0 supported: 1

Conditional render supported: 0

Intel Dual Core 3GHz / GeForce GTS 450 - 1024 MB / Driver ver 267.59 / 8 GB RAM / Win 7 - 64 bit / LE2.50 / BMAX 1.48

game producer blog - Dead Wake Zombie Game powered by Leadwerks Engine

Twitter - Unfollow me

Link to comment
Share on other sites

CopyEntity() will instance CreateXXX() commands. ie. CreateCube(). If you do 10k CreateCube() they won't be instanced. If you do 1 CreateCube() and CopyEnity() on it 10K they will be. If you LoadModel() 10K times on the same model it'll instance it because it knows it already has it loaded.

Link to comment
Share on other sites

The engine automatically instances meshes when you load a file from the same path.

Ok. There goes my fancy caching tool then xD

 

CopyEntity() will instance CreateXXX() commands. ie. CreateCube(). If you do 10k CreateCube() they won't be instanced. If you do 1 CreateCube() and CopyEnity() on it 10K they will be. If you LoadModel() 10K times on the same model it'll instance it because it knows it already has it loaded.

Roger that.

 

FYI, in Leadwerks3D you can do this with all assets to load a new copy:

Model* model = LoadModel("mymodel.mdl",LOAD_UNIQUE);

Good to know, this is excellent addition and will help creater much lower file size (earlier I had to create several copies of my 10 meg humongous character file)

 

Currently I have the need to use the same geometry but different skins.

You instanced your reply, I see it duplicated!

Intel Dual Core 3GHz / GeForce GTS 450 - 1024 MB / Driver ver 267.59 / 8 GB RAM / Win 7 - 64 bit / LE2.50 / BMAX 1.48

game producer blog - Dead Wake Zombie Game powered by Leadwerks Engine

Twitter - Unfollow me

Link to comment
Share on other sites

Currently I have the need to use the same geometry but different skins.

 

 

Flexman have you ever seen this thread and shader? http://www.leadwerks.com/werkspace/topic/607-non-instancing-copy-command/page__p__5296__hl__instancing__fromsearch__1#entry5296

 

Bottom of 2nd page he has the shader file. It lets you have a giant texture that stores all the different skins and you control which section of this giant texture to use from the alpha value of SetColor I believe it is. His video that he links to seems to no longer be online but in the thread he should write the usage I think.

Link to comment
Share on other sites

Flexman have you ever seen this thread and shader? http://www.leadwerks.com/werkspace/topic/607-non-instancing-copy-command/page__p__5296__hl__instancing__fromsearch__1#entry5296

 

Bottom of 2nd page he has the shader file. It lets you have a giant texture that stores all the different skins and you control which section of this giant texture to use from the alpha value of SetColor I believe it is. His video that he links to seems to no longer be online but in the thread he should write the usage I think.

 

Thanks for that great link Rick.

 

I thought about something like it, using the vert colour as an offset. I don't know how practical it might be for a helicopter with large textures but there might be something in it (a decal atlas or some such).

 

Thanks again.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...