Questions tagged [instancing]

Instancing is a GPU rendering optimization where many objects using the same mesh are rendered in a single draw call, with a separate buffer containing the data that should be unique for each instance of the mesh (including its transformation matrix, and potentially other information like tinting or shader parameters).

Filter by
Sorted by
Tagged with
0 votes
0 answers
54 views

Graphics.RenderMesh in update with massive loop

I have millions of objects that I want to render. I found that instantiate is not suitable, so I'm using Graphics.RenderMesh which is amazingly fast and light. But here comes the problem: it takes CPU ...
Muhammad Faizan Khan's user avatar
0 votes
1 answer
245 views

Is instanced rendering any different from indexing seperate buffers using div and mod in the shader?

As far as I can tell instanced rendering is simply a way to separate a single vertex buffer into a buffer for vertex-specific data and instance-specific data. This could be useful for rendering ...
CPlus's user avatar
  • 143
0 votes
1 answer
36 views

Most but not all quads appear corrupted when passing matrix and colour using VBO for instanced rendering

I was trying to batch quads with the same texture and blend mode into the single draw call using glDrawElementsInstanced. As long as I use just a position, texture ...
Anton Grant's user avatar
0 votes
1 answer
113 views

How to draw selected instances with gl_InstanceID and glDrawElements...?

I want to draw a selected number of instances using glDrawElements... but I don't know which function to use and how to set the parameters. I set the ...
KennyTan's user avatar
0 votes
1 answer
266 views

Iterating through every pixel in a shader - skipping pixels

I made the below shader to draw a mesh for every pixel on a texture, and color it with that pixel. It iterates through the pixels, correctly drawing and coloring the mesh instances. However it skips ...
Wiley Rush's user avatar
0 votes
0 answers
62 views

Is there any benefit of combing Instance Meshing with quadtrees LoD?

I would like to know if there would be any benefit of combing Instance Meshing with quadtrees LoD? Besides the obvious performance improvement of only having one mesh I wanted to try and implement ...
Miguel Myers's user avatar
1 vote
0 answers
207 views

GLSL GLTF Instanced Hardware Skinning

I'm beating my head on trying to get hardware skinning going in my engine. We're using OZZ Animation and TinyGLTF together to animate models. The issue seems to either stem from how OZZ maps their ...
KKlouzal's user avatar
  • 252
2 votes
1 answer
671 views

Vulkan SSBO Array Of Structs

I am trying to create a Vulkan Storage Space Buffer Object which contains an array of structs for use in my vertex shader. I believe I'm missing something fundamental here because the 1st struct in ...
KKlouzal's user avatar
  • 252
1 vote
1 answer
1k views

New to Godot having problem understanding Button Group

I'm having an issue trying to understand the ButtonGroup logic, totally new to GDScript, don't have a clue of what I'm doing. Obviously is wrong. I created a scene that I saved in a folder called &...
raphie's user avatar
  • 113
0 votes
1 answer
293 views

Is there any performance difference between Draw() and DrawInstanced(1)?

The background of the question is, does it make sense to introduce an if case when drawing a mesh for whether there is instancing or not? This is using DirectX 11 ...
thalm's user avatar
  • 227
1 vote
0 answers
314 views

How can I instantiate an object at a certain position?

In my game, the player drives a car and when the car reaches the end of the road, I want a different road prefab to be spawned. I have multiple road prefabs, and want to be able to spawn one when the ...
KillerRobot.blend's user avatar
0 votes
0 answers
73 views

How can I snap a mesh to the grid, on dragging it into the scene, in Unity?

I've got a game that involves voxel-like game object management. Each voxel object snaps to the integer coordinates in Unity's scene, at play time—easy enough to do in the ...
Michael Macha's user avatar
2 votes
1 answer
747 views

deleting and re-referencing nodes with $

I want to delete a scene and re-load it. This code would fail later, because the new "CoolScene" has in fact a different name, something like "@NotSuchCoolName@34", and thus it ...
grokkaine's user avatar
  • 143
1 vote
0 answers
119 views

Why instantiated Static Mesh gets scaled in Unreal Engine 4? [closed]

Building a project in Unreal Engine 4.26 while trying to increase performance of the videogame I ended up using instances of static meshes where possible. This generated an issue: My instantiated ...
Simone Lungarella's user avatar
4 votes
1 answer
281 views

Data structure for collecting entities for instanced rendering

My game, a citybuilder, has many simple entities that rendered via glDrawArraysInstanced. A large city has over 600,000 entities, but most of those entities are one of a few hundred meshes. Every ...
Lone Pine's user avatar
5 votes
1 answer
4k views

How to declare per-instance properties for instances rendering on a shader graph?

