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).
102 questions
0
votes
1
answer
150
views
How to efficiently construct model matrices in a vertex shader from a small amount of data, for instanced rendering of many moving 3d game characters
I am trying to efficiently render many 3d game characters: many instances of the same 3d model which can change their positions and z rotations each frame. For reference I'm using OpenGL but this ...
0
votes
0
answers
282
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 ...
0
votes
1
answer
638
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 ...
0
votes
1
answer
94
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 ...
0
votes
1
answer
424
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 ...
0
votes
1
answer
462
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 ...
0
votes
0
answers
98
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 ...
1
vote
0
answers
392
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 ...
2
votes
1
answer
1k
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 ...
1
vote
1
answer
2k
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 &...
0
votes
1
answer
498
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 ...
1
vote
0
answers
500
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 ...
0
votes
0
answers
119
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 ...
2
votes
1
answer
1k
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 ...
1
vote
0
answers
146
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 ...
4
votes
1
answer
419
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 ...
5
votes
1
answer
5k
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 ...
0
votes
0
answers
517
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 ...
1
vote
1
answer
635
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 ...
0
votes
1
answer
765
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
...
1
vote
1
answer
949
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 ...
1
vote
1
answer
889
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:
...
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? ...
6
votes
1
answer
2k
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 ...
0
votes
1
answer
625
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 ...
0
votes
1
answer
107
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: -
<...
0
votes
0
answers
33
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. ...
0
votes
1
answer
93
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 ...
0
votes
1
answer
1k
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 ...
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 ...
1
vote
0
answers
354
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 ...
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 ...
2
votes
1
answer
3k
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 ...
0
votes
1
answer
110
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 ...
-1
votes
1
answer
551
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:
...
2
votes
1
answer
899
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 ...
0
votes
1
answer
90
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 ...
2
votes
2
answers
4k
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 ...
1
vote
0
answers
465
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,...
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 ...
0
votes
2
answers
129
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 ...
0
votes
1
answer
92
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 the ...
1
vote
1
answer
2k
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 ...
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 ...
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 ...
1
vote
0
answers
376
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 ...
0
votes
1
answer
158
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 ...
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 ...
0
votes
1
answer
460
views
Particle system prefab not instantiated
I am trying to instantiate my fire particle system during runtime like this:
...
0
votes
2
answers
908
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 ...