Jump to content

Recommended Posts

Posted

I crated crash-test for meshes:

for (int i=-20; i<20; i+=1)
{
	for (int j=-20; j<20; j+=1)
	PositionEntity(CreateCube(), Vec3(i*2,0,j*2));
}

So, there is 40 * 40 = 1600 cubes. How can i sure that instancing is used?

PS: In engine log i have "GPU instancing supported: 1", so video supports instancing.

Working on LeaFAQ :)

Posted

TEntity cube = CreateCube();
TMaterial mat = LoadMaterial("wall1.mat");

for (int i=0; i<100; i+=1)
{
	for (int j=0; j<100; j+=1)
	{
		cube = CopyEntity(cube);
		PositionEntity(cube, Vec3(i*2,0,j*2));
		PaintEntity(cube, mat);
	}
}

 

*fap-fap* xD

wow, almost no FPS drops in this case... looking really great.

 

This is instancing in editor, right?

post-648-12716770317207_thumb.jpg

Working on LeaFAQ :)

Posted

No, but it is possible to write a shader that chooses a skin to show on a single instance. Put two or four textures in one texture, then store a "skin" key value that gets stored in the instance color, which the shader uses to choose a skin. There is an example of this somewhere on the forum.

Let's build cool stuff and have fun. :)

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.

×
×
  • Create New...