Unity Version: 2019.4.1f1 Render Pipeline: URP I created a shader using Unity's Shader Graph, and I want to apply GPU Instancing on this shader, but there is no way to declare per-instance properties ...
Fadi Obaji's user avatar
0 votes
0 answers
427 views

Saving mesh and instance data on the GPU?

I am trying to optimize drawing a large number of voxels by using GPU instancing in Unity. I am currently using Graphics.DrawMeshInstanced in a script Update(), but it occurred to me that I am still ...
xidyron's user avatar
1 vote
1 answer
409 views

Efficiently rendering lots of the same mesh in Unity3D, but with different colors?

I'm working on a tile based game, where grass is spreading from tile to tile, so soon lots of grass appear on the board. Instancing is on, so the FPS is kind of good, even with 300k triangles (1 ...
Tudvari's user avatar
  • 731
0 votes
1 answer
577 views

D3D11 Instancing - Help with sending instance data using two vertex buffers. First, for position and color and Second, for per-instance Matrix Data

So here is the premise: I have 2 vertex buffers buffers whose data and corresponding definition is as follows: Vertex 1: This one contains the per instance data ...
Rudraksha Shah's user avatar
1 vote
1 answer
664 views

Efficient update of instance data for instance rendering

I started implementing instanced rendering in my 3D engine, but I quickly stumbled upon some issues that I'm not sure whats the best practice to work around. When I setup my scene, I capture the ...
Greg's user avatar
  • 204
1 vote
1 answer
560 views

Change object's location at instantiated moment

I'm trying to instantiate object(scene) and set it's spawn position at the spawn time. Here's the code I wrote: ...
modernator's user avatar
  • 1,213
0 votes
2 answers
1k views

How to access the parent of a cloned prefab?

I have a menu that gets populated at runtime with buttons whose text components are based on objects that the game manager has in its databases. At the start, the menu is empty: See that "A" graphic? ...
hatinacat2000's user avatar
6 votes
1 answer
1k views

instancing and GPU skinning

I'm trying to render a large number of identical rigged entities with independent animation. Compared to standard skeletal animation, I can't compute the pose of each entities and send it to the GPU ...
Kiord's user avatar
  • 101
0 votes
1 answer
539 views

OpenGL C++ Drawing particles instanced performance

In my 2D Game Engine I'd like to reduce the amount of draw calls. I used to do a draw call for every particle, which yields worst performance. I've tried instanced rendering in OpenGL but my ...
moepmoep12's user avatar
0 votes
1 answer
52 views

Can't get Instantiate working

I am building a 2D game and I want to fire a bullet from my player whenever the player press certain button. But, When I use instantiate and add force to my rigidbody it won't work. The code is: - <...
Sabin Pyakurel's user avatar
0 votes
0 answers
25 views

I Can't spawn buttons in my Grid. why?

Today i was following a tutorial about making a shop, but i got a problem. and i've followed the scripting tutorial, but it seems i can't spawn a button inside the grid when i pressed GetItemButton. ...
Bhaswara Arizon's user avatar
0 votes
1 answer
66 views

Affecting all instances of a GameObject at once

I want all instances of a prefab to change their velocity when one of them is clicked, and I think having each object constantly check a variable with a coroutine might not be the best solution. How ...
Hussar's user avatar
  • 15
0 votes
1 answer
823 views

error X4016: SV_InstanceID semantic cannot be used with 10Level9 targets

I'm using a variant of the D3D12 UWP template that comes with VS2017 Community Edition and I have two related questions: When I add this italicized and bolded code to the vertex shader signature, I ...
Shawn Eary's user avatar
0 votes
1 answer
1k views

Instantiate unity sometimes lags the game some times it doesnt

I have a script that instantiates a object lets say every half a second. THis object is of the type .fbx and has a file size of 53kb, lets call this object A. When ...
FutureCake's user avatar
1 vote
0 answers
329 views

Unity Graphics.DrawMesh equivalent for Physics?

I'm working on something where the same graphics mesh is rendered multiple times in the scene. The problem with this is that each of those graphics items have a physics mesh which isn't there in the ...
user3797758's user avatar
  • 3,641
0 votes
1 answer
4k views

Enabling / disabling Static objects in Unity

The Unity docs clearly explain that game objects marked static should not be moved for performance reasons but I can't find any info regarding enabling / disabling. Almost everything in my games ...
user avatar
2 votes
1 answer
2k views

DX12 Passing an Instance Buffer

I'm trying to take the DX12 Cube Demo that comes with VS2017 Community and draw three cubes instead of one. Unfortunately, the VertexShader doesn't seem to be getting my instance data. In my ...
Shawn Eary's user avatar
0 votes
1 answer
81 views

Spherecast - enabling MeshRenderer of selector target around prefabbed object once hit and disabling Meshrenderer when not hit anymore

I have an interesting problem - I have been looking up for solutions on this but I think there is something I am missing and I require a little more knowledge. I have a scene and the scene has an ...
Mark Quinn's user avatar
-1 votes
1 answer
437 views

Programmatically created instance does not execute any code

I've created a new instance, positioned it, and added it to the scene like this: ...
Luc's user avatar
  • 172
2 votes
1 answer
783 views

Instantiated Object returns Null outside Start method

I'm attempting to access an instantiated 'goalTemp' GameObject from a different function inside the same script. I'm getting the information in the Start method, assigning the GameObject find/get ...
Mira's user avatar
  • 139
0 votes
1 answer
60 views

Errors while instancing particles

Im creating a particle system of my own, and I have some draw issues with it. It's the first time I use instancing, so it's probable I have some concept errors. First, I create three buffers: one for ...
Cabreira's user avatar
2 votes
2 answers
3k views

How to expose a child node’s texture from the parent in Godot

I built a simple scene that I instanciate at will. Simply a KinematicBody2D as root, containing a Sprite and a ...
BadgerBadger's user avatar
1 vote
0 answers
430 views

Uniform arrays do not work on every GPU

I am trying to implement instanced rendering for objects that repeat, so I came up with idea I could simply group objects that loaded same model files, create array with their Model matrices and so on,...
user avatar
1 vote
1 answer
2k views

Why don't my generated instances update when I change their prefab?

I’m making an Editor tool -- a ScriptableWizard -- that instantiates a prefab on a grid. But I find that when I update the prefab, the instances don’t update. When I instantiate prefabs ...
Val's user avatar
  • 113
0 votes
2 answers
71 views

Is there any way to change the layering of objects in Actionscript 3 without altering the run order?

I'm making a simple platformer in Adobe Animate, and I need the player to be layered in front of the stage because of a gimmick in the game. Unfortunately, whenever I change the layering order, it ...
user111981's user avatar
0 votes
1 answer
60 views

Unity prefab functionality without files?

Task Display a UI list Assumptions Most UI parts only get their data during runtime UI parts need to be styled in the editor (= before runtime) UI editing should be done with real time preview in ...
Raphael Schmitz's user avatar
1 vote
1 answer
1k views

No performance gain from instanced rendering?

I recently worked through this tutorial about instanced rendering. At the end it promises to draw a huge amount of instances of one model without performance drops. So I tried some simple instanced ...
mrdlink's user avatar
  • 323
0 votes
2 answers
2k views

Unity - Instantiate 2 copies at same time?? (Asteroids clone) C#

I haven't been at my computer learning code or game dev in a few months and am just starting again. I am trying to make a game very similar to Asteroids. In 3d but fixed camera from above so basically ...
Big T Larrity's user avatar
0 votes
2 answers
1k views

Unity - DontDestroyOnLoad - FindObjectsOfType(GetType()).Length is always returning 1

I'm trying to have an object with the DontDestroyOnLoad property. I want an object with NetworkIdentity to persist across scenes, so I can have a holder script for ...
Aaron Franke's user avatar
1 vote
0 answers
349 views

Why are my cached (in an array) gameobjects disappearing?

First, some context: I am developing a chunk loading system for unity. I load all the chunks as prefabs from disk to an array as a cache. When I need to load a chunk, I instantiate it from the cache ...
Thomas Mathieson's user avatar
0 votes
1 answer
125 views

How to manage instances of (placed) cards and decks in card games?

This question sounds quite specific, but I mean in general, how do you manage something like a card game when it comes to decks (one for player1, one for player2, ...) and placed cards focused on ...
nitwhiz's user avatar
  • 47
1 vote
1 answer
1k views

Get GameObject which instantiated me in Unity

How can I get a GameObject from another GameObject? If I know, that the GameObject I want to get instantiated(using function Instantite()) the GameObject from which I want to get it. If there is no ...
hellomates's user avatar
0 votes
1 answer
423 views

Particle system prefab not instantiated

I am trying to instantiate my fire particle system during runtime like this: ...
Eutherpy's user avatar
  • 125
0 votes
2 answers
669 views

In Theory, how much gain should I expect from instancing in OpenGL for small scene with large meshs?

I am trying to implement one-pass stereo rendering in OpenGL for a VR application that I am building. I am implementing this through instancing, so I make one render call ...
Mostafa Abdelraouf's user avatar
0 votes
1 answer
785 views

How to put a reference to my player (already instanced) into a prefab that will be instantiated later [duplicate]

I'm making an enemy in my game. He stands at the side of road with a rocket launcher and fires when you get close. It nearly all works fine, except I just need a reference to the players position so ...
Big T Larrity's user avatar